// JavaScript Document

function openWindow(url,winname,x,y) {
	subWindow=open(url, winname, "resizable=yes, status=no, toolbar=no, scrollbars=yes, width="+x+", height="+y+"");
	if(subWindow.opener==null) subWindow.opener=self;
}

function emptyfield(check,err_msg){
   if ((check.value == "") || (check.value.charAt(0) == " ")){
      alert(err_msg + "\n\n(No leading empty space)");
	  check.focus();
	  return false;
   }
}

function checkEmail(check){
   email = new String(check.value);
   errmsg="Invalid Email Address";
     if (email.indexOf("@") == -1){
	    alert(errmsg);
		check.focus();
		return false;
	 }
	 else
	 {
	   idx1=email.indexOf("@");
	 }
	 if(email.indexOf(".") == -1){
	    alert(errmsg);
		check.focus();
		return false;
	 }
	 else{
	    idx2=email.indexOf(".");
	 }
	 str1=email.substring(0,idx1);
	 if(str1.length < 2){
	    alert(errmsg);
		check.focus();
		return false;
	 }
	 str2=email.substring(idx1,idx2);
	 if(str2.length < 2){
	    alert(errmsg);
		check.focus();
		return false;
	 }
	 str3=email.substring(idx2,email.length-1);
	 if(str3.length < 2){
		alert(errmsg);
		check.focus();
		return false;
	 }
}

function checkenquiry(frm) {
	if(emptyfield(frm.e_name, "Please enter your name")==false) return;
	if(emptyfield(frm.e_email, "Please enter your email")==false) return;
	if(emptyfield(frm.e_enquiry, "Please enter your enquiry")==false) return;
	frm.submit();
}