gIsImagePreloadDone = false; // becomes true after loading of navigation

/*
	dom checker
*/
dom = (document.getElementById)? true : false;
ie4 = (document.all)? true : false;
ns6= (dom && !ie4)? true : false;
ns4 = (document.layers)? true:false;

function toggleDisplay(obj1Name, obj2Name) {
	/*
		function to show and hide the signin and signout ids 
		made for the GCCI login bar
	*/
	
	// get the object
	objSignin = getObject(obj1Name);
	objSignout = getObject(obj2Name);
	
	if (objSignout.style.display == 'none') {
		// show the singout
		objSignout.style.display = 'block';
		objSignin.style.display = 'none';
	} else {
		// show the singin
		objSignout.style.display = 'none';
		objSignin.style.display = 'block';
	}
}

function toggleForm(objName, varStatus) {
	/*
		function to show and hide the form elements 
		made for the review and reserve and join pages
	*/
	
	// get the object
	objSection = getObject(objName);
	
	if (varStatus == 'show') {
		// show the section
		objSection.style.display = 'block';
	} else {
		// hide the section
		objSection.style.display = 'none';
		
	}
}

function makeRand(maxNum) {
	/*
		creates a random number between 1 -> maxNum
	*/
	rnd = Math.round((maxNum * Math.random()));
	rnd = (rnd == 0)? makeRand(maxNum) : rnd;
	return rnd;
}

function changeNavBg(id, bkImage, base) {
	/*
		function to change the background for the navigation. 
		Takes the td id for that navigation item and the name 
		of the background image and replaces them depending
		on the state that they need to change to or out of.
	*/
	
	// get the 3 images to be changed out
	newImagel = "url(" + base + "images/nav/" + bkImage + "-l.gif)";
	newImage = "url(" + base + "images/nav/" + bkImage + ".gif)";
	newImager = "url(" + base + "images/nav/" + bkImage + "-r.gif)";
	
	// get the object
	tdObjl = getObject(id + "l");
	tdObj = getObject(id);
	tdObjr = getObject(id + "r");
	
	// change out the different ids to the new images
	if (tdObj) {
		tdObjl.style.backgroundImage = newImagel;
		tdObj.style.backgroundImage = newImage;
		tdObjr.style.backgroundImage = newImager;
	} else {
		return;
	}
}

function getObject(oID) {
	/*
		function that returns the element based on the browser
		capitalities - ns4 will return null if the obj doesn't exist
	*/
	if (dom) {
		obj = document.getElementById(oID);
	} else if (ie4) {
		obj = document.all(oID);
	} else if (ns4) {
		obj = document.layers(oID);
		if (!obj)
			return null;
	}
	return obj;
}

function preload(imgObj,imgSrc) {
	/*
		function to preload images
	*/
	if (document.images) {
		eval(imgObj+' = new Image()');
		eval(imgObj+'.src = "'+imgSrc+'"');
	}
}

function changeImage(imgName,imgObj,layer) {
	/*
		function to do rollovers of images
	*/
	if (gIsImagePreloadDone == true) {
		if (document.images) {
			if (document.layers) {
				if (layer!=null){
					eval('document.layers.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src');
				} else {
					document.images[imgName].src = eval(imgObj+".src");
				}
			} else {
				document.images[imgName].src = eval(imgObj+".src");
			}
		}
	}
}

function call_jumpMenu(selObj,restore){ //v3.0
  if(selObj.options[selObj.selectedIndex].value != " ")
  {
	  target='parent';
	  eval("parent.location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
  }else{
  return false;
  }
}

