//Prototype Creative Standard Preloader function
function pcgcPreloader(prelods){
	//Split the string into an array
	var ar = prelods.split(", ");
	//For each item in the array create a new image on the page so the browser preloads the images
	for(var a = 0; a < ar.length; a++) {
		//Create a new image with the picture as its source
		(new Image()).src == ar[a];
	}
}

//Prototype Creative Standard Rollover Function
function pcgcRollover(img) {
	//Set the id name by using the variable supplied
	var idname = img+'butt';
	//Load the current image into a variable
	var extstart = document.getElementById(idname).src;
	//Split the current image src up into 2 parts & use the extension (the last part)
	var ext = extstart.split(".");
	//Create the image name from the supplied id
	var imgname = 'images/'+img+'-over.'+ext[ext.length-1];
	//set the image with the created id the created image name
	document.getElementById(idname).src = imgname;
}

//Prototype Creative Standard Rollout Function
function pcgcRollout(img) {
	//Set the id name by using the variable supplied
	var idname = img+'butt';
	//Load the current image into a variable
	var extstart = document.getElementById(idname).src;
	//Split the current image src up into 2 parts & use the extension (the second part)
	var ext = extstart.split(".");
	//Create the image name from the supplied id
	var imgname = 'images/'+img+'-butt.'+ext[ext.length-1];
	//set the image with the created id the created image name
	document.getElementById(idname).src = imgname;
}

//The function to confirm the email address is of the correct structure
function validate_email(field,alerttxt){
	with (field){
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
			  {alert(alerttxt);return false}
		else {return true}
	}
}

//The function to confirm that any supplied field has a value
function validate_required(field,alerttxt){
	with (field) {
		if (value==null||value==""){
			alert(alerttxt);
			return false
		}
		else {
			return true
		}
	}
}

//Function to validate the Clients Form
function validate_form(thisform){
	with (thisform){
		if (validate_required(studentname,"The Student name must be filled out")==false){
			companyname.focus();
			return false
		}
		if (validate_email(youremail,"Sorry that email address is incorrect!")==false){
			yourname.focus();
			return false
		}
		if (validate_required(learnermessage,"You must type a message")==false){
			jobtitle.focus();
			return false
		}
	}
}