﻿// JScript File
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var Vista = navigator.userAgent.indexOf("Windows NT 6") != -1;
function writeJCWW(currentPage)
{
	// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
	if ( hasProductInstall && !hasReqestedVersion && !Vista )
	{
		// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
		// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
		// DO NOT MODIFY THE FOLLOWING FOUR LINES
		// Location visited after installation is complete if installation is required
		var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
		var MMredirectURL = window.location;
		document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		var MMdoctitle = document.title;

		AC_FL_RunContent(
			"src", "flash/playerProductInstall",
			"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
			"width", "500",
			"height", "500",
			"align", "middle",
			"id", "detectionExample",
			"quality", "high",
			"bgcolor", "#3A6EA5",
			"name", "detectionExample",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	}
	else if (hasReqestedVersion)
	{
		// if we've detected an acceptable version
		// embed the Flash Content SWF when all tests are passed
		if(InternetExplorer)
		{
			AC_FL_RunContent(
				'codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
				'classid','clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
				'id','jcww',
				'width','994',
				'height','650',
				'align','middle',
				'src','flash/jcww',
				'quality','high',
				'bgcolor','#000000',
				'menu','false',
				'name','jcww',
				'flashvars','page=' + currentPage,
				'allowscriptaccess','sameDomain',
				'pluginspage','http://www.macromedia.com/go/getflashplayer',
				'movie','flash/jcww',
				//'wmode','transparent',
				'swLiveConnect','true',
				'type','application/x-shockwave-flash'
			);
		}
		else
		{
			document.write('<object style="position:relative; z-index:1;"');
			document.write('classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
			document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
			document.write('width="994" ');
			document.write('height="650" ');
			document.write('id="jcww" ');
			document.write('align="middle">');
			document.write('<param name="allowScriptAccess" value="sameDomain" />');
			document.write('<param name="movie" value="flash/jcww.swf" />');
			document.write('<param name="quality" value="high" />');
			document.write('<param name="bgcolor" value="#000000" />');
			//document.write('<param name="wmode" value="transparent" />');
			document.write('<param name="FlashVars" value="page=' + currentPage + '" />');
			document.write('<embed ');
			document.write('src="flash/jcww.swf" ');	
			document.write('quality="high" ');	
			document.write('bgcolor="#000000" ');
			//document.write('wmode="transparent" ');	
			document.write('flashvars="page=' + currentPage + '" ');
			document.write('width="994" ');	
			document.write('height="650" ');	
			document.write('name="jcww" ');
			document.write('id="jcww" ');
			document.write('swLiveConnect="true" ');	
			document.write('align="middle" ');	
			document.write('allowScriptAccess="sameDomain" ');	
			document.write('type="application/x-shockwave-flash" ');	
			document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" ');	
			document.write('/>');
			document.write('</object>');
		}
	}
	else
	{
		var flashVer = GetSwfVer();
		
		var alternateContent = '<div style="text-align:center; font-size:10px; padding:5px;"><a href=\'http://www.adobe.com/go/getflash/\'><img src=\'images/rune_flash.png\' width=\'60\' height=\'60\' alt=\'Adobe Flash Player\' border=\'0\' /></a><br />'
		+ 'This site requires Adobe Flash player 8.0.0 or above.<br />';
		
		if(flashVer != -1)
		{
			flashVer = flashVer.replace("WIN ", "");
			flashVer = flashVer.replace(/,/g, ".");
			alternateContent += 'You are currently using Flash Player version ' + flashVer + '<br />';
			
		}
		else
		{
			alternateContent += 'You do not currently have Flash Player installed.';
		}
		
		alternateContent += '<a href=\'http://www.adobe.com/go/getflash/\'>Get Flash</a></div>';
		
		document.write(alternateContent);  // insert non-flash content
	}
}
