// Function to change the image source on Mouse Over.
function mover(imgObj,imgSrc){
	// Get the source of the image from the arguments. Pre-loader not defined.
	if(imgSrc){
		imgObj.src = imgSrc;
	}
	else // Get the source of the image from the pre-loader.
		imgObj.src = eval(imgObj.name+"_over.src");
}

// Function to change the image source on Mouse Out.
function mout(imgObj,imgSrc){
	// Get the source of the image from the arguments. Pre-loader not defined.
	if(imgSrc){
		imgObj.src = imgSrc;
	}
	else // Get the source of the image from the pre-loader.
		imgObj.src = eval(imgObj.name+"_out.src");
}

function openWindow(url){
	var w = 890;
	var h = 600;
	var winl = (screen.width-w)/2; 
	var wint = (screen.height-h)/2; 
	if (winl < 0) winl = 0; 
	if (wint < 0) wint = 0; 
	var settings = 'height=' + h + ','; 
	settings += 'width=' + w + ','; 
	settings += 'top=' + wint + ','; 
	settings += 'left=' + winl + ','; 
	settings += 'resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no'; 
	win = window.open(url,'pricewindow',settings); win.window.focus(); 
	//window.open(url,'pricewindow','width=788,height=600,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no')
}

function swapImg(obj, imgsrc){
	obj.src = imgsrc;
}

function focusBlur(obj, value){
	if(obj.value == "please specify" || obj.value == "")
		obj.value = value;
}


var mandatoryFields = new Array('name','telephone','email');
len = mandatoryFields.length;

function validateForm(formobj){

	for (i = 0 ; i < len ; i++) {
		if (formobj.elements[mandatoryFields[i]].value == ""){
			window.alert("Please make sure you entered " + mandatoryFields[i]);
			formobj.elements[mandatoryFields[i]].focus();
			return false;
		}
	}

	var telephoneNo = formobj.telephone.value;
	var stripped = telephoneNo.replace(/[\(\)\.\-\ ]/g, ''); 	//strip out acceptable non-numeric characters
	if (isNaN(stripped)) {
		alert("The phone number contains illegal characters.");
		formobj.telephone.select( );
		formobj.telephone.focus( );
		return false;
	}
	if (!(stripped.length == 10)) {
		alert("The phone number is the wrong length. Make sure you included an area code.");
		formobj.telephone.select( );
		formobj.telephone.focus( );
		return false;
	}

	if ( (formobj.email.value.indexOf("@") == -1) || (formobj.email.value.indexOf(".") == -1) || (formobj.email.value.indexOf("@") > formobj.email.value.lastIndexOf(".")) ){
		alert("Please enter a valid email address.");
		formobj.email.select( );
		formobj.email.focus( );
		return false;
	}

	return true;
}