
           function callback_test1(res)
            {
	         document.getElementById("display1").innerHTML = res.value;
             }

       
         function test1()
         {
    
	    
	    
	    if(!document.getElementById('rdoFresher').checked && !document.getElementById('rdoExperience').checked)
	    {
			alert("please select usertype");return false;
	    }
	    
	    
		//document.getElementById("txtfirstName").value=="";
		if(document.getElementById('txtUserName').value=="")
	{
	//get Username/Mailid value and check is it blank or not if it is blank
	alert("Please enter user name");
	//if it is blank display error message to user
	document.getElementById('txtUserName').value=""
	//set the Username/Mailid input value to blank
	document.getElementById('txtUserName').focus();
	//set the cursor position to Username/Mailid
	return false;
	}
	if(UName()==false)
	{
	//check Username/Mailid validations if it is false return false
	return false;
	}
	
			
	
		function UName()
		{
			//var illegalChars = /^[a-zA-Z0-9_.]*$/;	
			var illegalChars = /^\w+([\.-]?\w+)+$/;
			//allows only letters 	
			var str=document.getElementById('txtUserName').value;
			// get the user Username/Mailid value
	
			if((str.length<3) || (str.length>20))
			{
			//if Username/Mailid value length <3 and length >20 then
				if(str.length<4)			
				{
					alert("User name should not be less than 3 characters");
				}
				else if(str.length>20)
				{
					alert("User name should not more than 20 characters");
				}		
					//displaying error message to user
					document.getElementById('txtUserName').value="";
					//set the Username/Mailid field to blank
					document.getElementById('txtUserName').focus();
					//set the cursor position to Username/Mailid field
					return false;
				}
				if(!illegalChars.test(str))
				{
				//test the user input value allows only letters or not
				alert("Invalid User Name");
				//dispalying error message to user
				document.getElementById('txtUserName').value="";
				//set the Username/Mailid field to blank
				document.getElementById('txtUserName').focus();
				//set the cursor position to Username/Mailid field
				return false;
				}
			}
			
		if(document.getElementById('txtPassword').value=="")
		{
			//get password value and check is it blank or not
			alert("Please enter your password");
			//if it is blank display error message to user
			document.getElementById('txtPassword').value="";
			//set the password field to blank
			document.getElementById('txtPassword').focus();
			//set the cursor position to password field
			return false;
		}
		if(Password()==false)
		{
			//check password  validations,if it is false return false 
		   return false;
		}
						function Password()
						{						
							var  pwd=document.getElementById('txtPassword').value;
							//getting the password input value
							var illegalChars = /[\W_]/;
							// allow only letters and numbers no underscores and special characters and white space
							if((pwd.length<6) || (pwd.length>12))
							{
							//password length should in between 5 and 10 if not
							if(pwd.length<6)
								{
									alert("Password should not be less than 6 characters");
								}
								else if(pwd.length>12)
								{
									alert("Password should not more than 12 characters");
								}		
							//displaying error message to user
							document.getElementById('txtPassword').value="";
							//set the password field to blank
							document.getElementById('txtPassword').focus();
							//set the cursor position to password field
							return false;
							}
						
							if(illegalChars.test(pwd))
							{							
							//verifying password text contains letters , numbers or not
							alert("Invalid Password");
							//if not displaying erroer message to user
							document.getElementById('txtPassword').value="";
							//set the password field to blank
							document.getElementById('txtPassword').focus();
							//set the cursor position to password field
							return false;
							}	
						}
		if(document.getElementById('txtConfirmPassword').value=="")
		{
		//get confirm password value and check is it blank or not
		alert("Please enter confirm password");
		//if it is blank display error message to user
		document.getElementById('txtConfirmPassword').value="";
		//set the password field to blank
		document.getElementById('txtConfirmPassword').focus();
		  //set the cursor position to confirm password field

		return false;
		}
		if(Compare()==false)
		{
		//check password vale same as confirm password value or not ,if it is false return false
		return false;
		}
		function Compare()
{
	
	var password=document.getElementById('txtPassword').value;
	// getting the password input value
	var conpwd=document.getElementById('txtConfirmPassword').value;
	//getting confirm password input value
	if(password!=conpwd)
	{
	//if confirm password not matches to password value
	alert("Password and Confirm Password should be the same");
	//displaying error messages to user
	document.getElementById('txtConfirmPassword').value="";
	//set the password field to blank
	document.getElementById('txtConfirmPassword').focus();
	//set the cursor position to confirm password field
	return false;
	}
}

if ((document.getElementById('txtEmail').value) == "")
		{
		//get email address value and check is it blank or not
		alert("Please enter your emailid");
		//if it is blank display error message to user
		document.getElementById('txtEmail').value=""
		//set the email field value to blank
		 document.getElementById('txtEmail').focus();
		 //set the cursor position to email field
		return false;
		}
		if(CheckEmail()==false)
		{
		//check email validations if it is false return false
		return false;		
		}
		
					if ((document.getElementById('chkTerms').checked) == 0)
					{
					//get email address value and check is it blank or not
					alert("Please accept the Terms & Conditions to complete the registration");
					//if it is blank display error message to user
					document.getElementById('chkTerms').value=""
					//set the email field value to blank
					document.getElementById('chkTerms').focus();
					//set the cursor position to email field
					return false;
					}		
		
function CheckEmail()
{	
	var reguser=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
	//email format shuold be like this ajay_k@yahoo.co.in
	var str=document.getElementById('txtEmail').value;
	if(!str.match(reguser))
	{
	//if email format matches to given input value or not
	alert("Enter correct emailid");
	//if not display error message to user
	document.getElementById('txtEmail').value=""
	//set the email field value to blank
	document.getElementById('txtEmail').focus();
	//set the cursor position to email field
	return false;
	}
}
		
		
		
		
		
		
		
		
		callback_test1
		
}
