﻿// JScript File
/* Browser Check */

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
function makeStatic(id, src, txt) {
    document.getElementById(id).innerHTML = '<img src="'+src+'" alt="'+txt+'" />';
}

// Swapping images in the navigation
function swapImage(img, action) {
    if(action != "1") {
        x = img.src.length;
        x = img.src.substr(0,x-4);
        img.src = x + "_h.gif";
    }else{
        x = img.src.length;
        x = img.src.substr(0,x-6);
        img.src = x + ".gif";
    }
        
}

/* Used in 3.0 Series */

    function showTab(tab) {
    
        document.getElementById("tab_short").className = "";
        document.getElementById("tab_premise").className = "";
        document.getElementById("short").style.display = "none";
        document.getElementById("premise").style.display = "none";
        
        document.getElementById("tab_"+tab).className = "on";
        document.getElementById(tab).style.display = "block";
    }

/* Used in 6.0 Alliances/Partnerships */

    function showPartner(partner, p) {
        document.getElementById("partner1").style.display = "none";
        document.getElementById("partner2").style.display = "none";
        document.getElementById("partner3").style.display = "none";
        document.getElementById("partner4").style.display = "none";
        document.getElementById("partner5").style.display = "none";
        document.getElementById("partner6").style.display = "none";
        
        document.getElementById("p1").className = "poff";
        document.getElementById("p2").className = "poff";
        document.getElementById("p3").className = "poff";
        document.getElementById("p4").className = "poff";
        document.getElementById("p5").className = "poff";
        document.getElementById("p6").className = "poff";
        
        document.getElementById(partner).style.display = "block";
        document.getElementById(p).className = "pon";
    }


/* Used for embedding flashtext elements such as page titles */

function embedFlashTitle(src, text, width, height) {
	var hasRightVersion = DetectFlashVer(requiredMajorVersion,0,0);
	if(hasRightVersion) { 
	    document.write('<span>');
		AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width',''+width+'','height',''+height+'','src','/flash/'+src+'','quality', 'high', 'FlashVars', 'titletext='+text+'&wid='+width+'', 'wmode', 'transparent', 'scale','noscale','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','/flash/'+src); //end AC code
	    document.write('</span><span class="hdn">'+text+'</span>');
	}else{
		document.write(text);
	}
}

/* Embed Quicktime */

function embedQuicktime(src, width, height) {
document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="'+height+'" width="'+width+'">');
document.write('<param name="src" value="'+src+'" />');
document.write('<param name="autoplay" value="true" />');
document.write('<param name="controller" value="true" />');
document.write('<embed src="'+src+'" height="'+height+'" width="'+width+'" autoplay="true" type="video/quicktime" controller="true" pluginspage="http://www.apple.com/quicktime/download/">');
document.write('</object>');
}

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	var sfImgs = document.getElementsByTagName("img");
	for (var x=0; x<sfImgs.length; x++) {
	    sfImgs[x].onmouseover=function() {
			this.className+=" imghover";
		}
		sfImgs[x].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" imghover\\b"), "");
		}
	}
	var sfDDs = document.getElementsByTagName("dd");
	for (var x=0; x<sfDDs.length; x++) {
	    sfDDs[x].onmouseover=function() {
			this.className+=" ddhover";
		}
		sfDDs[x].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" ddhover\\b"), "");
		}
	}
}
//if (window.attachEvent) window.attachEvent("onload", sfHover); 

/*
var listx = new Array();
function hideSubNav(pass) {
	var uls = document.getElementsByTagName('ul');
	for(i = 0; i < uls.length; i++) {
		
		if (uls[i].id == ("subnav_" + pass)) {
			if (document.getElementById) // DOM3 = IE5, NS6
				uls[i].style.display = 'none';
			else {
				if (document.layers) {
					document.layers[uls[i]].display = 'none';
					document.layers[uls[i]].position = 'absolute';
				}
				else {
					document.all.hideShow.uls[i].visibility = 'none';
					document.all.hideShow.uls[i].position = 'absolute';
				}
			}
		}
	}
	
	listx[pass] = "hidden";
}

*/

