var isIe4=false, isDom=false, isMac=false, isWin=false, isNs=false, isNs4=false, isFlash=-1, isLoaded=false;
var isIe=false, isIe50=false;

function init()
{
	if (isDom)
	{
		isLoaded=true;
	}
}

/** 
 * Writes in the relevant object/embed tags if flash support is
 * avaliable.  Assumes that non-dom browsers don't support flash.
 * 
 * bgcolour: Background colour of flash movie
 * movie:    The URL of the swf file
 * width:    The width of the movie
 * height:   The height of the movie
 * queryStr: Query string sent to the flash movie (via URL)
 * noflash:  The ID of the no-flash content container
 */ 
function writeFlash(bgcolour, movie, width, height)
{
	 var flashVer = getFlashVersion();
	
    if (flashVer >= 8)
    {        
        document.getElementById('flashMovie').style.background="none";
		  document.getElementById('flashMovie').style.backgroundColor="#ffffff";
		  
		  // create the object tag
        var objectTag = "";
        objectTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + width + '" height="' + height + '" border="0">';
        objectTag += '<param name="BGCOLOR" value="#' + bgcolour + '" />';
        objectTag += '<param name="MOVIE" value="' + movie + '.swf" />';
        objectTag += '<param name="PLAY" value="true" />';
        objectTag += '<param name="LOOP" value="true" />';
        objectTag += '<param name="QUALITY" value="high" />';
        objectTag += '<param name="SCALE" value="showall" />';
		  objectTag += '<param name="wmode" value="transparent" />';
        objectTag += '<embed src="' + movie + '.swf" width="' + width + '" height="' + height + '" play="true" loop="true" quality="high" bgcolor="#' + bgcolour + '" wmode="transparent" type="application/x-shockwave-flash" swliveconnect="false" scale="showall" border="0"></embed>';
        objectTag += '</object>';
        
        // output the object tag
        document.write(objectTag);
    }
}

/**
 * Checks for flash plugin version.
 * 
 * Returns:
 * No flash plugin: 0
 * Detection not avaliable: -1
 * Flash found: version number (> 0)
 */
function getFlashVersion() {
	var flashVer = 0;
	if (navigator.plugins && navigator.plugins.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x){
			if (x.description) {
				var y = x.description;
	   			flashVer = y.charAt(y.indexOf('.')-1);
			}
		}
	} else {
		result = false;
	    for(var i = 15; i >= 3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashVer = i;
   		}
	}
	return flashVer;
}



isMac=(navigator.platform=="MacPPC")? true:false;
isWin=(navigator.appVersion.indexOf("Win")!=-1)? true:false;
isIe=(navigator.appName=="Microsoft Internet Explorer")? true:false;
isIe4=(document.all)? true:false;
isDom=(document.getElementById)? true:false;
if ((parseInt(navigator.appVersion)==4) && (navigator.appName=="Netscape"))
{
	isNs4 = true;
	isImg = true;
}
window.onload=init;