/*	

	Copyright 2002 [c] Artlogic Media Limited and its licensors.
	All rights reserved. (http://www.artlogic.net/)
	
	Some portions ('MM SCRIPTS') [c] Macromedia Inc.

*/

// INIT VARS

	var pathToImages='/images/';

// BROWSER AND PLATFORM 020130

	var bName = navigator.appName;
	var bVer = parseInt(navigator.appVersion);
	var agt=navigator.userAgent.toLowerCase();  

	var OPERA = (agt.indexOf("opera")!=-1); // must be above IE4 as Opera users can set Opera to 'identify' as IE in preferences
	var NS4 = (bName=="Netscape"&&bVer>=4&&bVer<5);
	var NS6 = (bName=="Netscape"&&bVer>=5);
	var IE4 = (bName=="Microsoft Internet Explorer"&&bVer>=4&&!OPERA);
	var NS3 = (bName=="Netscape" && bVer < 4);
	var IE3 = (bName=="Microsoft Internet Explorer"&&bVer<4&&!OPERA);

	var menuActive = 0
	var menuOn = 0
	var onLayer
	var timeOn = null
	
	var thePlatform;
	var MAC = (agt.indexOf("mac") != -1);
	var WIN = (agt.indexOf("win") != -1);
	var X11 = (agt.indexOf("x11") != -1);
	var IE4WIN=(IE4&&WIN);
	var IE4MAC=(IE4&&MAC);
	var NS4MAC=(NS4&&MAC);
	var OPERAWIN=(OPERA&&WIN);
	var OPERAMAC=(OPERA&&MAC);
	
	var browserOK=(NS4||NS6||IE4||OPERAWIN) // supported browser for some functions
	var dropMenuOK=(NS4||NS6||IE4) // supported browsers for drop down menu function
	
	if (browserOK) { // support for layer style objects is different in IE and NS
		if (navigator.appName == "Netscape") {
			layerStyleRef="layer.";
			layerRef="document.layers";
			styleSwitch="";
		}else{
			layerStyleRef="layer.style.";
			layerRef="document.all";
			styleSwitch=".style";
		}
	}

// BROWSER & PLATFORM SPECIFIC CSS

	if(1==2) { // D I S A B L E D !
		if (IE4MAC) {
			document.write("\<link rel=\"stylesheet\" href=\"/styles/ie4_mac.css\">");
		} else if (NS4MAC) {
			document.write("\<link rel=\"stylesheet\" href=\"/styles/ns4_mac.css\">");
		} else if (IE4WIN) {
			document.write("\<link rel=\"stylesheet\" href=\"/styles/ie4_win.css\">");
		} else if (OPERAMAC) {
			document.write("\<link rel=\"stylesheet\" href=\"/styles/opera_mac.css\">");
		}
	}

