var isIe4=false, isDom=false, isMac=false, isWin=false, isNs=false, isNs4=false, isFlash=-1, isLoaded=false, isIe=false, isIe50=false;

function init()
{
	if (isDom)
	{
		isLoaded=true;
	}
}

function showMe(divID)
{
	if (isLoaded) document.getElementById(divID).style.visibility='visible';
}
function hideMe(divID)
{
	if (isLoaded) document.getElementById(divID).style.visibility='hidden';
}
function writeMe(divID,divText)
{
	if (isLoaded)
	{
		document.getElementById(divID).innerHTML=divText;
	}
	if (isNs4)
	{
		document.layers[divID].document.open()
		document.layers[divID].document.write(divtext)
		document.layers[divID].document.close()
	}
}
function positionMe(divID,l,t)
{
	if (isLoaded)
	{
		document.getElementById(divID).style.display="block";
		document.getElementById(divID).style.position="absolute";
		document.getElementById(divID).style.top=t+"px";
		document.getElementById(divID).style.left=l+"px";
	}
}

function showNameCheck()
{
	window.open('/free-name-check/', 'nameCheck', 'resizable=yes,width=420,height=428,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no');
}

function writeFlash(bgcolour, movie, width, height, noflash)
{
	 var flashVer = getFlashVersion();
	
    if (flashVer >= 5)
    {        
        document.getElementById(movie).style.background="none";
		  document.getElementById(movie).style.backgroundColor="#B3AAA8";
		  
		  // 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="/ExpressBiz/resources/swf/' + 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="/ExpressBiz/resources/swf/' + 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;
