﻿// JScript File

/* 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.replace(/%c2%bb/, "&raquo;")+'</span>');
	}else{
		document.write('Unable to load flash, please check your version');
	}
}

/* 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>');
}

// Following code transfers PNG's into transparency for IE5+

var bgsleight	= function() {
	
	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {
					oldonload();
				}
				func();
			}
		}
	}
	
	function fnLoadPngs() {
		var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
		var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
		for (var i = document.all.length - 1, obj = null; (obj = document.all[i]); i--) {
			if (itsAllGood && obj.currentStyle.backgroundImage.match(/\.png/i) != null) {
				fnFixPng(obj);
				obj.attachEvent("onpropertychange", fnPropertyChanged);
			}
		}
	}

	function fnPropertyChanged() {
		if (window.event.propertyName == "style.backgroundImage") {
			var el = window.event.srcElement;
			if (!el.currentStyle.backgroundImage.match(/ico_spacer\.gif/i)) {
				var bg	= el.currentStyle.backgroundImage;
				var src = bg.substring(5,bg.length-2);
				el.filters.item(0).src = src;
				el.style.backgroundImage = "url(ico_spacer.gif)";
			}
		}
	}

	function fnFixPng(obj) {
		var bg	= obj.currentStyle.backgroundImage;
		var src = bg.substring(5,bg.length-2);
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
		obj.style.backgroundImage = "url(ico_spacer.gif)";
	}
	
	
	
	
	return {
		
		init: function() {
			
			if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
				addLoadEvent(fnLoadPngs);
				
			}
			addLoadEvent(initInputs);
			
		}
	}
	
}();

bgsleight.init();// JScript File


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"), "");
		}
	}
}
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";
}
function showSubNav(pass) {
	if (listx[pass] == "shown") hidediv(pass);
	else {
		var uls = document.getElementsByTagName('ul');
	
		for(i = 0; i < uls.length; i++) {
			if (uls[i].id == ("subnav_" + pass)) {
				if (document.getElementById) {
					// IE 6+/NN6
					uls[i].style.display = 'block';
				}
				else {
					if (document.layers) {
						//netscape 5
						document.layers[uls[i]].display = 'block';
						document.layers[uls[i]].position = 'relative';
					}
					else {
						// IE 4 and 5 not 5+
						document.all.hideShow.uls[i].visibility = 'block';
						document.all.hideShow.uls[i].position = 'relative';
					}
				}
			}
		}
		listx[pass] = "shown";
	}
}


function efocus(id) {
	document.getElementById(id).focus();
}


/* Invader Popup */

var menuInt;
function openMenu(pass){
	if (listx[pass] == "shown") closeMenu();
	else {
	clearInterval( menuInt );
	menuInt = setInterval( "expandDiv(200)",10 );
	listx[pass] = "shown";
	}
}

function closeMenu(pass){
	clearInterval( menuInt );
	menuInt = setInterval( "collapseDiv(-380)",5 );
	listx[pass] = "hidden";	
}

function expandDiv( x ){
	var div = document.getElementById("invader");
    div.style.left = (div.offsetLeft + 10) + "px";
	if( div.offsetLeft == x ){
	    clearInterval(menuInt);
	}	
}

function collapseDiv( x ){
	var div = document.getElementById("invader");
    div.style.left = (div.offsetLeft - 10) + "px";
	if( div.offsetLeft == x ){
	    clearInterval(menuInt);
	}	
}

var listx = new Array();
function hidediv(pass) {
	var divs = document.getElementsByTagName('div');
	for(i = 0; i < divs.length; i++) {
		if(document.getElementById("img_"+pass+"")) document.getElementById("img_"+pass+"").src = "/images/ico_plus.gif";
		
		if (divs[i].id == ("cont_" + pass)) {
			if (document.getElementById) // DOM3 = IE5, NS6
				divs[i].style.display = 'none';
			else {
				if (document.layers) {
					document.layers[divs[i]].display = 'none';
					document.layers[divs[i]].position = 'absolute';
				}
				else {
					document.all.hideShow.divs[i].visibility = 'none';
					document.all.hideShow.divs[i].position = 'absolute';
				}
			}
		}
	}
	
	listx[pass] = "hidden";
}
function showdiv(pass) {
	if (listx[pass] == "shown") hidediv(pass);
	else {
		var divs = document.getElementsByTagName('div');
		if(document.getElementById("img_"+pass+"")) document.getElementById("img_"+pass+"").src = "/images/ico_minus.gif";
		
		for(i = 0; i < divs.length; i++) {
			if (divs[i].id == ("cont_" + pass)) {
				if (document.getElementById) {
					// IE 6+/NN6
					divs[i].style.display = 'block';
				}
				else {
					if (document.layers) {
						//netscape 5
						document.layers[divs[i]].display = 'block';
						document.layers[divs[i]].position = 'relative';
					}
					else {
						// IE 4 and 5 not 5+
						document.all.hideShow.divs[i].visibility = 'block';
						document.all.hideShow.divs[i].position = 'relative';
					}
				}
			}
		}
		listx[pass] = "shown";
	}
}



/* Invader stuff */
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 showInvader(id1, id2, id3, id4) {
    //new Draggable(id, {handle:'handle'});
    //alert(BrowserDetect.browser);
    if(BrowserDetect.browser != "Safari") {
        new Effect.Opacity(id1, {duration:1.5, from:0, to:1});
        //new Effect.Opacity(id2, {duration:1.5, from:0, to:1});
        new Effect.Opacity(id3, {duration:1.5, from:0, to:1});
        new Effect.Opacity(id4, {duration:1.5, from:0, to:1});
    }else{
        document.getElementById(id1).style.opacity = "100";
        //document.getElementById(id2).style.opacity = "100";
        document.getElementById(id3).style.opacity = "100";
        document.getElementById(id4).style.opacity = "100";
        //document.getElementById("ctl00_Ctrl__invaderpopup1_invader_p2").style.lineHeight = "14px";
    }
    
    //
    //setTimeout("Effect.Fade('ctl00_Ctrl__invaderpopup1_invader', { duration: 1.5})", 5000);
}
