// JavaScript Document

function showDivSection(divName) {
  document.getElementById(divName).style.visibility = 'visible';
  document.getElementById(divName).style.display = 'block';
}
function hideDivSection(divName) {
  document.getElementById(divName).style.visibility = 'hidden';
  document.getElementById(divName).style.display = 'none';
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}



// Cookie functions that can be used across the site

function getCookie(NameOfCookie){
  if (document.cookie.length > 0){
    var begin = document.cookie.indexOf(NameOfCookie+"=");
    if (begin != -1){
      begin += NameOfCookie.length+1;
      var end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
      return unescape(document.cookie.substring(begin, end)); }
  }
  return null;
}


function setCookie(NameOfCookie, value, expiredays){
  var ExpireDate = new Date ();
  ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  document.cookie = NameOfCookie + "=" + escape(value) +((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()) + "path=/;";

}


function delCookie (NameOfCookie){
  if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +"; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// Cookie functions end




function highlightTab(theObject){
	tabName = theObject.id;
	document.getElementById(tabName).src = "/images/"+tabName+"_on.jpg";
}
function delightTab(theObject){
	tabName = theObject.id;
	if (tabName != activeTab){
	document.getElementById(tabName).src = "/images/"+tabName+"_off.jpg";
	}
}


function navigate(theObject){
	if(theObject.id == "home"){
		window.location = "/index.php";
	}else{
		tabName = theObject.id;
		window.location = "/index.php/site/"+tabName; // /site/about/
	}
}

function setTab(){
	
	document.getElementById(activeTab).src = "/images/"+activeTab+"_on.jpg";
	
}



