
function flashObject (url,size) {

		
	document.write( ''+
//		'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" width="693" height="474" id="circ_player" align="middle">'+
		'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" width="'+ size +'" height="'+ size +'">'+
		'	<param name="movie" value="' + url + '"/>'+
		'	<PARAM NAME=menu VALUE=false><PARAM NAME=scale VALUE=noscale> <PARAM NAME=salign VALUE=LT>'+
		'	<param name="quality" value="high" />'+
		'	<param name="play" value="false">' + 
		'	<param name="WMode" value="Transparent">' + 
		'	<embed src="' + url + '" swliveconnect="true" '+
		'		quality="high" SWLIVECONNECT="true"'+
		'		width="'+ size +'" '+
		'		height="'+ size +'" '+
		'		border="0" wmode="transparent" '+
		'		type="application/x-shockwave-flash" '+
		'		flashvars="" ' + 
		'		pluginspage="http://www.adobe.com/go/getflashplayer" />'+
		'</object>'+
		'' );
}

function utilityFunction (string,size) {


	// show overlay 
	showCover();	
	
	// show utility workspace
	showUtilityFrame();	

	document.getElementById('utilityWorkspace').innerHTML = "<div style='width:100%'><center><div  style='padding:20px;background:#ffffff;border:1px solid #9f9f9f;width:480px'><div id='utilityVideoFrame'></div><i>Annoying pauses can be avoided by clicking PLAY then PAUSE, wait for download then hit PLAY again.</i><br><a href='javascript:closeWin()'>close window</a></div></center></div>";

	showHideLayers('','utility','visible');

	if (flashOk(8,0,0)) {
	
		//document.getElementById('utilityVideoFrame').innerHTML = string;
	
		var FOp = { movie:string,width:size,height:size,majorversion:"8",build:"0",autoplay:"true",play:"true",id:"topPlayer",name:"topPlayer"
					};
		UFO.create(FOp, "utilityVideoFrame");

	} else {
	
		document.getElementById('utilityVideoFrame').innerHTML = ''+
						'Flash 8 is required to watch locale videos.<br>Please update your flash to watch this program:<br>'+
						'<a href="http://www.adobe.com/products/flashplayer/" target=_new>http://www.adobe.com/products/flashplayer/</a><p>'+
						'<a href="http://www.adobe.com/products/flashplayer/" target=_new><img src="/images/gen/get_flash.gif" border="0"></a>'+
						'';
		
	}	

}


function showUtilityFrame () {

	document.getElementById('utility').innerHTML = getUtilityFrame();

}

function clearUtilityFrame () {

	document.getElementById('utility').innerHTML = '';
	showHideLayers('','utility','hidden');

}

function closeWin() {
	hideCover();
	clearUtilityFrame();
}

function getUtilityFrame () {

	var _utilityFrame = "<div align=center><div id='utilityFrame' style='position:relative;'><div style='position:absolute;top:0px;left:0px;z-index:120'><div id='utilityWorkspace'></div></div> <!-- close up position --></div> <!-- utitlityFrame --></div><!-- center -->";
	return _utilityFrame;

}


var shortTimeoutLength = 1500; // 1.5 seconds
var shortTimeout = null;

var endShortTimeoutEval = null;
var lastHttpRequestObj = null;

function hideCover(id)
{
	resizeCover('cover');
	//showHideLayers('','cover','hidden');
	setClass('cover','coverOff');
}

function showCover(id)
{
	resizeCover('cover');
	repositionDiv("utility",100);
	setClass('cover','coverOn');
}

var tmpintoDiv;

function postProcess (reqTmp, intoDiv) {

	if (shortTimeout) {
		lastHttpRequestObj = reqTmp;
		tmpintoDiv = intoDiv;
		endShortTimeoutEval = 'postProcess(lastHttpRequestObj, tmpintoDiv)';
		
		//alert('postProcess::continue::'+ req);
		
	} else {
		getElmById(intoDiv).innerHTML = reqTmp.responseText;
		hideProcessing();
		showHideLayers('','utility','visible');
		
		lastHttpRequestObj = null;
		
		//alert('postProcess::execute::'+ req);
	}

}

function endShortTimeout () {
	
	shortTimeout = null;
	if (endShortTimeoutEval) {
		//alert('endshorttimeeval::'+ endShortTimeoutEval);
		
		eval(endShortTimeoutEval);
		endShortTimeoutEval = null;
	}

}

function showProcessing(strMsg)
{	
	if (!strMsg) {
		strMsg = 'Loading...';
	}
	
	//clear existing timeout
	//if (shortTimeout) {
	//	shortTimeout = null;
	//}

	resizeCover('processing');
	repositionDiv('processingInfo',125);
	setClass('processing','processOn');
	document.getElementById('processingInfo').innerHTML = "<center><div id='processingWait'><div id='processingWaitInfo'>"+ strMsg +"<br><img src='/images/gen/loading_40x40.gif' width='40' height='40' vspace='5'></div></div></center>";
	
	showHideLayers('','processingInfo','visible');
	shortTimeout = setTimeout('endShortTimeout()',shortTimeoutLength)
	//showHideLayers('','cover','visible');
}

function hideProcessing()
{
	resizeCover('processing');
	//showHideLayers('','cover','hidden');
	document.getElementById('processingInfo').innerHTML = "";
	showHideLayers('','processingInfo','hidden');
	setClass('processing','coverOff');
}

function repositionDiv(objId,plusDistance)
{
	page_pos = getPagePosition();
	document.getElementById(objId).style.top = (page_pos[1] + plusDistance) +'px';
}

function resizeCover (objId) {

	page_dims = getPageSizeWithScroll();
	document.getElementById(objId).style.height = page_dims[1]+'px';

}

function getPageSizeWithScroll()
{
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	return arrayPageSizeWithScroll;
}

function getPagePosition ()
{
  var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}


function validateEmailField(str) {
	if (str == '' || str.indexOf('@',1) == -1) {
		return false;
	} else {
		return true;
	}
}


function showLayerBlock(id) {
	//if (document.getElementById(id)) {
		document.getElementById(id).style.display = 'block';
		document.getElementById(id).style.visibility = 'visible';
	//}
}

function hideLayerBlock(id) {
	//if (document.getElementById(id)) {
		document.getElementById(id).style.visibility = 'hidden';
		document.getElementById(id).style.display = 'none';
	//}
}







/*
DETECTION CODE 
*/


// Flash Player Version Detection - Rev 1.5
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function GetControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVersion(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = GetControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function flashOk(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVersion();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}