/*
	local_utils.js
	Utility functions for episode 2
*/

<!--
var windowpic = null;
var wallwindowic = null ;
var g_plugin = 0;

// cookies function is in the region global cookies.js file
var acceptsCookies = nikeGeneralCookiesEnabled();


// FLASH DETECT DONE AT GLOBAL LEVEL :::::::::::::::::::::::::::::::>

// start browser and flash detect
// episode 2 requires Flash 7

var browserType = 0;  // Not IE 
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] &&    
    navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) 
    	{
	var version_check 	= (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0); 
	
	// check for major version
	var flash_ver 		= parseInt(version_check.description.substring(version_check.description.indexOf(".")-1));
	
	// check for minor version
	var flash_ver_minor 	= parseInt(version_check.description.substring((version_check.description.indexOf("r")+1), version_check.description.length));
	
	// Flash version must be greater than 6
	if (navigator.plugins && navigator.plugins["Shockwave Flash"] && flash_ver > 6 )
		{
		
			g_plugin = 1;

		}
	}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && navigator.userAgent.indexOf("Windows") >= 0) {
				
		document.write('<SCRIPT LANGUAGE=VBScript> \n');
		document.write('on error resume next \n');
		document.write('if ( g_plugin <= 0 ) then g_plugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7")))\n');

		document.write('</SCRI');
		document.write('PT> \n');
		
		browserType = 1;  // IE      
}



// Based on the Flash version, this function either display the Flash movie, or an image
// with information directing the user to the Macromedia site to download the plugin
					
function displayMainFlash(loclist_val, loclistart_val, idtest_val, tournament_id_val, participant_id_val, player_id_val) {

	// requires /usa/cookie/cookie.js
	var acceptsCookies = nikeGeneralCookiesEnabled();

 	if( !loclist_val || loclist_val == null || loclist_val == "" ) {
		loclist_val = "" ;
	}

	if ( g_plugin ) {
	
		var params = "?cm=yes&" + location.search.substr(1);

		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="Nikelab" name="Nikelab" WIDTH=1000 HEIGHT=700>');
		document.write('<PARAM NAME=movie VALUE="media/swf/nikelab_intro.swf' + params + '">');
		document.write('<PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#ffffff> <PARAM NAME=menu VALUE=false>');
		document.write('<EMBED src="media/swf/nikelab_intro.swf' + params + '"');
		document.write('WIDTH=1000 HEIGHT=700 TYPE="application/x-shockwave-flash" ');
		document.write('PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
		document.write('</EMBED>');
		document.write('</OBJECT>');

	} else {
		
		document.write('<a href="http://www.macromedia.com/go/getflashplayer" target="_blank"><img border="0" src="media/images/home/nikelab_noflash.gif" width="532" height="172" alt="nikelab.com" title="nikelab.com" /></a>') ;

	}

}


// functions for episode 2

function viewSpeedTrials2()
	{
	//window.open(globalPath + "v2/index.html?loclist=307096&loclistart=3", "Nikelab");
	location.href = globalPath + "v2/index.html?loclist=307096&loclistart=3"	
	}
	
function viewArchive0()
	{
	//window.open(globalPath + "v2/index.html", "Nikelab");
	location.href = globalPath + "v2/index_full_screen.html"
	}	
	
function viewArchive1()
	{
	//window.open(globalPath + "episode_1/index.html", "Nikelab");
	location.href = globalPath + "episode_1/index_full_screen.html"
	}
	
function speedDownload(mac)
	{	
	if(mac)
		{
		// --- mac version
		window.open(globalPath + "v2/media/swf/experiences/speed_trial_2/download/speed_trials_mac.sit", "download");
		}
	else
		{
		// --- pc version
		window.open(globalPath + "v2/media/swf/experiences/speed_trial_2/download/speed_trials_pc.zip", "download");
		}
	}
	
// end functions for episode 2

//-->

