// Add this code to form tag: onsubmit="return checkForm(this)"

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function checkForm(frm){

		if(myform.realname.value==''){
		alert('Please enter your name.');
		myform.realname.focus();
		return false;
	}	
		if(myform.city.value==''){
		alert('Please enter your city.');
		myform.city.focus();
		return false;
	}
		if(myform.state.value==''){
		alert('Please enter your state.');
		myform.state.focus();
		return false;
	}
		if(myform.postcode.value==''){
		alert('Please enter your postcode.');
		myform.postcode.focus();
		return false;
	}
		if(myform.phone.value==''){
		alert('Please enter your contact phone number.');
		myform.phone.focus();
		return false;
	}
		

  if (myform.email.value == "")
  {
    alert("Please enter a value for the \"email\" field.");
    myform.email.focus();
    return (false);
  }

  if (!isEmailAddr(myform.email.value))
  {
    alert("Please enter a complete email address in the form: yourname@yourdomain.com");
    myform.email.focus();
    return (false);
  }
   
  if (myform.email.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"email\" field.");
    myform.email.focus();
    return (false);
  }
}

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no, status=yes'
win = window.open(mypage,myname,settings)
}		
	
