//test the script is compiling!
function testing(){
  alert("hello");
}

//----------------------------------------------------------------------------------------------
//MENU HIGHLIGHTING SYSTEM
//----------------------------------------------------------------------------------------------

//highlight menu item on mouseover
function mhlight(element){
  var s = element.getAttribute("src"); //get the passed menu element
  var path=s.substring(0,s.lastIndexOf("/")+1); //get the path of the image, minus the filename
  element.setAttribute("src",path +element.id +"ON.gif"); //set the image src to the new image for a selected page (path/*ON.gif)
  
  //extras for side buttons/visibility of date texts
  if(element.id == 'social' || element.id == 'lannage' || element.id == 'alien'){
    var overText = document.getElementById(element.id +'OverText');
    overText.style.cssText = 'visibility:visible';
  }
}

//un-highlight menu item on mouseout
function munhlight(element){
  var s = element.getAttribute("src"); //get the passed menu element
  var path=s.substring(0,s.lastIndexOf("/")+1); //get the path of the image, minus the filename
  element.setAttribute("src",path +element.id +"OFF.gif"); //set the image src to the new image for a selected page (path/*OFF.gif)
  
  //extras for side buttons/visibility of date texts
  if(element.id == 'social' || element.id == 'lannage' || element.id == 'alien'){
    var overText = document.getElementById(element.id +'OverText');
    overText.style.cssText = 'visibility:hidden';
  }
}

function getparam(name){
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

//highlights menu item for current page. Called from main iframe
function mlightgot(){
  var url = window.location.href;
  var page = getparam('page');
  var element = document.getElementById(page);
  var s=element.getAttribute("src");
  path=s.substring(0,s.lastIndexOf("/")+1); //get the path of the linked image, minus the filename
  element.setAttribute("onmouseout","");
  element.setAttribute("onmouseover",""); //reset the over and out mouse events
  element.setAttribute("src",path +element.id +"GOT.gif"); //set the image src to the new image for a selected page (path/*GOT.gif)
}

//----------------------------------------------------------------------------------------------
//MENU POPULATION SYSTEM
//----------------------------------------------------------------------------------------------

//nullified; now handled by smarty templates

//----------------------------------------------------------------------------------------------
//COOKIE FUNCTIONALITY TO SHOW/HIDE THE INTRO template APPROPRIATELY
//----------------------------------------------------------------------------------------------

//cookie functions from quirksmode.org----------------------------------------------------------
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
//----------------------------------------------------------------------------------------------