var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function nav_DoFSCommand(command, args) {
  var theVarFromFlash = args;
  window.document.main.SetVariable("command", theVarFromFlash);
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
   navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
 document.write('<SCRIPT LANGUAGE=VBScript\> \n');
 document.write('on error resume next \n');
 document.write('Sub nav_FSCommand(ByVal command, ByVal args)\n');
 document.write('  call nav_DoFSCommand(command, args)\n');
 document.write('end sub\n');
 document.write('</SCRIPT\> \n');

}

connectionSpeed = 0;
	// The variable where connection speed information
	// will be stored when it is available.

function drawCSImageTag( fileLocation, fileSize, imgTagProperties ) {
	// This function draws the image tag required to run this process.
	// It needs to be passed:
	//     1.  (String)   The location of the file to be loaded
	//     2.  (Integer)  The size of the image file in bytes
	//     3.  (String)   The tag properties to be included in the <img> tag
	// Place a call to this function inside the <body> of your file
	// in place of a static <img> tag.
	
	start = (new Date()).getTime();
		// Record Start time of <img> load.
		
	loc = fileLocation + '?t=' + escape(start);
		// Append the Start time to the image url
		// to ensure the image is not in disk cache.
		
	document.write('<div id="detection" style="position:absolute; left:0px; top:0px; width:0px; height:0px; z-index:0; visibility:hidden;"><img src="' + loc + '" ' + imgTagProperties + ' onload="connectionSpeed=computeConnectionSpeed(' + start + ',' + fileSize + ');"></div>');
		// Write out the <img> tag.
	
	return;
}

function connectionType(speed) {
	// This function returns a string describing the connection type
	// being used by the user-agent hitting the page.
	
	SLOW_MODEM = 15;
	FAST_MODEM = 57;
	ISDN_MODEM = 120;
		// These are constants which define the base speeds
		// for a number of different connections.  They are
		// measured in units of kbps.
	
	if (speed) {
		if (speed < SLOW_MODEM) {
			return "Slow Modem";
		} else if (speed < FAST_MODEM) {
			return "Fast Modem";
		} else if (speed < ISDN_MODEM) {
			return "ISDN Modem";
		} else {
			return "Partial T1 or greater connection";
		}
	} else {
		return "Undetermined Connection";
	}
}

function computeConnectionSpeed( start, fileSize ) {
	// This function returns the speed in kbps of the user's connection,
	// based upon the loading of a single image.  It is called via onload 
	// by the image drawn by drawCSImageTag() and is not meant to be called
	// in any other way.  You shouldn't ever need to call it explicitly.
	
	end = (new Date()).getTime();
	connectSpeed = (Math.floor((((fileSize * 8) / ((end - start) / 1000)) / 1024) * 10) / 10);
	return connectSpeed;
}

function showSpeed() {
	switch (connectionType(connectionSpeed)) {
		case 'Slow Modem': MM_swapImage('low','','/public/fq/images/splash/button.low.detect.gif',1);
			break;
		case 'Fast Modem': MM_swapImage('low','','/public/fq/images/splash/button.low.detect.gif',1);
			break;
		case 'ISDN Modem': MM_swapImage('high','','/public/fq/images/splash/button.high.detect.gif',1);
			break;
		case 'Partial T1 or greater connection': MM_swapImage('high','','/public/fq/images/splash/button.high.detect.gif',1);
			break;
		default: MM_swapImage('low','','/public/fq/images/splash/button.low.detect.gif',1);
	}
	return;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);