re2 = /\w*@\w*\.\w+/;
re3 = /\d+/;
ref = /\w+/;
function validate(doc)
{

   function blank(doc)
   {

	    if((doc.name.value == "") || (doc.addr.value == "") || (doc.city.value == "") || (doc.email.value == "") || (doc.phon.value == "") || (doc.zip.value == "") || (doc.cname.value == "") || (doc.login.value == "") || (doc.pass.value == "") || (doc.pname.value == ""))
	    {
		alert("Some Fields are Vacant");
		return false;
	    }
	    else
	    {
		return true;
	    }
   }
      function check_email(doc)
      {
	   if(doc.value != "")
	   {
	       fsign = doc.value.indexOf("@");             
	       ssign = doc.value.indexOf(".");

	       if(fsign <= 0 || ssign <= 0)
	       {

		     alert("You should enter proper email ID");
		     return false;
	       }
	       else
	       {
		     return true;
	       }
	   }
	   else
	   {
		    return true;
	   }
      } 
      function check_num(doc)
      {
	   if(!((re3.test(doc.phon.value))))
	   {
		alert("You should enter only numeric values for the fields ISD No.,STD No.,PHONE No., QUANTITY and Zip");
		return false;
	   }
	   else
	   {
		return true;
	   }
      }
      function check_pass(doc)
      {
	  if(doc.pass.value != doc.cpassword.value)      
	  {    
		alert("Password and Confirm Password should be same");      
		return false;	      
	  }
	  else   
	  {
		return true;		  
	  }   
      }

      if(!blank(doc))
      {
	   return false;
      }
      if(!check_email(doc.email))
      {
	    return false;
      }
      if(!check_num(doc))
      {
	    return false;
      }
      if(!check_pass(doc))
      {
	    return false;
      }			
}
function copypop()
{
         HM_NS4 = (document.layers) ? true : false;
	 HM_BrowserString1 = HM_NS4 ? "NS4" : "IE4";
	
	                
	                doc = "../copyright.htm";
	                if(HM_BrowserString1 == "NS4")
			 {
			  window.open (doc,"Copyright", "toolbar=0, location=0,directories=0,resizable=no,status=0,menubar=0,scrollbars=no,resile=0,width=625,height=350,screenX=0,screenY=0");
		         }
		        else
			 {
			  window.open (doc,"Copyright", "toolbar=0, location=0,directories=0,resizable=no,status=0,menubar=0,scrollbars=no,resile=0,width=625,height=350,left=0,top=0");
			 }
}