// FLASH DETECT 020130
	
	// settable vars
	var flashVersionRequired = 4;

	// init vars
	var hasFlash=false;
	var flashVersion=0;	

	// flashDetected flags - must be declared globally as they are used by the 'document' object in the IE VBScript
	var flash2Detected=false;
	var flash3Detected=false;
	var flash4Detected=false;
	var flash5Detected=false;
	var flash6Detected=false;
	var flash7Detected=false;
	var flashDetectProcessed=false;

	function flashDetect() {

		var maxpluginsFlashVersion = 7; //	settable - the maximum version of Flash - set one version ahead. 
		
		flashDetectProcessed=true;
		
		// get detected version on IE4 win which requires a VBScript to detect Flash plugin (requires var IE4WIN, set in BROWSER AND PLATFORM section, above)
		if(IE4WIN){
			document.write("<scr"+"ipt language=\"VBScript\"\>\n");
			document.write("on error resume next\n");
			document.write("flash2Detected=(IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.2\")))\n");
			document.write("flash3Detected=(IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.3\")))\n");
			document.write("flash4Detected=(IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.4\")))\n");
			document.write("flash5Detected=(IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.5\")))\n");  
			document.write("flash6Detected=(IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.6\")))\n");  
			document.write("flash7Detected=(IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.7\")))\n");  
			document.write("\</scr"+"ipt\>\n"); // break up end tag so it doesn't terminate the script
		}	

		// get detected version on browsers which have the navigator.plugins array object

		if (navigator.plugins) { 
			if (navigator.plugins["Shockwave Flash 2.0"]|| navigator.plugins["Shockwave Flash"]) {
				var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
				var pluginsFlashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
				// the following two lines rewritten 081204 as the previous version broke at version 10
				var pluginsFlashVersionSplit = pluginsFlashDescription.split(".")[0].split(" ");
				var pluginsFlashVersion = parseInt(pluginsFlashVersionSplit[pluginsFlashVersionSplit.length - 1]);
				flash2Detected=(pluginsFlashVersion==2);    
				flash3Detected=(pluginsFlashVersion==3);
				flash4Detected=(pluginsFlashVersion==4);
				flash5Detected=(pluginsFlashVersion==5);
				flash6Detected=(pluginsFlashVersion==6);
				flash7Detected=(pluginsFlashVersion>=7); // use >= on highest version so it will detect future versions
			}
		}
 		for (i=2;i<=maxpluginsFlashVersion;i++) {  
			if (eval("flash" + i + "Detected") == true) flashVersion = i;
		}
		if(navigator.userAgent.indexOf("WebTV") != -1) flashVersion = 3; // webtv support (version 3)
		if (flashVersion >= flashVersionRequired)  hasFlash = true;                
	}
		
	flashDetect();  // call flashDetect function to set vars 'hasFlash' (true,false) and flashVersion (num)

	function placeFlash(flashMovieURL,fVersion,flashBackgroundColor,flashMovieWidth,flashMovieHeight,altImageURL,altImageAltText,altImageLink,altImageName,altCode) { 
		
		// 	Copyright 2002-2003 [c] Arlogic Media Limited - Version 2.1 January 28, 2003
		
		//	SYNTAX: placeFlash("flashMovieName",flashVersion,"backgroundColor",width,height,"altImageURL","altImageAltText","altImageLink","altImageName","altCode")
		//	EXAMPLE: placeFlash("/images/fcident.swf",6,"#000000",200,77,"/images/333399.gif","Alternative text","pluginspage","imgName","Alternative code")
		//	set the param - 'altImageLink' - to "pluginspage" to make the image click to the Flash downloads page)
		//	give the image a name using 'altImageName' so you can use an image map for the alternative image
		
		//	Jan 28, 2003 - added 'altCode' (non-flash html code; if present, supercedes altImage)
		
		if (!flashDetectProcessed) flashDetect(); // requires the function flashDetect(), above, to have been run - if it hasn't it is called here
		
		var faOn="";
		var faOff="";
		
		if (flashVersion>=fVersion) {
			var t="";
			t+="\<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\""+flashMovieWidth+"\" height=\""+flashMovieHeight+"\">";
			t+="\<param name=\"movie\" value=\""+flashMovieURL+"\">\<param name=\"quality\" value=best>\<param name=\"bgcolor\" value=\""+flashBackgroundColor+"\">";
			t+="\<embed src=\""+flashMovieURL+"\" quality=best bgcolor=\""+flashBackgroundColor+"\" width=\""+flashMovieWidth+"\" height=\""+flashMovieHeight+"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">\</embed>";
			t+="\</object>";
			document.write(t);
		} else {
			if (altCode != '') {
				document.write(altCode);
			} else {
				if (altImageLink=="pluginspage") altImageLink="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash";
				if (altImageLink!="") {
					var faOn="\<a href=\""+altImageLink+"\">";
					var faOff="\</a>";
				}
				document.write(faOn+"\<img src=\""+altImageURL+"\" width=\""+flashMovieWidth+"\" height=\""+flashMovieHeight+"\" alt=\""+altImageAltText+"\" border=\"0\" />"+faOff);
			}
		}
	}

	function getFlash(fVers,fMsg) { 
	
		// display 'Get Flash Player' image - params: flashVersion, message
		// define a css style '.getFlashBox' to style the surrounding box
		
		if(flashVersion<fVers) {
			var t="";
			t+="\<br>\<br>\<img src=\""+pathToImages+"333399.gif\" width=\"170\" height=\"1\">\<br>\<br>";
			t+="\<div class=\"getFlashBox\">";
			t+="\<a href=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\">";
			t+="\<img src=\""+pathToImages+"get_flashplayer.gif\" border=\"0\">\<br>\<br>";
			t+="\</a>";
			t+=fMsg;
			t+="\</div>";
			document.write(t)
		}
	}


