



/**
* hasFlashPlugin()
* Detects whether or not the user has the correct flash plugin installed or not.
* returns 1 if true and 0 if false
*/
function hasFlashPlugin(requiredVersion) {

	if (requiredVersion == null) requiredVersion = 6;
	
	nPlugin = 0;
	
	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);
		var flash_ver = parseInt(version_check.description.substring(version_check.description.indexOf(".")-1))
	
		if (navigator.plugins && navigator.plugins["Shockwave Flash"] && flash_ver >= requiredVersion ) {
	
			nPlugin = 1;	
			
		}
		
	} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0
			&& (navigator.userAgent.indexOf("Windows 95") >= 0 
			|| navigator.userAgent.indexOf("Windows 98") >= 0 
			|| navigator.userAgent.indexOf("Windows NT") >= 0)) {
		
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('if ( nPlugin <= 0 ) then nPlugin = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+requiredVersion+'"))) \n');
		document.write('<\/SCR' + 'IPT\> \n');
		
	}
	
	return nPlugin;
	
}

/**
* createFlashObject()
* Embeds the flash with <object> tag alone for all browsers and is therefore xhtml compliant.
* Only fMovieSrc, fWidth, fHeight, fBgColor are considered to be required and the rest may be left out
*/

var flashId;
 
function createFlashObject(fMovieSrc, fWidth, fHeight, fBgColor, fVars, fBase, fAllowScriptAccess, fQuality, fAllowMenu, fWmode){
 		
 		var isIE = (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0);
 		
		fVars 							= (fVars == undefined) 						? "" : fVars;
		fWidth 							= (fWidth == undefined) 					? "100%" : fWidth;
		fHeight 						= (fHeight == undefined) 					? "100%" : fHeight;
		fBgColor 						= (fBgColor == undefined) 				? "#ffffff" : fBgColor;
		fBase 							= (fBase == undefined) 						? "" : fBase;
		fQuality 						= (fQuality == undefined) 					? "best" : fQuality;
		fWmode 							= (fWmode == undefined) 					? "window" : fWmode;				//transparent, opaque, window, 
		fAllowMenu 					= (fAllowMenu == undefined) 				? "false" : fAllowMenu; 				// true, false
		fAllowScriptAccess 	= (fAllowScriptAccess == undefined) 	? "always" : fAllowScriptAccess; //allways, sameDo or never
  	
  	//Create object tag id based on the filename in fMovieSrc	
  	var aSplit 					= fMovieSrc.split("/");
  	var fId 				= aSplit[aSplit.length -1].split(".")[0];
    flashId = fId;  	
  	var oeTags;
  	if (isIE){
  		//IE dont like the data attribute which causes the movie not to diplay before its loaded fully.
  		
  		oeTags = '<object type="application/x-shockwave-flash" id="'+fId+'" width="'+fWidth+'" height="'+fHeight+'">'
  	} else{
  		oeTags = '<object type="application/x-shockwave-flash" id="'+fId+'" data="'+fMovieSrc+'" width="'+fWidth+'" height="'+fHeight+'">'
  	}
  	
		oeTags += '<param name="movie" value="'+fMovieSrc+'"/>'
		+ '<param name="allowScriptAccess" value="'+fAllowScriptAccess+'"/>'
		+ '<param name="play" value="true">'
		+ '<param name="loop" value="true"/>'
		+ '<param name="quality" value="'+fQuality+'"/>'
		+ '<param name="menu" value="'+fAllowMenu+'"/>'
		+ '<param name="bgcolor" value="'+fBgColor+'" />'
		+ '<param name="base" value="'+fBase+'" />'
		+ '<param name="flashvars" value="'+fVars+'" />'
		+ '<param name="wmode" value="'+fWmode+'" />'
		+ '<font face="verdana" size="2"><b><br/><br/>Sorry - your flash plugin is outdated!</b></font><font face="verdana" size="1"><br/><br/>Click <a href="http://www.adobe.com/go/getflashplayer">here</a> to download latest flash plugin.</font>'
		+ '<\/object>';
	
		document.write(oeTags);  

}

/**
* Build flash vars string based on value in localtionm
*/
function buildFlashVars(){
	
		var flashVars = "";
		var pLocation = 'location=';
		
		if (top.location.hash.length > 1){
			//add the # value to the location parameter
			pLocation += top.location.hash.substr(1);
		}
		
		flashVars += pLocation;
	
		var query = getQueryString();
		if ( query.length > 1 ){
			flashVars += '&' +query;
		}
		
		return flashVars;
}

/**
* Get the query string from the URL
*/
function getQueryString(){
	
	var query = window.location.search.substring(1);
	
	if (query == null){
		query = "";	
	}
	
	return query;
}