//Javascript

function trim(s) {
	s = s.replace(/(^\s*)|(\s*$)/gi,"");
	s = s.replace(/[ ]{2,}/gi," ");
	s = s.replace(/\n /,"\n");
	return s;
}
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////

function ajax_check_duplicate(strforename, strsurname, strdateOfBirth, strcurrentAddress_postcode)
{
	var httpxml;

	if (window.XMLHttpRequest)
	  {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  httpxml= new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {
	  // code for IE6, IE5
	  httpxml= new ActiveXObject("Microsoft.XMLHTTP");
	  }

	function stateck() {
		if(httpxml.readyState==4) {
			var strProductid = httpxml.responseText;
			//if (strProductid == "1"){
				parent.document.getElementById('hid_prev_appid').value = strProductid;	
			//}
			//else{
			//	parent.document.getElementById('btn_UpdateTelNos').value = 'Please Try Again';	
			//}	
			return strProductid;
			alert(strProductid);
		}
	}
	
	var url="ajax_check_duplicate.php";
		url=url+"?forename="+strforename;		
		url=url+"&surname="+strsurname;		
		url=url+"&dateOfBirth="+strdateOfBirth;		
		url=url+"&currentAddress_postcode="+strcurrentAddress_postcode;		
//alert(url);		
	httpxml.onreadystatechange=stateck;
	httpxml.open("GET",url,true);
	httpxml.send(null);

}

