//Primary tab nav


function switchPrimeTabs() {
	var t1 = document.getElementById('tab1');
	var t2 = document.getElementById('tab2');
	var t3 = document.getElementById('tab3');
	var t4 = document.getElementById('tab4');
	var t5 = document.getElementById('tab5');	
	var tab1Info = document.getElementById('tab1Info');
	var tab2Info = document.getElementById('tab2Info');
	var tab3Info = document.getElementById('tab3Info');
	var tab4Info = document.getElementById('tab4Info');
	var tab5Info = document.getElementById('tab5Info');

	
	function getCurrentSub(tabId){
		var curDiv;		
		var divs = document.getElementsByTagName('div');
		for (i = 0; i<divs.length; i++){
			if(divs[i].className.indexOf('currentSub') !=-1){				
				divs[i].className = 'hide';																					
			}
			if (divs[i].id == (tabId+'Info') ){
				divs[i].className = 'currentSub';
			}
		}
	}
			
	t1.onclick = function(){
		if (this.className != 'tab1_on'){
			this.className = 'tab1_on';
			t2.className = 'tab2b_off';
			t3.className = 'tab3_off';
			t4.className = 'tab4_off';
			t5.className = 'tab5_off';
			getCurrentSub(this.id);
			SetCookie("currentTab","0");
		}
	}
	t2.onclick = function(){
		if (this.className != 'tab2_on'){
			this.className = 'tab2_on';
			t1.className = 'tab1b_off';
			t3.className = 'tab3b_off';
			t4.className = 'tab4_off';
			t5.className = 'tab5_off';
			getCurrentSub(this.id);
			SetCookie("currentTab","1");
		}
	}
	t3.onclick = function(){
		if (this.className != 'tab3_on'){
			this.className = 'tab3_on';
			t1.className = 'tab1_off';
			t2.className = 'tab2c_off';
			t4.className = 'tab4b_off';
			t5.className = 'tab5_off';
			getCurrentSub(this.id);
			SetCookie("currentTab","2");
		}
	}
	t4.onclick = function(){
		if (this.className != 'tab4_on'){
			this.className = 'tab4_on';
			t1.className = 'tab1_off';
			t2.className = 'tab2_off';
			t3.className = 'tab3c_off';
			t5.className = 'tab5b_off';
			getCurrentSub(this.id);
			SetCookie("currentTab","3");
		}
	}
	t5.onclick = function(){
		if (this.className != 'tab5_on'){
			this.className = 'tab5_on';
			t1.className = 'tab1_off';
			t2.className = 'tab2_off';
			t3.className = 'tab3_off';
			t4.className = 'tab4c_off';
			getCurrentSub(this.id);
			SetCookie("currentTab","4");
		}
	}
}


function hasIndexOf(theString, theIndex) {
	if(theString.indexOf(theIndex) == -1) {
		return false;
	}
	return true;
}

var _QUERYSTRING;

function getCurrentProject() {
	retVal = GetCookie( "currentProject ");
	retVal = ( retVal ) ? retVal : 0;
	return retVal;
}

function getCurrentTab() {
	retVal = GetCookie( "currentTab" );
	retVal = ( retVal ) ? retVal : 0;
	return retVal;
}

function getQSValue(getThisVar) {
	if( _QUERYSTRING ) {
		return( _QUERYSTRING[ getThisVar ] );
	} else {
		var toReturn = "";
		//kick out if theres no Query String
		if(!hasIndexOf(document.URL, "?")) {return false;}
		var QS = document.URL.substring(document.URL.indexOf("?") + 1);
		var variables = QS.split("&");
		for(var i = 0; i < variables.length; i++) {
			if(hasIndexOf(variables[i], getThisVar)) {
				//if we find it the return its value
				toReturn = variables[i].split("=")[1];
				return toReturn;
			}
		}
		//if all else fails return false
		return false;
	}
}

/*function tabPreloader() {		
	var tabPath="../en/wce/GIF/"	
	tabs = new Array();
	tabs[0]="tab1_on.gif";
	tabs[1]="tab1_off.gif";
	tabs[2]="tab1b_off.gif";
	tabs[3]="tab2_on.gif";
	tabs[4]="tab2_off.gif";
	tabs[5]="tab2b_off.gif";
	tabs[6]="tab2c_off.gif";
	tabs[7]="tab3_on.gif";
	tabs[8]="tab3_off.gif";
	tabs[9]="tab3b_off.gif";
	tabs[10]="tab3c_off.gif";
	tabs[11]="tab4_on.gif";
	tabs[12]="tab4_off.gif";
	tabs[13]="tab4b_off.gif";
	tabs[14]="tab4c_off.gif";
	tabs[15]="tab5_on.gif";
	tabs[16]="tab5_off.gif";
	tabs[17]="tab5b_off.gif";
	// start preloading
	
	var imageObj = [];		
	for(var i=0; i<=tabs.length; i++) 
	{
		imageObj[i] = new Image();
		imageObj[i].src=tabPath+tabs[i];
		alert(imageObj[i].src);
	}
} */

	