// MISC

	function setStatus(theMsg) {
		window.status=theMsg;
		return true;
	}
	
	function returnClientDateLong() {
		// this function returns the date on the client's computer in the form 'Friday October 12, 2001'
		var t="";
		var today=new Date();
		var cdlMonthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];
		var cdlDayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; 
		cdl=cdlDayNames[(today.getDay())]+" "+cdlMonthNames[(today.getMonth())]+" "+today.getDate()+", "+today.getYear();
		return(cdl);
	}
	
	function clientDateLong() {
		// this function uses the function 'returnClientDateLong()' to return 
		// the date on the client's computer in the form 'Friday October 12, 2001'
		// to call this function, place the following code on your page: 
		// <script>clientDateLong()<script>
		document.write(returnClientDateLong());
	}
	
	function shim(w,h) {
		document.write("<img src=\""+pathToImages+"shim.gif\" width=\""+w+"\" height=\""+h+"\" border=\"0\">");
	}

	function img(n,a,w,h) { // images must be in the /usr/images/ directory (on the main server, not the image server)
		var pathToFile="/usr/images/", sString="";
		if (typeof a=="undefined"||aString=="") {var a=""} else {var aString=" align=\""+a+"\""};
		if (typeof w=="undefined"||wString=="") {var w=""} else {var wString=" width=\""+w+"\""};
		if (typeof h=="undefined"||hString=="") {var h=""} else {var hString=" height=\""+h+"\""};
		if (a=='left') {sString=" style=\"margin-right:15px;margin-bottom:10px;\""};
		if (a=='right') {sString=" style=\"margin-left:15px;margin-bottom:10px;\""};
		var t="\<img src=\""+pathToFile+n+"\""+wString+hString+aString+sString+">";
		document.write(t);
	}
	
	function download(t,l) {
		// SYNTAX: <script>download("text","filename")</script>
		document.write("\<a href=\""+pathToDownloads+t+"\" target=\"_blank\">"+l+"\</a>");
	}

// MM SCRIPTS

	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);
	
	function MM_setTextOfLayer(objName,x,newText) { //v4.01
	  if ((obj=MM_findObj(objName))!=null) with (obj)
		if (document.layers) {document.write(unescape(newText)); document.close();}
		else innerHTML = unescape(newText);
	}
	
	function MM_showHideLayers() { //v3.0
	  var i,p,v,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
		obj.visibility=v; }
	}

	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;
	}
	/* Functions that swaps images. */
	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_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;
	}
	
	/* Functions that handle preload. */
	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];}}
	}




//	THE FOLLOWING THREE FUNCTIONS ARE USED IN ACCESSIBILITY SITES...

	function setCookie(cookieName,cookieValue,nDays,path) {
		var today = new Date();
		var expire = new Date();
		if (nDays==null || nDays==0) {
			nDays=1;
		}
		expire.setTime(today.getTime() + 3600000*24*nDays);
		if (typeof path=="undefined") {
			document.cookie = cookieName+"="+escape(cookieValue)+";expires="+expire.toGMTString();
		} else {
			document.cookie = cookieName+"="+escape(cookieValue)+";expires="+expire.toGMTString()+";path="+escape(path);
		}
	}

	function readCookie(cookieName) {
		var theCookie=""+document.cookie;
		var ind=theCookie.indexOf(cookieName);
		if (ind==-1 || cookieName=="") {
			return ""; 
		}
		var ind1=theCookie.indexOf(';',ind);
		if (ind1==-1) {
			ind1=theCookie.length;
		}
		return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
	}

	function swapOutIfAccessibility(show,hide) {
		
		if (!(readCookie("style")=="default" || readCookie("style")=="null" || readCookie("style")=="")) {
			document.getElementById(show).style.display="block";
			document.getElementById(hide).style.display="none";
		}
	}
