// this is for fixing the x and y of the navigation divs.
function fixDivs() {
	mod = document.getElementById('mainTable').offsetLeft + 116; 
	document.getElementById('topNavFolder1').style.left = mod + "px";
}
function fixContainer() {
	// fix the container if there are pics..
	mod = document.getElementById('mainTable').offsetLeft + 558 + 85; 
	document.getElementById('container').style.left = mod + "px";
}
function fixDivs2() {
	x = document.getElementById('mainTable').offsetLeft  + 116 + 148 + 1 + "px"; 
	//y = document.getElementById('topNavFolder2Row').offsetTop + "px"; 
	y = '158px';
	document.getElementById('topNavFolder2').style.top = y;
	document.getElementById('topNavFolder2').style.left = x;
}

// this is for the navigation flash button to drop the divs.
function rollOn() {
	if (timer) window.clearTimeout(timer);
	document.getElementById('topNavFolder1').style.display='';
	clearTimer();
}
function rollOff() {
	useTimer();
}

// this is for the READMORE button at homepage
function handleDivContent() {
	document.getElementById('butReadmore').style.display='none';
	document.getElementById('divContent').style.clip='rect(0px 380px 180px 0px)';
	document.getElementById('divContent').style.height='180px';
	document.getElementById('divContent').style.width='380px';
	document.getElementById('divContent').style.overflow='auto';
	for(x=1;x<140;x++) {
		document.getElementById('divContent').scrollTop = parseInt(x);
	}
}
function show(source) {
//	document.getElementById('container').innerHTML = "<img id=containerPic name=containerPic src=images/gallery/" + source + " width=278 height=192><br><center><div onclick=document.getElementById('container').style.display='none'; style='cursor:hand;color:white' onmouseover=this.style.backgroundColor='#222222';this.style.color='#FFEC05'; onmouseout=this.style.backgroundColor='black';this.style.color='white';>Hide Picture</div></center>";
	document.getElementById('container').innerHTML = "<img id=containerPic name=containerPic src=images/gallery/" + source + " width=279 height=192>";
	document.getElementById('container').filters[0].apply();
	document.getElementById('container').style.display='';	
	document.getElementById('container').filters[0].play();
	document.getElementById('container').style.display='';
}
function hide () {
	document.getElementById('container').filters[0].play();
	document.getElementById('container').style.display='none';
	if (timer) clearTimeout(timer);
}
function showlock() {
	document.getElementById('container').style.display='';
}

function fixTopNavFolder(id, m) { 
	offset = document.getElementById('tblTopNavID'+id).offsetLeft;
	//document.getElementById('topNavFolder'+id).style.left = 200 + (m * 120);
	document.getElementById('topNavFolder'+id).style.left = offset + 200 + (m * 134);
	//document.getElementById('topNavFolder'+id).style.left = 134 * (id - 1) + 200;
	//document.all['topNavFolder'+id].style.left = document.getElementById('tblTopNavID'+id).offsetLeft;
	//Return True;
}
function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);

function fold(fid) {
	for (i=0; i<100; i++) { 
		if (document.getElementById('tblTreeMiddle'+i)) { 
			if (i!=fid) document.getElementById('tblTreeMiddle'+i).style.display='none';
			document.getElementById('firstTreeArrow'+i).src = 'images/treeRightArrow.gif';
		}
	}
	with(document.getElementById('tblTreeMiddle'+fid)) { style.display=='none' ? style.display='' : style.display='none' };
	if (document.getElementById('tblTreeMiddle'+fid).style.display!='none') document.getElementById('firstTreeArrow'+fid).src = 'images/treeDownArrow.gif';
	//If (document.getElementById('tblTreeMiddle'+fid).style.display=='none') 
	//{ document.getElementById('firstTreeArrow'+fid).src = 'images/treeRightArrow.gif'; }
	//Else { document.getElementById('firstTreeArrow'+fid).src = 'images/treeDownArrow.gif'; }
}

function fold2(sid) {
	document.getElementById('tblTreeLast'+sid).style.display='';
}

var timer;
var timerSubs;
function clearTimer() { 
	if (timer) window.clearTimeout(timer);
}
function clearTimerSubs() { 
	if (timerSubs) window.clearTimeout(timer);
}
function useTimer() {
	if (timer) window.clearTimeout(timer);
	timer = setTimeout("hideMenus()",1000);
}
function useTimerSubs() {
	timerSubs = setTimeout("hideMenusSubs()",1000);
}
function hideMenus() {
	window.clearTimeout(timer);
	for (id=1;id<10;id++) {
		if (document.getElementById('topNavFolder'+id)) { document.getElementById('topNavFolder'+id).style.display = 'none'; }
	}
	window.clearTimeout(timer);
}
function hideMenusSubs() {
	for (id=2;id<10;id++) {
		if (document.getElementById('topNavFolder'+id)) { document.getElementById('topNavFolder'+id).style.display = 'none'; }
	}
}
function bodyClear() {
	body.onMouseMove = HideMenus();
}
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		bgTovNav = newImage("images/buttonReadmoreOver.gif");
		bgTovNavOver = newImage("images/buttonTopOver.gif");
		preloadFlag = true;
	}
}
function OpenDescription(imgNode, trNode)
{


	if (trNode.style.display == 'none')
	{
		imgNode.src = 'images/minus.png';
		trNode.style.display = 'inline';
	}
	else
	{
		imgNode.src = 'images/plus.png';
		trNode.style.display = 'none';
	}

}
function updateCounter(x) {
	document.getElementById("countDiv").innerHTML = x;
}

function varifyContact() {
	flag = true
	if (document.contactForm.subject.value=='')  {
		document.contactForm.subject.style.backgroundColor='red';
		document.contactForm.subject.style.color='white';
		flag = false;
	}
	else {
		document.contactForm.subject.style.backgroundColor='';
		document.contactForm.subject.style.color='';
		flag = true;
	}
	if (document.contactForm.Name.value=='')  {
		document.contactForm.Name.style.backgroundColor='red';
		document.contactForm.Name.style.color='white';
		flag = false;
	}
	else {
		document.contactForm.Name.style.backgroundColor='';
		document.contactForm.Name.style.color='';
		flag = true;
	}
	if (document.contactForm.lastName.value=='')  {
		document.contactForm.lastName.style.backgroundColor='red';
		document.contactForm.lastName.style.color='white';
		flag = false;
	}
	else {
		document.contactForm.lastName.style.backgroundColor='';
		document.contactForm.lastName.style.color='';
		flag = true;
	}
	if (document.contactForm.Message.value=='')  {
		document.contactForm.Message.style.backgroundColor='red';
		document.contactForm.Message.style.color='white';
		flag = false;
	}
	else {
		document.contactForm.Message.style.backgroundColor='';
		document.contactForm.Message.style.color='';
		if(flag) flag = true;
	}
	if (document.contactForm.email.value=='')  {
		document.contactForm.email.style.backgroundColor='red';
		document.contactForm.email.style.color='white';
		flag = false;
	}
	else {
		document.contactForm.email.style.backgroundColor='';
		document.contactForm.email.style.color='';
		if(flag) flag = true;
	}

	if (flag==true) { document.contactForm.submit(); }
}
