	//  ENABLE OPTICIAN DETAILS		
	function enableoptdetails(envalue){
		document.getElementById('txtOpticianName').disabled=envalue;
		document.getElementById('txtOpticianPhoneNumber').disabled=envalue;
		document.getElementById('txtOpticianAddress').disabled=envalue;
		document.getElementById('selDayConsultation').disabled=envalue;
		document.getElementById('selMonthConsultation').disabled=envalue;
		document.getElementById('selYearConsultation').disabled=envalue;
		
		if(envalue == false){
			document.getElementById('req1').style.display="inline";
			document.getElementById('req2').style.display="inline";
		}else{
			document.getElementById('req1').style.display="none";
			document.getElementById('req2').style.display="none";
		}	
	}
	
	
	// POPULATE HOMESTORE DETAILS ONBLUR EVENT OF POST CODE INPUT FIELD
	function populateCountry(postcode){						
			postcodeprefix = postcode.substring(0,2);
		    postcodeprefix = postcodeprefix.toUpperCase(); 
			if((postcodeprefix!="GY" && postcodeprefix!="JE" && postcodeprefix!="IM")){
					if (!checkPostCode (postcode)) {
    					alert (POST_CODE_IS_NOT_VALID_UK_FORMAT_HOME);  
    					return (false);
					}
			}
			url = "Country";
    		param = "postcode="+postcode;
			msg ="";
	        ajax_call_country_by_postcode(url,param,"usercountry", msg, postcode);	        	     
	}
	
	
	function validatePostcodeByCountry(country){			
			var delpostcode=document.getElementById('txtDeliveryPostcode').value;
			var homepostcode=document.getElementById('txtUserPostcode').value;
			
			var delCountry = getPostcodeByCountry(delpostcode);
			var homeCountry = getPostcodeByCountry(homepostcode);
			
			//var retvalue = checkPostcodeByCountry(country, postcode);
		
			if(delCountry == homeCountry){
				country=document.getElementById('selDeliveryCountry').value;
				if(country==1 && !validatePostcodeFormat()){
					return (false);
				}else{
					return true;
				}
			
			}else{
				alert(MUST_ENTER_DELIVERY_ADDRESS_POSTCODE_BY_HOME_COUNTRY);								
				return (false);		
			}		
	}
	
	
	
	function populateDelCountry(country){				
			url = "delCountryByPostcode.php";
    		param = "country="+country;
			msg ="";
	        ajax_call_delivery(url,param,"userdelcountry",msg);      
	}
	
	
	var childWindow;
	function funQAs(type){
		   if(type == "home"){
			   if(trim(document.getElementById('txtUserAddressLine1').value) == "" && trim(document.getElementById('txtUserPostcode').value) == ""){
					alert (ENTER_ADDRESS_DETAIL)				
					return (false);				
					
				}
				var par1 =document.getElementById('txtUserAddressLine1').value;
				var par2 =document.getElementById('txtUserPostcode').value;
				

				
				if(par1 != ""){
					par = par1+","+par2;
				}else if(par2 != ""){
					par = par2;
				}
			}else if(type == "delivery"){			
				if(trim(document.getElementById('txtDeliveryAddressLine1').value) == "" && trim(document.getElementById('txtDeliveryPostcode').value) == ""){
						alert (ENTER_ADDRESS_DETAIL)				
						return (false);										
				}					
				par = document.getElementById('txtDeliveryAddressLine1').value+","+document.getElementById('txtDeliveryPostcode').value;						
			}
			var qasCountryCode = document.getElementById('qasCountryCode').value;
			LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
			TopPosition = (screen.height) ? (screen.height-400)/2 : 0;
			childWindow = window.open("QAS&method_name=findAddresses&countryCode="+qasCountryCode+"&searchCriteria="+par+"&addressType="+type,null,"height=400,width=600,left="+LeftPosition+",top="+TopPosition+",status=yes,scrollbars =yes,toolbar=no,menubar=no,location=no");			
			if(type == "home" && trim(document.getElementById('txtUserPostcode').value) == ""){
				setTimeout('checkchildWindowclosed()', 250);
			}
	}

	function checkchildWindowclosed(){
		if(childWindow.closed){
			populateCountry(document.getElementById('txtUserPostcode').value);
		}else{
			setTimeout('checkchildWindowclosed()', 250);
		}
	}
	



	function populateAddressDetails(addressLine1,addressLine2,town,county,postcode,type){
		if(type == "home"){
			document.getElementById('txtUserAddressLine1').value = addressLine1;
			document.getElementById('txtUserAddressLine2').value = addressLine2;
			document.getElementById('txtUserTown').value = town;
			document.getElementById('txtUserCounty').value = county;
			document.getElementById('txtUserPostcode').value = postcode;
			document.getElementById('txtUserAddressLine3').value = "";
		}
		if(type == "delivery"){
			document.getElementById('txtDeliveryAddressLine1').value = addressLine1;
			document.getElementById('txtDeliveryAddressLine2').value = addressLine2;
			document.getElementById('txtDeliveryTown').value = town;
			document.getElementById('txtDeliveryCounty').value = county;
			document.getElementById('txtDeliveryPostcode').value = postcode;
			document.getElementById('txtDeliveryAddressLine3').value = "";			
		}
		
	}	
	

	
	function onoffoptdetails(){
		if(document.getElementById('specsaverscust').checked){
		    document.getElementById('optAddOr').style.display = "none";
		}else{
		    document.getElementById('optAddOr').style.display = "block";		
		}
	}

    function emptyaddressname(addvalue){
    	if(addvalue=="eg: Home, Work"){
    		 document.getElementById('txtUserAddressNickname').value="";
    	}
    
    }
    
    function emptyaddressfields(){
    	document.getElementById('txtUserAddressLine2').value= "";
		document.getElementById('txtUserAddressLine3').value= "";
		document.getElementById('txtUserTown').value="";
		document.getElementById('txtUserCounty').value="";
		
		
		document.getElementById('txtDeliveryAddressLine2').value="";
		document.getElementById('txtDeliveryAddressLine3').value="";
		document.getElementById('txtDeliveryTown').value="";
		document.getElementById('txtDeliveryCounty').value="";
    }
    
    

    
	// 	REGISTRATION FORM VALIDATION STARTS HERE 
	
	function Form_Validator(theForm){
		// check to see if first name is blank
		if(!checkEmpty("txtFirstName",YOU_MUST_ENTER_FIRST_NAME)){
			return (false);
		}
		
		// check to see if first name is blank
		if(!checkEmpty("txtLastName",YOU_MUST_ENTER_LAST_NAME)){
			return (false);
		}
		
		// check the date of birth
		if(!checkEmpty("selDayDob",YOU_MUST_SELECT_DAY)){
			return (false);
		}
		if(!checkEmpty("selMonthDob",YOU_MUST_SELECT_MONTH)){
			return (false);
		}
		if(!checkEmpty("selYearDob",YOU_MUST_SELECT_YEAR)){
			return (false);
		}
			
		if(!checkValidDate("selDayDob", "selMonthDob", "selYearDob", "Date of Birth")){
			return (false);
		}
		
		if(!checkEmpty("selGender",YOU_MUST_SELECT_GENDER)){
			return (false);
		}
		

		// check if Mobile Phone number is exist then its a numeric
		if(document.getElementById('txtmobilephone').value != ""){
				if(!checkPhoneNumbers("txtmobilephone", PLEASE_ENTER_VALID_MOBILE_PHONE)){
					return (false);
				}
		}
		
		// check to see if Daytime phone number is blank
		if(!checkEmpty("txtdaytimephone",PLEASE_ENTER_VALID_DAYTIME_PHONE)){
			return (false);
		}
		
		if(!checkPhoneNumbers("txtdaytimephone", PLEASE_ENTER_VALID_DAYTIME_PHONE)){
			return (false);
		}
	
		// check if Mobile Phone number is exist then its a numeric
		if(document.getElementById('txteveningphone').value != ""){
				if(!checkPhoneNumbers("txteveningphone", PLEASE_ENTER_VALID_EVENING_PHONE)){
					return (false);
				}
		}
	
		// check to see if e-mail is blank
		if(!checkEmpty("txtUserEmail",YOU_MUST_ENTER_EMAIL)){
			return (false);
		}

		//check whether email is valid or not
		if (echeck(trim(document.getElementById('txtUserEmail').value))==false){
			document.getElementById('txtUserEmail').focus();
			return false
		}
		
		// check to see if Confirm e-mail is blank
		if(!checkEmpty("txtRetypeUserEmail",YOU_MUST_ENTER_CONFIRM_EMAIL)){
			return (false);
		}

		//check whether Confirm is valid or not
		if (echeck(trim(document.getElementById('txtRetypeUserEmail').value))==false){
			document.getElementById('txtRetypeUserEmail').focus();
			return (false);
		}
		
		// check to see if Email and Confirm Email are same or not
		if(trim(document.getElementById('txtUserEmail').value) != trim(document.getElementById('txtRetypeUserEmail').value)){
			alert(CONFIRM_EMAIL);
			document.getElementById('txtRetypeUserEmail').focus();
			return (false);
		}
		
			if(document.getElementById('txtregPassword')!=null){
				
				// check to see if password is blank
				if(!checkEmpty("txtregPassword",YOU_MUST_ENTER_PASSWORD)){
					return (false);
				}
				
				// check the password length is between 6 and 24 char
				if(!checkstringlength("txtregPassword", 6, 24, YOUR_PASSWORD_LENGTH)){
					return (false);
				}
		
				// check to see if retype-password is blank
				if(!checkEmpty("txtRetyperegPassword",YOU_MUST_ENTER_REPEAT_PASSWORD)){
					return (false);
				}
		
				// check to see if password and retype-password are same or not
				if(trim(document.getElementById('txtregPassword').value) != trim(document.getElementById('txtRetyperegPassword').value)){
					alert("You have entered an incorrect password");
					return (false);
				}
			}
			
		
		if(!validateaddress(theForm)){
			return (false);			
		}
		
        //disable the country name fields in address
		
		document.getElementById('selUserCountryName').disabled = true;
		if(document.getElementById('selDeliveryCountryName') != null){
			document.getElementById('selDeliveryCountryName').disabled = true;
		}
		
		// check to see if home store is selected or not
		if(!checkEmpty("selHomeStore",MUST_SELECT_SPECSAVERS_STORE)){
			return (false);
		}
		
		
		
	  
	  if(document.getElementById('radioPrescriptionType2').checked == true){
	   				
	   				// check to see if optician name is blank
					if(!checkEmpty("txtOpticianName",YOU_MUST_ENTER_OPTICIAN_COMPANY_NAME)){
						return (false);
					}
					
					// check to see if optician phone number is blank
					if(!checkEmpty("txtOpticianPhoneNumber",YOU_MUST_ENTER_OPTICIAN_COMPANY_PHONE)){
						return (false);
					}
					
					if(!IsNumeric("txtOpticianPhoneNumber", OPTICIAN_COMPANY_PHONE_NUMERIC)){
						return (false);
					}
					
					var constday = document.getElementById('selDayConsultation').value;
					var constmonth = document.getElementById('selMonthConsultation').value;
					var constyear = document.getElementById('selYearConsultation').value;
					if(constday != "" && constmonth != "" && constyear != ""){
						if(!checkdate(constyear, constmonth, constday, "Date of last contact lens consultation", "selDayConsultation")){
								return (false);
						}					
					}
		}
		
		if(document.getElementById('marketingAcceptance')!=null){
			if(document.getElementById('marketingAcceptance').checked==true){
				document.getElementById('marketingAcceptance').value = "yes";
			}else{
				document.getElementById('marketingAcceptance').value = "no";
			}
		} 
		
		if(trim(document.getElementById('isRegistrationView').value) == "" || trim(document.getElementById('isRegistrationView').value) == "false" ){
			if(!onChangesDetected()){
				return false;
			}
		}
		
		/*  else{
			document.getElementById("homeAddressChanged").value = "";
		}*/
		
		
        // enable the country name fields in address
		document.getElementById('selUserCountryName').disabled = false;
		if(document.getElementById('selDeliveryCountryName') != null){
			document.getElementById('selDeliveryCountryName').disabled = false;
		}
		
	
	

	}
	
	 function validateaddress(theForm){

	    if(!checkEmpty("txtUserAddressLine1", MUST_ENTER_HOME_HOUSENO)){
           return (false);
        }

    	if(!checkEmpty("txtUserPostcode", MUST_ENTER_HOME_POSTCODE)){
           return (false);
        }
        //Check Is User Post code is in UK format or not
        if(document.getElementById('selUserCountry').value == 1){
        	var userPostCode = document.getElementById('txtUserPostcode').value;
  			if (!checkPostCode (userPostCode)) {
    			alert (POST_CODE_IS_NOT_VALID_UK_FORMAT_HOME);  
    			return (false);
        	}
        }
        
        
        UserAddresstype = document.getElementById('existsDeliveryAdd').checked;
    		
        if(UserAddresstype){
        		document.getElementById('existsDeliveryAdd').value = "1";
				if(!checkEmpty("txtDeliveryAddressLine1", MUST_ENTER_DELIVERY_HOUSENO)){
	               return (false);
	            }
	
	        	if(!checkEmpty("txtDeliveryPostcode", MUST_ENTER_DELIVERY_POSTCODE)){
	               return (false);
	            }
	            
	            //Check Is User Post code is in UK format or not
        		//validatePostcodeFormat();
                var country = document.getElementById('selDeliveryCountry').value;
                var returnvalue = validatePostcodeByCountry(country);
                if(returnvalue == false){
					document.getElementById('txtDeliveryPostcode').focus();	
                	return (false);
                }
 
        }else{
        	document.getElementById('existsDeliveryAdd').value = "0";
        }

        
        // check the changes for edit address book
		if(document.getElementById('addressForm') != null){ 
    	  if(document.getElementById('addressForm').value=="true"){
			if(!onChangesDetected()){
				return false;
			}
		  }
		}
        
        
        // enable the country name fields in address
		document.getElementById('selUserCountryName').disabled = false;
		if(document.getElementById('selDeliveryCountryName') != null){
			document.getElementById('selDeliveryCountryName').disabled = false;
		}
    
         return true;    
    }    
	
	
	function validatePostcodeFormat(){
        		var delPostCode = document.getElementById('txtDeliveryPostcode').value;
  				if (!checkPostCode (delPostCode)) {
 					alert (POST_CODE_IS_NOT_VALID_UK_FORMAT_DELIVERY);  
 					return (false);
 				}else{
 					return true;
 				}
	}
	
	
	// Function to check the valid date
		
	function checkValidDate(dayname, monthname, yearname, fieldname){
	
			var inputday = document.getElementById(dayname).value; 
			var inputmonth = document.getElementById(monthname).value; 
			var inputyear = document.getElementById(yearname).value; 
	
			var today = new Date();
			var day = today.getDate();
			var month = today.getMonth()+1;
			var year  = today.getFullYear();
	
			if(inputyear>year){
				alert(fieldname+" should not be a future date");
				document.getElementById(yearname).focus();
				return (false);
			}else if(inputyear==year && inputmonth>month){
				alert(fieldname+" should not be a future date");
				document.getElementById(monthname).focus();
				return (false);
			}else if(inputyear==year && inputmonth==month && inputday>day){
				alert(fieldname+" should not be a future date");
				document.getElementById(dayname).focus();
				return (false);
			}else if(inputyear==year && inputmonth==month && inputday==day){
				alert(fieldname+" should not be a current date");
				document.getElementById(dayname).focus();
				return (false);		
			}
			
			if(!checkdate(inputyear, inputmonth, inputday, fieldname, dayname)){
				return (false);
			}
			
		return true;
	 }
 
	 function checkdate(inputyear, inputmonth, inputday, fieldname, dayname){
	 	
	 		var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	
			/* checking leap year */
	
			if (inputyear/4 == parseInt(inputyear/4)){
				monthLength[1] = 29;
			}
	
			if (inputday > monthLength[inputmonth-1]){
				alert(fieldname+" is not a valid date");
				document.getElementById(dayname).focus();
				return (false);
			} 
			
			return true;
	 
	 }
	
	 //it checks the postcode by country
	 function checkPostcodeByCountry(country, postcode){
			postcode = postcode.substring(0,2);
		    postcode = postcode.toUpperCase(); 
	
		    if(country==19 && postcode=='GY'){
		   		return true;   	
		    }else if(country==20 && postcode=='JE'){
		   		return true;
		    }else if(country==5 && postcode=='IM'){
		  		return true;
		 	}else if(country==1 && !(postcode!="GY" || postcode!="JE" || postcode!="IM")){
		 	 	return true;
		 	}else if(country==1 && (postcode!="GY" && postcode!="JE" && postcode!="IM")){
		 	 	return true;
		 	}else{
		 		return false;
		 	} 
	  }
	  
	  function getPostcodeByCountry(postcode){
	  		postcode = postcode.substring(0,2);
		    postcode = postcode.toUpperCase(); 
	
		    if(postcode=='GY'){
		   		return '19';   	
		    }else if(postcode=='JE'){
		   		return '20';
		    }else if(postcode=='IM'){
		  		return '5';
		 	}else{
		 		return '1';
		 	} 
	  }
	
	

    
	function closewindow1(){
			window.opener.document.getElementById('deliveryAddName').selectedIndex= window.opener.document.getElementById('curDelAddressId').value;
			window.close();	
	}

	
	
    function checkPostCode (toCheck) {

	  // Permitted letters depend upon their position in the postcode.
	  var alpha1 = "[abcdefghijklmnoprstuwyz]";                       // Character 1
	  var alpha2 = "[abcdefghklmnopqrstuvwxy]";                       // Character 2
	  var alpha3 = "[abcdefghjkstuw]";                                // Character 3
	  var alpha4 = "[abehmnprvwxy]";                                  // Character 4
	  var alpha5 = "[abdefghjlnpqrstuwxyz]";                          // Character 5
	  
	  // Array holds the regular expressions for the valid postcodes
	  var pcexp = new Array ();

	  // Expression for postcodes: AN NAA, ANN NAA, AAN NAA, and AANN NAA
	  pcexp.push (new RegExp ("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1,2})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));
	  
	  // Expression for postcodes: ANA NAA
	  pcexp.push (new RegExp ("^(" + alpha1 + "{1}[0-9]{1}" + alpha3 + "{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));

	  // Expression for postcodes: AANA  NAA
	  pcexp.push (new RegExp ("^(" + alpha1 + "{1}" + alpha2 + "?[0-9]{1}" + alpha4 +"{1})(\\s*)([0-9]{1}" + alpha5 + "{2})$","i"));
	  
	  // Exception for the special postcode GIR 0AA
	  pcexp.push (/^(GIR)(\s*)(0AA)$/i);
	  
	  // Standard BFPO numbers
	  pcexp.push (/^(bfpo)(\s*)([0-9]{1,4})$/i);
	  
	  // c/o BFPO numbers
	  pcexp.push (/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);
	  
	  // Overseas Territories
	  pcexp.push (/^([A-Z]{4})(\s*)(1ZZ)$/i);

	  // Load up the string to check
	  var postCode = toCheck;

	  // Assume we're not going to find a valid postcode
	  var valid = false;
	  
	  // Check the string against the types of post codes
	  for ( var i=0; i<pcexp.length; i++) {
		if (pcexp[i].test(postCode)) {
		
		  // The post code is valid - split the post code into component parts
		  pcexp[i].exec(postCode);
		  
		  // Copy it back into the original string, converting it to uppercase and
		  // inserting a space between the inward and outward codes
		  postCode = RegExp.$1.toUpperCase() + " " + RegExp.$3.toUpperCase();
		  
		  // If it is a BFPO c/o type postcode, tidy up the "c/o" part
		  postCode = postCode.replace (/C\/O\s*/,"c/o ");
		  
		  // Load new postcode back into the form element
		  valid = true;
		  
		  // Remember that we have found that the code is valid and break from loop
		  break;
		}
	  }
  
  // Return with either the reformatted valid postcode or the original invalid 
  // postcode
  if (valid) {return postCode;} else return false;
}


var changesDetected = false;
function detectChanges(){
	 for (i=0;i<document.frmUserRegistration.elements.length; i++){
	     
	     if(document.frmUserRegistration.elements[i].type == "text"){
		     if(document.frmUserRegistration.elements[i].getAttribute("oldvalue") != document.frmUserRegistration.elements[i].value){
		      changesDetected = true;
		      break;
		     }
	     } else if(document.frmUserRegistration.elements[i].type == "select-one") {
		     if(document.frmUserRegistration.elements[i].options[document.frmUserRegistration.elements[i].selectedIndex].getAttribute("oldvalue") != document.frmUserRegistration.elements[i].options[document.frmUserRegistration.elements[i].selectedIndex].value){
			      changesDetected = true;
	    	  	  break;
	     	 } 
	     }else if(document.frmUserRegistration.elements[i].type == "textarea"){
	     	
	     	 if(trim(document.frmUserRegistration.elements[i].getAttribute("oldvalue")) != trim(document.frmUserRegistration.elements[i].value)){
		         changesDetected = true;
		         break;
	     	 }
	     }
	  }

 	  if(document.getElementById("existsDeliveryAdd").getAttribute("oldvalue") != document.getElementById("existsDeliveryAdd").value){
	  	  changesDetected = true;
	  }

  	 if(document.getElementById('addressForm') == null){	
	  	  
	  	  if(document.getElementById("marketingAcceptance").checked && document.getElementById("marketingAcceptance").getAttribute("oldvalue") != document.getElementById("marketingAcceptance").value){
		  	  changesDetected = true;
		  }
		  
		  if(!document.getElementById("marketingAcceptance").checked && document.getElementById("marketingAcceptance").getAttribute("oldvalue") == document.getElementById("marketingAcceptance").value){
		  	  changesDetected = true;
		  }
		  	  
		  prescriptionlen = document.frmUserRegistration.radioPrescriptionType.length;
		  
	  	  for (i = 0; i <prescriptionlen; i++) {
				if (document.frmUserRegistration.radioPrescriptionType[i].checked) {
					if(document.frmUserRegistration.radioPrescriptionType[i].getAttribute("oldvalue") != document.frmUserRegistration.radioPrescriptionType[i].value){
						changesDetected = true;
						break;
					}
				}
		  }
	  }
	  
	  if(document.getElementById("existsDeliveryAdd").checked){
	  		if(document.getElementById("txtDeliveryPostcode").getAttribute("oldvalue") != document.getElementById("txtDeliveryPostcode").value){
	  			document.getElementById("deliveryAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtDeliveryAddressLine1").getAttribute("oldvalue") != document.getElementById("txtDeliveryAddressLine1").value){
	  			document.getElementById("deliveryAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtDeliveryAddressLine2").getAttribute("oldvalue") != document.getElementById("txtDeliveryAddressLine2").value){
	  			document.getElementById("deliveryAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtDeliveryAddressLine3").getAttribute("oldvalue") != document.getElementById("txtDeliveryAddressLine3").value){
	  			document.getElementById("deliveryAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtDeliveryTown").getAttribute("oldvalue") != document.getElementById("txtDeliveryTown").value){
	  			document.getElementById("deliveryAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtDeliveryCounty").getAttribute("oldvalue") != document.getElementById("txtDeliveryCounty").value){
	  			document.getElementById("deliveryAddressChanged").value =  "true";
	  		}else if(document.getElementById("selDeliveryCountry").getAttribute("oldvalue") != document.getElementById("selDeliveryCountry").value){
	  			document.getElementById("deliveryAddressChanged").value =  "true";
	  		}
	  }
	  		if(document.getElementById("txtUserPostcode").getAttribute("oldvalue") != document.getElementById("txtUserPostcode").value){
	  			document.getElementById("homeAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtUserAddressLine1").getAttribute("oldvalue") != document.getElementById("txtUserAddressLine1").value){
	  			document.getElementById("homeAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtUserAddressLine2").getAttribute("oldvalue") != document.getElementById("txtUserAddressLine2").value){
	  			document.getElementById("homeAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtUserAddressLine3").getAttribute("oldvalue") != document.getElementById("txtUserAddressLine3").value){
	  			document.getElementById("homeAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtUserTown").getAttribute("oldvalue") != document.getElementById("txtUserTown").value){
	  			document.getElementById("homeAddressChanged").value =  "true";
	  		}else if(document.getElementById("txtUserCounty").getAttribute("oldvalue") != document.getElementById("txtUserCounty").value){
	  			document.getElementById("homeAddressChanged").value =  "true";
	  		}else if(document.getElementById("selUserCountry").getAttribute("oldvalue") != document.getElementById("selUserCountry").value){
	  			document.getElementById("homeAddressChanged").value =  "true";
	  		}
	  		return true;
}

function onChangesDetected(){
  	  $returnvalue = detectChanges();
  	  
	  if(!changesDetected){
		   document.getElementById("txtMode").value = "";
	  }
	  
	  return true;
}

     










	