<!--
//-------------------------------------------------------------------------------------
// JavaScript version: 1.2
// File Dependancies: none
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
//				G L O B A L    V A R I A B L E S 
//-------------------------------------------------------------------------------------
var g_bIsFlash = false;
var g_oBrowser = new cBrowser();
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
//	adding an event handler... use with caution! =)
//-------------------------------------------------------------------------------------
function arbAttachEventToElement(oElement, sEventName, sCode){
	var bOut = false;
	if(oElement[sEventName]){
		var s = new String(oElement[sEventName]);
		oElement[sEventName] = new Function(s.replace("function anonymous()", "") + " ; " + sCode);
		bOut = true;
	} else {
		oElement[sEventName] = new Function(sCode);
		bOut = true;
	}//fi
	return(bOut);
}//arbAttachEventToElement()
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
// retrieves a q.string var. for the current window
//-------------------------------------------------------------------------------------
function getQueryStringVariable(sName){
	var re = new RegExp(sName + "\\=([^\\\&]+)", "i");
	var aResults = re.exec(window.document.location.search);
	return( aResults ? RegExp.$1 : "");
}
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
//				F L A S H    D E T E C T I O N     A N D     H A N D L I N G
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
//				flash cookie handling - setters and getters
//-------------------------------------------------------------------------------------

// function to retrieve a cookie value
// useage var cookieVal = getCookie("nameOfCoookie");
function getCookie(Name) {
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) {
	    offset = document.cookie.indexOf(search)
	    // if cookie exists
	    if (offset != -1) { 
	      offset += search.length
	      // set index of beginning of value
	      end = document.cookie.indexOf(";", offset);
	      // set index of end of cookie value
	      if (end == -1) end = document.cookie.length;
	      returnvalue=unescape(document.cookie.substring(offset, end))
	    }
	}
	return returnvalue;
}

//-------------------------------------------------------------------------------------
//		sets the session cookie to the designated
//-------------------------------------------------------------------------------------
// sets the cookie to the designated value
function setFlashCookie(b){
	document.cookie="acmiFlash=" + b;
	var locn = document.location.href;
	i = locn.indexOf('#');
	if(i > 0){
		locn = locn.substring(0, locn.indexOf('#'));
	}
	document.location = locn;
}

//-------------------------------------------------------------------------------------
//		toggles the display of the flash based on the cookie	
//-------------------------------------------------------------------------------------
function toggleFlashCookie(){
	
	
	var c = getCookie("acmiFlash");	

	if( c == "no"){
		setFlashCookie("yes");
	}else{
		setFlashCookie("no");
	}
	
}

//-------------------------------------------------------------------------------------
//		toggles the display of the flash based on the cookie	
//-------------------------------------------------------------------------------------
function manageFlashCookie(blnIsFlash){
	
	
	var c = getCookie("acmiFlash");
	
	//if flash isn't installed or is old, redirect to plugin page, else, toggle cookie	
	if (!blnIsFlash)
	{
		document.location = "/plugins.htm"		
	}
	else	//toggle the cookie
	{
		if( c == "no"){
			setFlashCookie("yes");
		}else{
			setFlashCookie("no");
		}
	}
}

