
function createRequestObject() {
		    var tmpXmlHttpObject;
		    
		    //depending on what the browser supports, use the right way to create the XMLHttpRequest object
		    if (window.XMLHttpRequest) { 
		        // Mozilla, Safari would use this method ...
		        tmpXmlHttpObject = new XMLHttpRequest();
			
		    } else if (window.ActiveXObject) { 
		        // IE would use this method ...
		        tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
		    }
		    
		    return tmpXmlHttpObject;
		}
		
		//call the above function to create the XMLHttpRequest object
		var http = createRequestObject();
				
		function makeGetRequest(wordId) {
		
		    //make a connection to the server ... specifying that you intend to make a GET request 
		    //to the server. Specifiy the page name and the URL parameters to send
		    	if(wordId=="login"){
		   		var userId=document.getElementById("username").value;
		   		var pass=document.getElementById("password").value;
		    		http.open('get','/web/system/modules/sonatatemplate/pages/careertempelements/validateUser.jsp?userid='+userId+'&pass='+pass+'&login=true',true);  }
		    	else{
		    		var userId=document.getElementById("username").value;
		   		var pass=document.getElementById("password").value;
		   		var dob=document.getElementById("dob").value;
		   	    	http.open('get','/web/system/modules/sonatatemplate/pages/careertempelements/validateUser.jsp?user='+userId+'&pass='+pass+'&dob='+dob,true);
		       	} 
		     //assign a handler for the response
		    	http.onreadystatechange = processResponse;
		    //actually send the request to the server
		    http.send(null);
		}
		
		function processResponse() {
		    //check if the response has been received from the server
		    if(http.readyState == 4){
			//read and assign the response from the server
		        var response = http.responseText;
				
		        //do additional parsing of the response, if needed
			 //in this case simply assign the response to the contents of the <div> on the page. 
		         	document.getElementById('loginstatus').innerHTML = response;
		        					
				
		        //If the server returned an error message like a 404 error, that message would be shown within the div tag!!. 
		        //So it may be worth doing some basic error before setting the contents of the <div>
		    }
		}
		
		
		
		function redirectToSearch(){
			var url="/web/sonata_en/company/careers/searchjobs.html?keyword="+document.getElementById('searchjob').value;
			location.href = url;
		}
		
function redirectToRegistration(){
			var url="/web/sonata_en/company/careers/userRegistration.html";
			location.href = url;
}
		
function changePassword() { 
	var update="update";
   document.getElementById('loginstatus').innerHTML="<table width='234' border='0' cellpadding='0' cellspacing='0' bgcolor='#a4c4d9'><tr><td colspan='4' align='left' valign='top'><img src='/export/system/modules/sonatatemplate/resources/images/careerimg/login.jpg' alt='Login' width='89' height='38' /></td></tr><tr><td width='52'>&nbsp;</td><td width='55' align='left' class='LoginTxt'>User Name</td><td align='left' valign='top'> : <input name='username' id='username' type='text' class='LoginBox' value='User Name' size='19'/></td><td width='16' align='left' valign='top'>&nbsp;</td></tr><tr><td width='52'>&nbsp;</td><td width='55' align='left' class='LoginTxt'>DOB</td><td align='left' valign='top'> : <input name='dob' id='dob' type='text' class='LoginBox' value='dd/mm/yyyy' size='19'/></td><td width='16' align='left' valign='top'>&nbsp;</td></tr><tr><td>&nbsp;</td><td align='left' class='LoginTxt'>Password</td><td align='left' valign='top'> : <input name='password' id='password' onblur='valdatePassword()' type='password' class='LoginBox' size='19'/><div class='LoginTxt' style='color:red'id='password_err'></div></td><td align='left' valign='top'>&nbsp;</td></tr><tr><td></td><td colspan='2' align='left' class='LoginTxt'><a href='#' class='LoginTxt' onclick='javascript:makeGetRequest(1)'>update</a></td><td>&nbsp;</td></tr></table>";
}

function valdatePassword(){
var val_check=document.getElementById('password').value;
		//document.getElementById(err_id+'_err').innerHTML="";
		if(val_check.length<6){
		document.getElementById("password_err").innerHTML="Invalid Password";
		//err_num= err_num + 1;
		return false;
		}
		if(val_check.length>=6||Trim(val_check)==""){
			if(!val_check.match(/^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$/)){
				document.getElementById("password_err").innerHTML="Invalid Password";
				//err_num= err_num + 1;
				return false;
			}
		}

}
