// 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;
}

var theImages = new Array(); 

theImages[0] = 'images/home_pic1.jpg';
theImages[1] = 'images/home_pic2.jpg';
theImages[2] = 'images/home_pic3.jpg';
theImages[3] = 'images/home_pic4.jpg';
theImages[4] = 'images/home_pic5.jpg';
/*
theImages[5] = 'images/pic7.jpg';
theImages[6] = 'images/pic8.jpg';
*/

var j = 0
var p = theImages.length;
var preBuffer = new Array();
for (i = 0; i < p; i++){
   preBuffer[i] = new Image();
   preBuffer[i].src = theImages[i];
}
var whichImage = Math.round(Math.random()*(p-1));
function showImages(){
document.write('<img src="'+theImages[whichImage]+'" alt="" border="0" />');
}

function classSwap(id)
{
	document.getElementById(id).className = "selected";
}
//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;
}

//function to add to favourites
function addFav()
{
	window.external.AddFavorite(location.href, document.title);
}
function fontChange(fnt)
{
	document.getElementById('mainContent').style.fontSize = fnt;
}
function openMap(url)
{
	window.open(url,'','');
}
function openPic(url)
{
	window.open(url,'','scrollbars=no,resizable=no,height=533,width=700');
}
function openWin(url)
{
	window.open(url,'','toolbar=no,scrollbars,resizable,outerWidth=700,outerHeight=533');
}
function openPres(url)
{
	window.open(url,'','toolbar=no,scrollbars,resizable,width=800,height=650');
}
function openNote(url)
{
	window.open(url,'','toolbar=no,scrollbars,resizable,width=550,height=400');
}
/*******************************************************
	functions for highlight navigation
*******************************************************/
function hiliteDis(id)
{
	document.getElementById(id).style.className = "navOvr";
}