//-------------------------------------------------------------------------------------
//	used for building the query string for the top navigation flash
//-------------------------------------------------------------------------------------
function addTopNavLink(sUrl, sQ, i){
	(/\<a href\=\"([^\"]*)\"/i).exec(sUrl);
	return( (sQ ? '&' : '') + 'URL' + i + '=' + escape(RegExp.$1) ); 
}
//-------------------------------------------------------------------------------------


//-------------------------------------------------------------------------------------
//	writes a flash 5 object/embed html sequence
//-------------------------------------------------------------------------------------
function writeFlash5(sSource, iWidth, iHeight, sId){
	var sParamName, sExtraParamEmbed = ''; 
	var oExtraParams = new Object();
	if(arguments.length > 4) oExtraParams = arguments[4];
	with(document){
		open();
		write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
		write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
		write('width="' + iWidth + '" height="' + iHeight + '" id="' + sId + '">');
		write('<param name="movie" value="' + sSource + '">');
		write('<param name="quality" value="high">');
		write('<param name="menu" value="false">');
		for(sParamName in oExtraParams){
			write('<param name="' + sParamName + '" value="' + oExtraParams[sParamName] + '">');
			sExtraParamEmbed += sParamName + '="' + oExtraParams[sParamName] + '" ';
		}
		write('<embed src="' + sSource + '" quality="high" menu="false" ' + sExtraParamEmbed);
		write('width="' + iWidth + '" height="' + iHeight + '" name="' + sId + '" ');
		write('align="" type="application/x-shockwave-flash" ');
		write('pluginspace="http://www.macromedia.com/go/getflashplayer">');
		write('</embed>');
		write('</object>');
		close();
	}
}
//-------------------------------------------------------------------------------------
//	writes a flash object/embed html sequence - adds variable base version, WMODE, quality and Align
//-------------------------------------------------------------------------------------
function writeFlash(sSource, iWidth, iHeight, sId, iBaseVersion, sWMODE, sQuality, sAlign){
	var sParamName, sExtraParamEmbed = ''; 
	var oExtraParams = new Object();
	if(arguments.length > 4) oExtraParams = arguments[4];
	with(document){
		open();
		write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
		write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + iBaseVersion + ',0,0,0" ');
		write('width="' + iWidth + '" height="' + iHeight + '" id="' + sId + '">');
		write('<param name="movie" value="' + sSource + '">');
		write('<param name="quality" value="' + sQuality + '">');
		write('<param name="WMODE" value="' + sWMODE + '">');
		write('<param name="align" value="' + sAlign + '">');
		write('<param name="menu" value="false">');
		for(sParamName in oExtraParams){
			write('<param name="' + sParamName + '" value="' + oExtraParams[sParamName] + '">');
			sExtraParamEmbed += sParamName + '="' + oExtraParams[sParamName] + '" ';
		}
		write('<embed src="' + sSource + '" quality="' + sQuality + '" menu="false" ' + sExtraParamEmbed);
		write('width="' + iWidth + '" height="' + iHeight + '" name="' + sId + '" ');
		write('WMODE="' + sWMODE + '" "');
		write('align="' + sAlign + '" type="application/x-shockwave-flash" ');
		write('pluginspace="http://www.macromedia.com/go/getflashplayer">');
		write('</embed>');
		write('</object>');
		close();
	}
}
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
// FLASH DETECTION FUNCTION:
//-------------------------------------------------------------------------------------
//		iCheckForFlashVersion: Flash Version to check for, eg: 4,5,6
//		sDetectionMethod: Agressive or Passive, eg: 'A', 'P', if invalid defaults to passive
//-------------------------------------------------------------------------------------
function isFlash(iCheckForFlashVersion, sDetectionMethod, oBrowser)
{
	bIsFlash = false;
	if (oBrowser.fVersion > 3) {
	
		//////////////////////////////////////////////////////
		// source: juxtinteractive.com
		// description: Flash 3, 4 AND 5 Detection
		// Author: anthony@juxtinteractive.com
		// credits: netscape communications (client sniff)
		// Permission granted to reuse and distribute
		// Last Modified: 10-03-00
		//////////////////////////////////////////////////////
		
		//////////////////////////////////////////
		// Flash Detection
		// Last Modified: 10-03-00
		// NOT checking for enabledPlugin (buggy)
		//////////////////////////////////////////
		var iPluginFlashVersion = 0;
	
		if (navigator.plugins) { //MACie4.5 doesn't support
			if (navigator.plugins["Shockwave Flash"]) {
	
				var iPluginFlashVersion = navigator.plugins["Shockwave Flash"].description.split(" ");
	
				for (var i = 0; i < iPluginFlashVersion.length; ++i) {
	
					if (isNaN(parseInt(iPluginFlashVersion[i])))
						continue;
		
					iPluginFlashVersion = iPluginFlashVersion[i];
					break;
				}
				iPluginFlashVersion = parseInt(iPluginFlashVersion);
			}
		}
			
		if (oBrowser.bIE && oBrowser.bWin32) { // Check IE on windows for flash 3, 4 AND 5 using VB Script
			document.write('<SCRIPT LANGUAGE="VBScript"\>\n');
			document.write('on error resume next\n');
			document.write('bIsFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+iCheckForFlashVersion+'")))\n');
			document.write('<'+'/SCRIPT> \n');
		}
	
	}

	if ( iPluginFlashVersion >= iCheckForFlashVersion )
		bIsFlash = true;

	//Added 04.02.2003 by Tref Gare - Areeba Solutions
	// Allows Acmi users to designate whether they view the html version of the site
	// despite the fact that they have flash installed.
	//if(getCookie("acmiFlash") == "no"){
	//	bIsFlash = false;
	//}

	return bIsFlash;	

}
//-------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------
//				B R O W S E R    D E T E C T I O N
//-------------------------------------------------------------------------------------
function getBrowserName()   {   
	return navigator.appName;     
}
//-------------------------------------------------------------------------------------
function getBrowserVersion()   {   
	return navigator.appVersion;     
}
//-------------------------------------------------------------------------------------
function getBrowserCodeName()   {   
	return navigator.appCodeName;     
}
//-------------------------------------------------------------------------------------
function getBrowserUserAgent()   {   
	return navigator.userAgent;     
}
//-------------------------------------------------------------------------------------
// 	Returns browser object containing the browser name and details.
//--------------------------------------------
//	bNS 	: Browser is Netscape
//	bIE 	: Browser is Internet Explorer
//	bWin	: Windows platform
//  bWin95 	: Windows 95 platform
// 	bWin16 	: Windows 16 bit platform
// 	bWin31	: Windows 3.1 platform
// 	bWin98	: Windows 98 platform
//	bWinnt	: Windows NT platform
//	bWin32	: Windows 32 bit platform
//	bMac	: Mac
//	bIE45Mac: IE 4.5 on Mac
// 	fVersion: Version of Browser
// 	sName	: Full browser name
//---------------------------------------------------------------------------------
function cBrowser()
{
	this.sName = getBrowserName();
	this.fVersion = getBrowserVersion(); 

	var sAgt = getBrowserUserAgent().toLowerCase();
	
	//////////
	// Browser 
	//////////
	this.bNS  = ((sAgt.indexOf('mozilla')!=-1) && (sAgt.indexOf('spoofer')==-1) && (sAgt.indexOf('compatible') == -1) && (sAgt.indexOf('opera')==-1) && (sAgt.indexOf('webtv')==-1));
	this.bIE   = (sAgt.indexOf("msie") != -1);

	////////////
	// Platform
	////////////
	this.bWin   = ((sAgt.indexOf("win")!=-1) || (sAgt.indexOf("16bit")!=-1));
	this.bWin95 = ((sAgt.indexOf("win95")!=-1) || (sAgt.indexOf("windows 95")!=-1));
	this.bWin16 = ((sAgt.indexOf("win16")!=-1) || (sAgt.indexOf("16bit")!=-1) || (sAgt.indexOf("windows 3.1")!=-1) || (sAgt.indexOf("windows 16-bit")!=-1) );
	this.bWin31 = ((sAgt.indexOf("windows 3.1")!=-1) || (sAgt.indexOf("win16")!=-1) || (sAgt.indexOf("windows 16-bit")!=-1));
	this.bWin98 = ((sAgt.indexOf("win98")!=-1) || (sAgt.indexOf("windows 98")!=-1));
	this.bWinnt = ((sAgt.indexOf("winnt")!=-1) || (sAgt.indexOf("windows nt")!=-1));
	this.bWin32 = (this.bWin95 || this.bWinnt || this.bWin98 || ((parseInt(this.fVersion) >= 4) && (navigator.platform == "Win32")) || (sAgt.indexOf("win32")!=-1) || (sAgt.indexOf("32bit")!=-1));
	this.bMac   = (sAgt.indexOf("mac")!=-1);
	/////////////////////////////////////
	// Detect IE 4.5 on the mac
	// Mucho Problemos with this browser
	/////////////////////////////////////
	this.bIE45Mac  = (this.bMac && this.bIE && (sAgt.indexOf("msie 5.0")==-1) && (sAgt.indexOf("msie 5.5")==-1) && (sAgt.indexOf("msie 4.5")!=-1));
	////////////////////////////////////
	// Detect NS6 and 6.1 on a Mac - style sheet problems with forms label tags
	///////////////////////////////////
	var ns6Pos   = sAgt.indexOf('netscape6');
	var nsVer = parseFloat(sAgt.substring(ns6Pos+10));
	this.bNS61Mac = (this.bMac && this.bNS && (nsVer >= 6.0 && nsVer <= 6.1) )
	
	
	// If the browser is Netscape or IE then extract the version
	if (this.sName.toLowerCase() == "netscape") {
		this.fVersion = this.fVersion.substring(0,4);
		if (this.fVersion.toString() == '5.0 ') {
			this.fVersion = '6.0'
		}	
	}
	else if (this.sName.toLowerCase() == "microsoft internet explorer") {
		this.fVersion = this.fVersion.substring(this.fVersion.indexOf("MSIE") + 5, this.fVersion.indexOf("MSIE") + 8);
	}
}
//---------------------------------------------------------------------------------


//-------------------------------------------------------------------------------------
//				P O P - U P S
//-------------------------------------------------------------------------------------

function popup( elem, title, settings){

	// check if any settings have been entered as params
	if(settings != null){
		// set them to be used in the new window
		props = settings;
	}else{
		// use default settings
		props = "width=400,height=400,resizable";
	}
	
	//open up the popup window
    window.open(elem.href, title, props);
    
    // return false to disable the normal action of the href
    return false;
}

//-----------------------------------------------------------
//	BREADCRUMBS
//-----------------------------------------------------------
// --------- displays the breadcrumb ------------------------------

 function writeBreadCrumb() {
          
    if (document.getElementById) {         
        var tmp='';        
        var lhsselect = pageTitle;
        var l4 = bcL4Check();                        	  
        if (thematic!='') {
            var aTmp = thematic.split("|");
            if (aTmp.length==2) { 
			tmp = ' &gt; <a href="' + aTmp[0] + '" class="navContext">' + aTmp[1] + '</a>'; 
			lhsselect = aTmp[1];
		}
        } else if (l4!='') {           
            var aTmp = l4.split("|");
            if (aTmp.length==2) { 
			if (aTmp[1]!=pageTitle) { 
				tmp = ' &gt; <a href="' + aTmp[0] + '" class="navContext">' + aTmp[1] + '</a>'; 
				lhsselect = aTmp[1];
			}
		}
        }

        var bc = '<a href="/" class="navContext">Home</a>';
        if (primarysection!='' && primarysection.toLowerCase()!=pageTitle.toLowerCase()) { bc += ' &gt; <a href="' + primarylink + '" class="navContext">' + primarysection + '</a>' + tmp + ' &gt; ' + pageTitle; } 
        else { bc += ' &gt; ' + pageTitle; }       
        
	  if (document.getElementById("breadcrumb")) { document.getElementById("breadcrumb").innerHTML = bc; }	
		
	
	  // highlight lhs nav
	  var oSN = document.getElementById("sideMenuCell");
	  if (oSN!=null) {
		  var oSNa = oSN.getElementsByTagName("a");
		  for (var i = 0; i < oSNa.length; i++) {			
			var pn;
			if (oSNa[i].innerHTML==lhsselect && oSNa[i].parentNode) { 
				if (oSNa[i].parentNode.parentNode.parentNode.nodeName=="TD") {
					oSNa[i].className = "menuSectionCurr";
				} else {
					oSNa[i].className = "menuSubsectionCurr";	
					//oSNa[i].parentNode.parentNode.parentNode.firstChild.className="menuSectionCurr";	
				}				
			}
		  }
	  }
    }                
 }

 // --------- check if we have a parent theme ------------------------------
 function bcL4Check() { 
    var ret = '';         
    if (document.getElementById && document.getElementsByTagName) {       
        var oL4 = document.getElementById("level4Menu")
        var oSN = document.getElementById("sideMenuCell");                        
        if (oL4!=null && oSN!=null) {
            var oL4a = oL4.getElementsByTagName("a");
            var oSNa = oSN.getElementsByTagName("a"); 
            if (oL4a.length>0) {                                                                
                for (var i = 0; i < oSNa.length; i++) { 
                    if (oL4a[0].getAttribute("href")==oSNa[i].getAttribute("href")) {
                        return oSNa[i].getAttribute("href") + '|' + oSNa[i].innerHTML;
                    }
                }
            }
        }                
    }
    return ret;
 }   

//-->

