function reguser_validation() {
	//alert("coming.....");
	//return false;
		user_type = document.frm.user_type;
		email = document.frm.email;
		password = document.frm.password;
		test = document.frm.test;
		password2 = document.frm.password2;
		
		city = document.frm.city;
		mobile = document.frm.school;
		std=document.frm.std;
		
		if ((user_type.value==null)||(user_type.value==0)){
			alert('Please Enter User Id.');
			user_type.focus();
			return false;
		}
		
		
		 if (user_type.value.indexOf(" ")!=-1){
		    alert("Invalid User ID, no spaces allowed");
		    user_type.focus();
		    return false;
		 }
		 
		 if ((password.value==null)||(password.value==0)){
			alert("Please Enter password.");
			password.focus();
			return false;
		}
		
		if(password.value.length < 6) 	{
			alert("Password Length Must Be Greater Or Equal To 6 characters.");
			password.focus();
			return false;
		}
		
       if(password.value != password2.value){
       alert("Password and retyped Password do not match");
       password.focus();
       return false;
       }
       
	   
			if ((test.value==null)||(test.value==0)){
			alert("Please Enter Your Name.");
			test.focus();
			return false;
		}
		
		if ((email.value==null)||(email.value=="")){
			alert("Please Enter Your Email ID.");
			email.focus();
			return false;
		}
		if (echeck(email.value)==false){
			alert("Please Enter Valid Email ID.");
			email.focus();
			return false;
		}
		
		
       
		


		if ((mobile.value==null)||(mobile.value==0))
		{
				alert("Please insert your mobile number");
			
				mobile.focus();
				return false;
		}
		if ((mobile.value!=null)&&(mobile.value!=0)){	
		
		if(isNaN(mobile.value)==true)
           {
              alert("Please Enter numeric value in Mobile field")
              return false;
           }

			if(mobile.value.length != 10) 	{
			alert("Mobile Number Must Be Equal To 10 characters or else leave space blank");
			mobile.focus();
			return false;
			}
		
		}
		
		
		
		if ((city.value==null)||(city.value==0)){
			alert("Please Enter City");
			city.focus();
			return false;
		}
		
		if ((document.frm.std.selectedIndex==0)){
			alert("Please Select Your Batch");
			document.frm.std.focus();
			return false;
		}

		
		if ((document.frm.code.value=="" || document.frm.code.value==null )){
			alert("Enter the character as shown in figure ");
			document.frm.code.focus();
			return false;
		}
			
			
	return true;
}

//Email validation
function echeck(str) {

		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
		   
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    
		    return false;
		 }

 		 return true;					
}
