var rightPanelState = 1;//1 = open, -1 = closed;

function logoOver(){
		document.getElementById('hovering').style.visibility = 'visible';
		document.getElementById('thebody').className = 'bodyhover';
}
function logoOut(){
		document.getElementById('hovering').style.visibility = 'hidden';
		document.getElementById('thebody').className = 'bodyout';
}
function toggleRightPanel(){
		if(rightPanelState == 1){
			document.getElementById('rightcol').className = 'rightClosed';
			document.getElementById('rightEntryList').style.visibility = 'hidden';
			document.getElementById('rightEntryList').style.width = '400px';
			document.getElementById('primary').className = 'primaryFull';
		} else {
			document.getElementById('rightcol').className = 'rightOpen';			
			document.getElementById('rightEntryList').style.visibility = 'visible';
			document.getElementById('rightEntryList').style.width = '';
			document.getElementById('primary').className = 'primaryShared';
		}
		rightPanelState *= -1;
		//setCookie();
}

function setCookie() {
	var exp=new Date();
	var plusMonth=exp.getTime()+(31*24*60*60*1000);
	exp.setTime(plusMonth);
	document.cookie='state='+rightPanelState+';expires='+exp.toGMTString();
}

var pageState = '';

function hoverOff(obj){
	if(pageState != obj){
		document.getElementById('menu_' + obj).src="/images/" + obj + "_off.png";
	}
}

function hoverOn(obj){
	document.getElementById('menu_' + obj).src="/images/" + obj + "_on.png";
}

function setMenu(obj){
	pageState = obj;
	var imageA = document.getElementsByTagName("img");
	for(i=0; i<imageA.length; i++){
		if(imageA[i].id.indexOf("menu_") > -1){
			hoverOff(imageA[i].id.substring(5));//chop the menu_ prefix
		}
	}
	hoverOn(obj);
}

var pre = new Array();
function preallocateTile(){
	cacheImage('/images/gold_tile.png');
	cacheImage('/images/java_on.png');
	cacheImage('/images/j2ee_on.png');
	cacheImage('/images/html5_on.png');
	cacheImage('/images/software_on.png');
	cacheImage('/images/hardware_on.png');
}

function cacheImage(imageLocation){
	pre[pre.length] = new Image();
	pre.src = imageLocation;
}

function loadEvents(){
	prettyPrint();
	preallocateTile();
}

window.onload = loadEvents;

