 // JavaScript Document written by Gillian Don, 2004
// all functions starting with MM_ are copyright of Macromedia Inc.

//reloads the window if Nav4 resized
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

//Preloads document Images for speed
function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}		
}

//Hides drop down menu
function hideMenu(hideMenuID) {
	if (document.getElementById) {
		document.getElementById(hideMenuID).style.visibility = "hidden";
	} else if (document.layers) {
		document[hideMenuID].visibility = "hidden";
	}
}

//Shows drop down menu
function showMenu(menuID, topOffset, leftOffset) {
	if (menuShowing != null) {
		hideMenu(menuShowing);
		clearTimeout(id);
	}
	if (document.getElementById) {
		document.getElementById(menuID).style.top = topOffset+"px";
		document.getElementById(menuID).style.left = leftOffset+"px";
		document.getElementById(menuID).style.visibility = "visible";
	} else if (document.layers) {
		document[menuID].top = topOffset;
		document[menuID].left = leftOffset;
		document[menuID].visibility = "visible";
	}
	menuShowing = menuID;
	id = setTimeout("hideMenu(menuShowing);", 2000);
}

//link roll-over animation
function turnOn(currentLink) {
	currentLink.style.color = "#ffcc66";
}

function turnOff (currentLink) {
	currentLink.style.color = "#ffffff";
}

function turnOn2(currentLink) {
	currentLink.style.color = "#666666";
}

function turnOff2(currentLink) {
	currentLink.style.color = "#000000";
}

function turnOn3(currentLink) {
	currentLink.style.color = "#666666";
}

function turnOff3(currentLink) {
	currentLink.style.color = "#005086";
}


function changeImage(tagName, fileName){
	document.images[tagName].src = fileName;
}

function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(Duration=6, Transition=11)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', 10000);
}

function moveImg() {
//Scrolling an image across the screen
	if (document.getElementById) {
		document.getElementById('movingImages').style.left=position+"px";
	}
	else if (document.all) {
		document.all.movingImages.style.left=position+"px";
	}
	else if (document.layers) {
		document.movingImages.left=position;
	}
	
	position = position - 1;
	if(position > 91) {
		setTimeout("moveImg()", 3);
	}
	//To scroll round and round continuously
	//else {
	//	position = 750;
	//	setTimeout("moveImg()", 3);
	//}
}

function validateField(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false;}
else {return true}
}
}

function validateEmail(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}

function validateGuestFeedbackForm(thisform){
	with (thisform){
if (validateField(firstname,"Your first name must be filled out!")==false)
  {firstname.focus();return false;}
else if (validateField(lastname,"Your last name must be filled out!")==false)
  {lastname.focus();return false;}
else if (validateField(studentname,"The student's name must be filled out!")==false)
  {studentname.focus();return false;}
else if (validateEmail(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}
else if (validateField(phone,"Your phone number must be filled out!")==false)
  {phone.focus();return false;}

	}
	
}