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_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_findObj(n, d) { //v3.0
  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); 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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//flash

var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flashXInstalled = 5;

function isFlash(requiredVersion) {
	var myVersion = 0;

	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;	// true if we're on ie
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;	// true if we're on windows

	// write vbscript detection if we're not on mac.
	if(isIE && isWin) {
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
		document.write('</SCR' + 'IPT\> \n');
	}

	// next comes the standard javascript detection that uses the navigator.plugins array
	if (navigator.plugins) {
		if (navigator.plugins["Shockwave Flash"]) {
			var flashDescription = navigator.plugins["Shockwave Flash"].description;
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		
			// we know the version, now set appropriate version flags
			flash3Installed = flashVersion == 3;
			flash4Installed = flashVersion == 4;
			flash5Installed = flashVersion == 5;
		}
	}
	
	// loop through all versions we're checking, and set myVersion to highest detected version
	for (var i = 3; i <= flashXInstalled; i++) {	
		if (eval("flash" + i + "Installed") == true) myVersion = i;
	}

	if (myVersion >= requiredVersion) {
		return true;
	} else {
		return false;
	}
}

function writeFlash(swfFile, swfWidth, swfHeight, swfBGColor) {
	var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
	+ 'width="' + swfWidth + '" height="' + swfHeight + '"'
	+ 'codebase="http://active.macromedia.com/flash/cabs/swflash.cab#version=2,0,0,0">'
	+ '<param name="movie" value="' + swfFile + '">'
	+ '<param name="play" value="true">'
	+ '<param name="loop" value="false">'
	+ '<param name="quality" value="high">'
	+ '<param name="menu" value="false">'
	+ '<param name="bgcolor" value="#' + swfBGColor + '">'
	+ '<embed src="' + swfFile + '" '
	+ 'width="' + swfWidth + '" height="' + swfHeight + '" '
	+ 'swLiveConnect="false" '
	+ 'play="true" '
	+ 'loop="false" '
	+ 'quality="high" '
	+ 'menu="false" '
	+ 'bgcolor="#' + swfBGColor + '" '
	+ 'type="application/x-shockwave-flash" '
	+ 'pluginsppage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
	+ '</embed>'
	+ '</object>';
	document.write(oeTags);
}

function writeImg(imgFile, imgWidth, imgHeight) {
	var oeTags = '<img src="' + imgFile + '" '
	+ 'width="' + imgWidth + '" height="' + imgHeight + '" '
	+ 'border="false" '
	+ '>';
	document.write(oeTags);
}

//definitions

var lastdef;

function showDef(c) {
	hideDef();
	if (document.layers) { lastdef = document.layers[c]; }
	if (document.all) { lastdef = document.all[c].style; }
	if (document.layers) {
		document.captureEvents(Event.MOUSEMOVE);
	}
	document.onmousemove = mouseMove;
}

function divDefMove(x,y) {
	if (document.layers) { var t = parseInt(window.pageYOffset); }
	if (document.all) { var t = parseInt(document.body.scrollTop); }
	var newTop = y - 30;
	if (newTop < t) { newTop = t; }
	if (newTop < 120) { newTop = 120; }
	lastdef.left = 615;
	lastdef.top = newTop;
	lastdef.visibility="visible";
	document.onmousemove = "";
}

function hideDef() {
	if (lastdef) { lastdef.visibility="hidden"; }
}

function mouseMove(e) {
	if (window.event) {
		var x = window.event.clientX+document.body.scrollLeft;
		var y = window.event.clientY+document.body.scrollTop;
	} else {
		var x = e.pageX;
		var y = e.pageY;
	}
	divDefMove(x,y);
	return true;
}
