// JavaScript Document
//browser detection made simple!!!
function Browser() {
	var b=navigator.appName;
    var agt=navigator.userAgent.toLowerCase();
	var ua=navigator.userAgent.toLowerCase();
	if (b=="Netscape") this.b="ns";
	else if ((b=="Opera") || (navigator.userAgent.indexOf("Opera")>0)) this.b = "opera";
	else if (b=="Microsoft Internet Explorer") this.b="ie";
	if (!b) alert('Unidentified browser./nThis browser is not supported');
	this.version=navigator.appVersion;
	this.v=parseInt(this.version);
	this.ns=(this.b=="ns" && this.v>=4);
	this.ns4=(this.b=="ns" && this.v==4);
    this.ns6=(this.b=="ns" && this.v==5 && (agt.indexOf("netscape6/6") != -1));
    this.ns6up=(this.b=="ns" && this.v>=5 && (agt.indexOf("netscape") != -1));
    this.ns7=(this.b=="ns" && this.v==5 && (agt.indexOf("netscape/7") != -1));
    this.ns7up=(this.ns6up && !this.ns6);
    this.ie=(this.b=="ie" && this.v>=4);
	this.ie4=(this.version.indexOf('MSIE 4')>0);
	this.ie5=(this.version.indexOf('MSIE 5')>0);
	this.ie55=(this.version.indexOf('MSIE 5.5')>0);
	this.ie6=(this.version.indexOf('MSIE 6')>0);
	this.opera=(this.b=="opera");
    this.aol=(agt.indexOf("aol") != -1);
    this.aol5=(agt.indexOf("aol 5") != -1);
    this.aol6=(agt.indexOf("aol 6") != -1);
    this.gecko = (agt.indexOf('gecko') != -1);
	this.win32=(ua.indexOf("win")>-1);
	this.mac=(ua.indexOf("mac")>-1);
}
is = new Browser();


function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q){
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
	for(var j=0; j < this.keyValuePairs.length; j++) {
		if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
		}
			return false;
	}
	this.getParameters = function() {
	var a = new Array(this.getLength());
	for(var j=0; j < this.keyValuePairs.length; j++) {
		a[j] = this.keyValuePairs[j].split("=")[0];
	}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }
}
function queryString(key){
	var strURL=window.location.search;
	var page = new PageQuery(strURL.toLowerCase());
	return unescape(page.getValue(key)); 
}

function showId(thisId){
	var _l1=document.getElementById(thisId);
	_l1.style.display='block';
	_l1.style.visibility='visible';
}
function hideId(thisId){
	var _l1=document.getElementById(thisId);
	_l1.style.display='none';
	_l1.style.visibility='hidden';
}

function hideGroup(hiddenIds){
	var groupItems=hiddenIds.split(",");
	var groupArray=new Array();
	groupArray=groupItems;
	for(var i=0;i<groupArray.length;i++){
		hideId(groupArray[i]);	
	}
}

function showTab(hiddenIds,visibleId){
	
	hideGroup(hiddenIds);
	showId(visibleId);
	
}
function setTab(thisId,newBgColor,newColor,hiddenIds,visibleId,tabID){
	var _l1=document.getElementById(thisId);
	if (is.ie){
		var currentBgColor=_l1.currentStyle.backgroundColor;
		var currentColor=_l1.currentStyle.color;
		var currentTxtDecor=_l1.currentStyle.textDecoration;
	}
	if (is.ns){
		var compStyle=getComputedStyle(_l1,"");
		var currentBgColor=compStyle.getPropertyValue("background-color");
		var currentColor=compStyle.getPropertyValue("color");
		var currentTxtDecor=compStyle.getPropertyValue("text-decoration");
	}
	_l1.onmouseover=function (){
		this.style.backgroundColor=	newBgColor;
		this.style.color=newColor;
		this.style.textDecoration="none";
	}
	_l1.onmouseout=function(){
		this.style.backgroundColor=currentBgColor;
		this.style.color=currentColor;
		this.style.textDecoration=currentTxtDecor;
	}
	_l1.onclick=function(){
		var thisDomain=document.location.hostname;
		var thisPathName=document.location.pathname;
		if(queryString('loc')!=='false'){
			document.location.href="http://"+thisDomain+thisPathName+"?sp="+tabID+"&loc="+queryString('loc');
		}else{
			document.location.href="http://"+thisDomain+thisPathName+"?sp="+tabID;
		}
	}
}


function openPopUp(strURL){
	var myWindow = window.open(strURL, "Careers", "toolbar=no,width=500,height=600,resizable=yes,scrollbars=yes,menubar=no")
	return myWindow.focus();
}


