//This is an image preload script
var pix0 = new Array();
var pix1 = new Array();
var pix2 = new Array();

function preloadButtonSet(num,dark,light,clicked) {
	if(document.images){
		pix0[num] = new Image();
	 	pix0[num].src = dark;
		pix1[num] = new Image();
		pix1[num].src = light;
		pix2[num] = new Image();
		pix2[num].src = clicked;
	}
}

//This is the rollover part

function lighten(num) {
 if (document.images)
  eval("document.button"+num+".src = pix1["+num+"].src;");
 return false;
}

function darken(num) {
 if (document.images)
  eval("document.button"+num+".src = pix0["+num+"].src;");
 return false;
}

function clicked(num) {
 if (document.images) {
  eval("document.button"+num+".src = pix2["+num+"].src;");
  setTimeout("document.button"+num+".src = pix2["+num+"].src;",400);

 }
 return true;
}

// Browser-independent method of getting an object
// borrowed from http://www.xs4all.nl/~ppk/js/

function getObj(name){
	if (document.getElementById)
		{
			this.obj = document.getElementById(name);
			this.style = document.getElementById(name).style;
		}
		else if (document.all)
		{
			this.obj = document.all[name];
			this.style = document.all[name].style;
		}
		else if (document.layers)
		{
			this.obj = document.layers[name];
			this.style = document.layers[name];
		}
}

 	
function doPopup(URL,winName,features,obj) {
	if( (navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)==4 ))
	{
		obj.href='Javascript:var j=0';
	}
	else
	{
		obj.setAttribute('href','Javascript:var j=0');
	}
	pwin=window.open(URL,winName,features);
	pwin.moveTo(10,10);
	pwin.focus();
	
}

function BioWindow(strUrl, obj){
  var strParameters = 'toolbar=no, location=no, directories=no, scrollbars=yes, resizable=yes, width=500, height=590';
  doPopup(strUrl, 'Biog', strParameters, obj); 
}

function ComWindow(strUrl, obj){
  var strParameters = 'toolbar=no, location=no, directories=no, scrollbars=yes, resizable=yes, width=500, height=560';
  doPopup(strUrl, 'Biog', strParameters, obj); 
}


function foc(thing){
  thing.style.background="#E0F8FF";
}

function blu(thing){
  thing.style.background="#FFFFFF"
}

//Function to colour form input and textarea fields on focus
function FormColour() {
	if (document.getElementsByTagName) {
		navRoot = document.getElementsByTagName("INPUT");
		for (i=0; i<navRoot.length; i++) {
			node=navRoot[i];
			if (node.type =="text"){
				node.onfocus=function() { this.className="foc"; }
				node.onblur=function()  { this.className="blu"; }
			}
		}
		navRoot = document.getElementsByTagName("TEXTAREA");
		for (i=0; i<navRoot.length; i++) {
			node=navRoot[i];
				node.onfocus=function() { this.className="foc"; }
				node.onblur=function()  { this.className="blu"; }
			}
	}
}

//######################
// Form validation routine
//######################
//*************************
// Check that an input field is not blank
function FValidateControl(control){
  if ( control.value == " " ) {
    control.value = "";
  }
  if (control.value==""){
    alert(control.id+" must be filled in before your form can be sent.");
    control.focus();
    return false;
  }
  return true;
}
//*************************

//*************************
// Check that the email address is of the right form
	function MailValidate(myForm){
		var re = /^\s?\w+([\.\-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/
		if (re.test(myForm.email.value))
		{
			return true
		}
		alert("Invalid form of email address.\n\nIf it appears correct, check for spaces.");
		myForm.email.focus();
		myForm.email.select();
		return false;
}
//*************************

//*************************
// Form validation function
	function FSubmitValidate(form){
		if (!FValidateControl(form.Name)) return false;
		if (!FValidateControl(form.Email)) return false;
		if (!MailValidate(form)) return false;
		return true;
}
//*************************
//###################### 