function $(str){
	return(document.getElementById(str));
}
function setCatBlockViz(obj){
	if(document[obj] == undefined || document[obj] == null) document[obj] = false;
	document[obj] = !document[obj];
	var thisVz = (document[obj]) ? "block" : "none";
	$(obj).style.display = thisVz;
}
function togglePresentObj(){
	if(document.presentObj == undefined || document.presentObj == null) document.presentObj = false;
	document.presentObj = !document.presentObj;
	var thisH = (document.presentObj) ? "538px" : "19.69em";
	$('presentObj').style.height = thisH;
}
function writeFlashObj(title, width, height){
	var spath = "http://gerport.com/wp-content/uploads/";
	return ('<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" title="'+title+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" height="'+height+'" width="'+width+'"><param name="movie" value="'+spath+title+'.swf"> <param name="quality" value="high"> <param name="base" value="."> <embed title="'+title+'" src="'+spath+title+'.swf" base="." quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="'+height+'" width="'+width+'"></object>');
}
document.presentObjArray = new Array(['present.jpg', 'Himeji Castle Roof Detail <a href="http://www.flickr.com/photos/stendec/117449771/">Flickr</a>', 'specialColor'],
									  ['connected_banner.swf', 'The Connected Test - <a href="http://gerport.com/connected.htm">Check your popularity here</a>', 'specialColor2'],
									  ['forestFloor.jpg', 'Forest Floor <a href="http://www.flickr.com/photos/stendec/32618724/">Flickr</a>', 'specialColor3'],
									  ['coverflow.swf', 'Celeb Kids Quiz - <a href="http://gerport.com/celebQuiz/">Click here to play</a>', 'specialColor']);

function setPresentObj(iN){
	document.presentObjID = iN;
	setCSS(document.presentObjArray[iN][2]);
	var po = $("presentObj");
	if(po == null || po == undefined) return;
	thisObj = document.presentObjArray[iN][0];
	if(thisObj.lastIndexOf(".swf") == -1){
		po.innerHTML = "";
		po.style.backgroundImage= "url(http://gerport.com/wp-content/themes/GERPORT/images/"+ thisObj +")";
		po.style.height = "19.69em";
	} else {
		ftitle = thisObj.substring(0, thisObj.lastIndexOf(".swf"));
		po.innerHTML = writeFlashObj(ftitle, 820, 400);
		po.style.height = "400px";
	}
	$('presentNavDesc').innerHTML = document.presentObjArray[iN][1];
}
function presentNav(st){
	var thisObj; 
	if(document.presentObjID == null || document.presentObjID == undefined) document.presentObjID = 0;
	
	(st) ? document.presentObjID++ : document.presentObjID--;
	if(document.presentObjID>=document.presentObjArray.length){
		document.presentObjID = 0;
	} else if (document.presentObjID<0){
		document.presentObjID = document.presentObjArray.length-1;
	}
	setPresentObj(document.presentObjID);
}
function setCSS(fileName){
	var headID = document.getElementsByTagName("head")[0];         
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = 'http://gerport.com/wp-content/themes/GERPORT/'+fileName+'.css';
	cssNode.media = 'screen';
	headID.appendChild(cssNode);
}
