function isEmail(str) {
  	// are regular expressions supported?
  	var supported = 0;
  	if (window.RegExp) {
    	var tempStr = "a";
    	var tempReg = new RegExp(tempStr);
    	if (tempReg.test(tempStr)) supported = 1;
  	}
  	if (!supported) 
    	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  	return (!r1.test(str) && r2.test(str));
}

function verifyCommentForm(form) {

	if (document.commentForm.name.value == "") {
		alert("Please enter your name.");
		document.commentForm.name.focus();
		return false;
	}
	
	if (document.commentForm.email.value == "") {
	
		alert("Please enter your eMail address.");
		document.commentForm.email.focus();
		return false;
		
	} else {
	
		var validMail = isEmail(document.commentForm.email.value);
		
		if (!validMail) {
		
			alert("Please enter a VALID eMail address.");
			document.commentForm.email.focus();
			return false;
			
		}
		
	}
	
	if (document.commentForm.comments.value == "") {
		alert("Please enter your mail message.");
		document.commentForm.comments.focus();
		return false;
	}
	
}

function verifyManualsForm(form) {

	if (document.manualsForm.realname.value == "") {
		alert("Please enter your name.");
		document.manualsForm.realname.focus();
		return false;
	}
	
	if (document.manualsForm.email.value == "") {
	
		alert("Please enter your eMail address.");
		document.manualsForm.email.focus();
		return false;
		
	} else {
	
		var validMail = isEmail(document.manualsForm.email.value);
		
		if (!validMail) {
		
			alert("Please enter a VALID eMail address.");
			document.manualsForm.email.focus();
			return false;
			
		}
		
	}
	
	if (document.manualsForm.subject.value == "") {
		alert("Please enter the engine manufacturer.");
		document.manualsForm.subject.focus();
		return false;
	}
	
}

function verifyVolvoForm(form) {

	if (document.volvoForm.realname.value == "") {
		alert("Please enter your name.");
		document.volvoForm.realname.focus();
		return false;
	}
	
	if (document.volvoForm.email.value == "") {
	
		alert("Please enter your eMail address.");
		document.volvoForm.email.focus();
		return false;
		
	} else {
	
		var validMail = isEmail(document.volvoForm.email.value);
		
		if (!validMail) {
		
			alert("Please enter a VALID eMail address.");
			document.volvoForm.email.focus();
			return false;
			
		}
		
	}
	
}

function Open_Window(url, name) { 
	window.open(url, name, "resizable=yes,height=540,width=480,scrollbars=yes,toolbar=no,status=yes,menubar=no"); 
}

function createPopUp(url, name, optionString) {
	if (!name){
		name = "newwnd";
	}
	if (!optionString){
		// optionString = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,height=500,width=730,screenX=4,screenY=4,top=4,left=4";
		optionString = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,height=150,width=730,screenX=4,screenY=4,top=4,left=4";
	}		
	win = window.open(url, name, optionString);
	win.focus();
}

function clearForm(thisfield, defaulttext) {

	if (thisfield.value == defaulttext) { 
		thisfield.value = "";
	}

}

function aFunction()
	{
		// code here...
	}
