
var currentBackground =""; //set when changed;

function addOnload(newFunction) {
	var oldOnload = window.onload;
	
	if (typeof oldOnload == "function") {
		window.onload = function() {
			if (oldOnload) {
				oldOnload();
			}
			newFunction();
		}
	}
	else {
		window.onload = newFunction ();
	} 
}

function changeMainImage(imgPath){
	//alert("path " + imgPath );
	document.getElementById('main').style.background	= "url("+ imgPath + ")";	
	str = imgPath.split('/');
	currentBackground = str[str.length -1];
}

//used to set initial background. Can not use changeMainImage
// because cant pass funtion name
function initBackground(){
	
	
	
}
function clearScreen(){
	
	//new Effect.SwitchOff('navBarBackground');
	//new Effect.SwitchOff('navBar');
	document.getElementById('navBarBackground').style.visibility = "hidden";
	document.getElementById('navBar').style.visibility = "hidden";
	document.getElementById('resetScreenDiv').style.visibility = "visible";
	document.getElementById('resetScreenBackground').style.visibility = "visible";
		
	if(document.getElementById('ThumbNailBar')){
		new Effect.Shrink('ThumbNailBar');
	}
	if(document.getElementById('contentContainer')){
   //new Effect.Shrink('contentContainer');
	document.getElementById('contentContainer').style.visibility = "hidden";
 	}
	
	//need a litte delay for screen to clear. To much movement.
	if(document.getElementById('pageFlipArrows')){
		setTimeout("document.getElementById('pageFlipArrows').style.visibility = 'visible'",1000);
	}
	
}

function resetScreen(){
	
//	new Effect.Appear('navBarBackground');
//new Effect.Appear('navBar');
	document.getElementById('navBarBackground').style.visibility = "visible";
	document.getElementById('navBar').style.visibility = "visible";

	if(document.getElementById('ThumbNailBar')){
	 new Effect.Appear('ThumbNailBar');
	}
	if(document.getElementById('contentContainer')){
		//new Effect.Appear('contentContainer');
		document.getElementById('contentContainer').style.visibility = "visible";
	}
	document.getElementById('resetScreenDiv').style.visibility = "hidden";
	document.getElementById('resetScreenBackground').style.visibility = "hidden";

	if(document.getElementById('pageFlipArrows')){
		document.getElementById('pageFlipArrows').style.visibility = "hidden";
	}
	
	// fix opacity
	
	document.getElementById('navBarBackground').style.filter = "alpha(opacity=80)";
	document.getElementById('navBarBackground').style.opacity = ".80";
	if(document.getElementById('contentContainer')){
		document.getElementById('contentContainer').style.filter = "alpha(opacity=80)";
		document.getElementById('contentContainer').style.opacity = ".80";
	}

	
}

/**************************************************************************
	name:  			showContent
	purpose:		show contnet div and hide thumb nail bar
	paramaters:	0
	returns:		return 
****************************************************************************/

function showContent(){
	document.getElementById('ThumbNailBar').style.display = "none";
	document.getElementById('contentContainer').style.display = "block";
	//hide the clear screen div. it causes problems with the contene box open
	//after the restore screen div has been activated
	document.getElementById('clearSceenDiv').style.visibility = "hidden";
	
}

/**************************************************************************
	name:  			hideContent
	purpose:		hide contnet div and show thumb nail bar
	paramaters:	0
	returns:		return 
****************************************************************************/

function hideContent(){
	document.getElementById('ThumbNailBar').style.display = "block";
	document.getElementById('contentContainer').style.display = "none";
	document.getElementById('clearSceenDiv').style.visibility = "visible";
}