// JavaScript Document
var timeStart = new Boolean(false);
var timeOutID;
var timeConstant = 2000;


function switchDiv(id,classID)
{
	document.getElementById(id).className = classID;
	document.getElementById(id).style.cursor = "pointer";
}

function showNav(id) //,classID
{
	if (timeStart == true)
	{
		clearInterval(timeOutID);
		timeStart = false;
	}
	document.getElementById(id).style.display = "block";
//	document.getElementById(id).className = classID;
	document.getElementById(id).style.cursor = "pointer";
	
	timeOutID = setInterval('clearMenu()',timeConstant);
	timeStart = true;
}

function hideNav(id) //,classID
{
	stopTimer();
	document.getElementById(id).style.display = "none";
//	document.getElementById(id).className = classID;
}

function clearMenu()
{
	clearInterval(timeOutID);
	timeStart = false;
}

function stopTimer()
{
	clearInterval(timeOutID);
	timeStart = false;
}

function startTimer()
{
	if (timeStart == true)
	{
		clearInterval(timeOutID);
		timeStart = false;
	}	
	timeOutID = setInterval('clearMenu()',timeConstant);
	timeStart = true;
}

//function to print page
function printPage()
{
	window.print();
}

//function to email page
function mailPage()
{
  mail_str = "mailto:?subject= " + document.title;
  mail_str += "&body= I recommend you read this -- " + document.title;
  mail_str += ". You should check this out at, " + location.href; 
  location.href = mail_str;
}

//functio to add to favourites
function addFav()
{
	window.external.AddFavorite(location.href, document.title);
}
function fontChange(fnt)
{
	document.getElementById('maincontent').style.fontSize = fnt;
}
function imgOpen(url)
{
	window.open(url,'','scrollbars=yes,resizable=yes,toolbars=no,menu=no,outerWidth=800,outerHeight=600');
}

function openNote(url)
{
	window.open(url,'','scrollbars=yes,resizable=yes,toolbars=no,menu=no');
}
function openWin(url)
{
	window.open(url,'','scrollbars=yes,resizable=yes,toolbars=no,menu=no');
}

// Left Navigation functions
function showDis(id)
{
	document.getElementById('dis').style.display = "block";
	document.getElementById('hidenav').style.display = "none";
}
function hideDis(id)
{
	document.getElementById('dis').style.display = "none";
	document.getElementById('hidenav').style.display = "block";
}
