function getref() 
{
var popup = window.open('existuser.php','Testing','toolbar=no,location=no,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=450,height=420,left=350,top=200');
popup.focus();
}
function subnewuser() 
{	  	
		var str=document.product.mailid.value;  
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
	  
	  if(document.product.usrid.value  == "" )
	   {
		 alert("User ID Has Not Been Entered.");
		 document.product.usrid.focus();
		 return false;
   	   }
	   else if(document.product.mailid.value  == "")
   	   {
		 alert("E-mail ID Has Not Been Entered.");
		 document.product.groupcode.focus();
		 return false;
	   }
	   else if(str.indexOf(at)==-1){
		   alert("Invalid E-mail ID.")
		   return false
		}

	   else if(str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID.")
		   return false
		}

	   else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID.")
		    return false
		}

	   else if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID.")
		    return false
		 }

	   else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID.")
		    return false
		 }

	   else if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID.")
		    return false
		 }
		
	   else	if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID.")
		    return false
		 }
	   else if(document.product.contact.value  == "")
   	    {
			 alert("Contact Number Has Not Been Entered.");
			 document.product.contact.focus();
			 return false;	
	    }  	
	   else if(document.product.addres.value  == "" )
	   {
			 alert("Address Has Not Been Entered");
			 document.product.addres.focus();
			 return false;
   	   }
   	   else
   	   {
		document.product.action="saveuserdetails.php";
	    document.product.submit();
	    return true;	
	   }
}
function resetnewuser() 
{
window.close();
}

function subexistuser() 
{
	  
	  if(document.product.usrid.value  == "" )
	   {
		 alert("User ID Has Not Been Entered.");
		 document.product.usrid.focus();
		 return false;
   	   }
	  else if(document.product.password.value  == "" )
	   {
		 alert("Password Has Not Been Entered.");
		 document.product.password.focus();
		 return false;
   	   }
	   else
	   {
	   document.product.action="validate.php";
	   document.product.submit();
	   return true;
 	   }   
}
function resetexituser() 
{
window.close();
}

