//<script language="javascript">// just here to colour the code in homesite :)


// decide whether to detect with JS, or VB
var useJS=( (typeof navigator.plugins).toLowerCase().indexOf("object")!=-1); // check plugins objects exists
if (useJS) useJS=navigator.plugins.length>0 ? true : false; // double check!
var isMac= navigator.userAgent.toLowerCase().indexOf("mac")!=-1;


if(!useJS && !isMac){
	// WRITE VB FOR WINDOWS IE...
	document.writeln ("<scr" + "ipt language=\"VBScript\" type=\"text/vbscript\">");
	// start VB
	document.writeln("Private i, x, FlashControlVersion,url");
	document.writeln("On Error Resume Next");
	document.writeln("x = null");
	document.writeln("FlashControlVersion = 0");
	document.writeln("For i = 8 To 1 Step -1 ");
	document.writeln("	Set x = CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & i)");
	document.writeln("	FlashControlInstalled = IsObject(x)");
	document.writeln("	If FlashControlInstalled Then");
	document.writeln("		VBflashVersion = i");
	document.writeln("		Exit For");
	document.writeln("	End If");
	document.writeln("Next");
	//end VB	
	document.writeln ("<\/sc" + "ript>");
}


///// FUNCTION GETS FLASH VERSION FROM PLUGINS OBJECT //////
function getFlash(){
	var vers=0;
	for(i=0; i<navigator.plugins.length; i++){
		versstring=navigator.plugins[i].description.toLowerCase();
		if(versstring.indexOf("shockwave flash")!=-1){ break; }
	}
	var pos=versstring.indexOf(".") -1;
	var vers=parseInt(versstring.substring(pos));
	return vers;
}



///// INITIATING FUNCTION GETS VARIABLES FROM EITHER JS, OR VB FUNCTIONS //////
function detectFlash(){

	if (useJS){
		var vers= getFlash();
		return vers;
	}

	else if(!useJS && !isMac){
		return (typeof VBflashVersion=="string" || typeof VBflashVersion=="number")? parseInt(VBflashVersion) : 0;	}

	else{ return "failed"; }

}




/////////////////// WINDOW LAUNCHER /////////////////// 
var launchwin;
function launchSite(url,w,h,popup){
	if(!popup){ document.location.replace(url); return; }

	//get screen width & height
	var screenW=window.screen.availWidth;
	var screenH=window.screen.availHeight;

	// get centred loc
	var winLeft= Math.round((screenW/2)-(w/2));
	var winTop= Math.round((screenH/2)-(h/2));


	//set pop up parameters
	var config= ("toolbars=0,menubar=1,location=0");

	if(screenW<w){
		w=screenW;
		config+=",scrollbars=1,resizable=1,status=1"; }
	else{
		config+=",scrollbars=0,status=0";	}

	

	if(!useJS && !isMac) h-=20; //shorten for PC
	config+=(",width="+w+",height="+h);

	// resize self first 
	if(top.outerWidth){ 
		top.outerWidth=w; // this more accurate on netscape 4 
		top.outerHeight=h;
	}
	else{ top.resizeTo(w,h); }

	if (winLeft && winTop){
		top.moveTo(winLeft,winTop);
		config+=",top=" +winTop+ ",left=" + winLeft;
	}

	// open configured window 
	launchwin=window.open(url,"launchwin",config);
	setTimeout("launchwin.focus()",100);		   
}























