// All intellectual property rights relating to this code are owned by EURO RSCG DSW Partners, LLC.

var flashMin = 4;
var ShockMode = 0;

// Sniff Netscape's arrays for Flash
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
 if (navigator.plugins && navigator.plugins["Shockwave Flash"])
   ShockMode = 1;
}

// Use VBScript to sniff for IE Flash
if (navigator.userAgent.indexOf("Mac")==-1)
{
 document.write('<SCRIPT LANGUAGE="VBScript"> \n');
 document.write('on error resume next \n');
 document.write('ShockMode = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")) \n');
 var aTempVar="</S";
 aTempVar+="CRIPT> \n";
 document.write(aTempVar);
}

//alert(navigator.userAgent);
//alert(navigator.appVersion);

function writeflash4(filename,wide,high,color,altHtml,moviename){
  var flsh = '';
  if(moviename == null)moviename = movie;
  if ( ShockMode ) {
    //filename += flashQuery;
    //alert(filename);
    flsh += '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
    flsh += ' codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#navVersion=3,0,0,0"';
    flsh += ' ID='+moviename+' WIDTH="' + wide + '" HEIGHT="' + high + '">';
    flsh += '<PARAM NAME=movie VALUE="' + filename+ '">';
    flsh += '<PARAM NAME=quality VALUE=high>';
    flsh += '<PARAM NAME=bgcolor VALUE=' + color + '>';
    flsh += '<EMBED src="' + filename + '" quality=high bgcolor=' + color + ' menu=false WIDTH="' + wide + '" HEIGHT="' + high + '" NAME='+moviename+' swLiveConnect=true TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"><BR>';
    flsh += '</EMBED><NOEMBED>' + altHtml + '</NOEMBED></OBJECT>';
  } else {
    flsh += altHtml;
    flashPg = true;
  }
  tmp = filename;
  return flsh;
}

var noflash = '';
noflash += '<TABLE BGCOLOR="#FFFFFF" WIDTH="756" CELLSPACING="0" CELLPADDING="0" BORDER="0">';
noflash += '<TR>';
noflash += '    <TD WIDTH="102"><IMG SRC="/i/s.gif" WIDTH="102" HEIGHT="19"></TD>';
noflash += '    <TD WIDTH="1"><IMG SRC="/i/m/p666.gif" WIDTH="1" HEIGHT="341"></TD>';
noflash += '    <TD WIDTH="653">&nbsp;</TD>';
noflash += '</TR>';
noflash += '</TABLE>';

var flash2Detected,flash3Detected,flash4Detected,flash5Detected,fv,pgloc

function detectFlash(){
    var maxVersion=5;
	var actualVersion=0;

    var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		// true if we're on ie
    var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

    if(isIE && isWin){ // don't write vbscript tags on anything but ie win
	  with(document){
	    write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	    write('on error resume next \n');
	    write('flash2Detected = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	    write('flash3Detected = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	    write('flash4Detected = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	    write('flash5Detected = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
	    write('</SCR' + 'IPT\> \n');} // break up end tag so it doesn't end our script
    }

	if (navigator.plugins){								// navigator.plugins exist?
		if (navigator.plugins["Shockwave Flash 2.0"] 	// is it Flash 2?
		|| navigator.plugins["Shockwave Flash"]){		// is it Flash 3?

			// set convenient references to flash 2+ plugin description
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

			// set appropriate version flags
			 flash2Detected = flashVersion == 2;
			 flash3Detected = flashVersion == 3;
			 flash4Detected = flashVersion == 4;
			 flash5Detected = flashVersion == 5;
		}
	}

	// loop and set actualVersion to highest detected version
	for (var i = 2; i <= maxVersion; i++) {
		if (eval("flash" + i + "Detected") == true) actualVersion = i;
	}
	return(actualVersion);
}

var FlashVersion = detectFlash();

if(FlashVersion >= flashMin){
  ShockMode = true;
}else{
  ShockMode = false;
}

//ShockMode Switch
if (location.search == '?off') ShockMode = 0;
if (location.search == '?on') ShockMode = 1;

function setFCookie(){document.cookie = 'intro=true';}
function clrFCookie(){document.cookie = 'intro=';}
function shwFCookie(){alert(document.cookie);}

function FlashIntro(){
  if(document.cookie.indexOf('intro=true') == -1){
    return 'intro=false';
  }else{
    return 'intro=true';
  }
}
