function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function contact_validate() {
    if(document.frmyourdetails.txtcomments.value == ''){
		alert("Please Enter Your Comments");
		return false;
	}
}


function showBirmingham() {

    document.getElementById('birminghamDiv').style.display = 'block';
    document.getElementById('lowerMapDiv').style.display = 'none';
    document.getElementById('greaterLondonDiv').style.display = 'none';

}

function showGreaterLondon() {

    document.getElementById('birminghamDiv').style.display = 'none';
    document.getElementById('lowerMapDiv').style.display = 'none';
    document.getElementById('greaterLondonDiv').style.display = 'block';

}

function hideInfoPanels() {

    document.getElementById('birminghamDiv').style.display = 'none';
    document.getElementById('lowerMapDiv').style.display = 'block';
    document.getElementById('greaterLondonDiv').style.display = 'none';

}

function AdminLogin()
{
	var login = document.frmlogin.txtLogin.value;
	var pass  = document.frmlogin.txtPassword.value;
	if(login=='')
	{
		alert("Please enter user name.");
		document.frmlogin.txtLogin.focus();
		return false;
	}
	if(pass=='')
	{
		alert("Please enter password.");
		document.frmlogin.txtPassword.focus();
		return false;
	}	
	return true;
}

function UserLogin()
{
	var login = document.frmlogin.txtLogin.value;
	var pass  = document.frmlogin.txtPassword.value;
	if(login=='')
	{
		alert("Please enter user name.");
		document.frmlogin.txtLogin.focus();
		return false;
	}
	if(pass=='')
	{
		alert("Please enter password.");
		document.frmlogin.txtPassword.focus();
		return false;
	}	
	return true;
}


function showImage(imgId)
{
	var NumberOfLagreImages = document.largeImage.length;

	for(var counter =0; counter < NumberOfLagreImages; counter++)
	{
		document.largeImage[counter].style.display = 'none';
	}

	if(imgId != '')
	{
		var objImage = document.getElementById(imgId);
	}
	else
	{
		var objImage = document.getElementById('img1');
	}

	objImage.style.display = 'inline';

}

function isCharsInBag (s, bag)
{
    var i;
    // Search through string's characters one by one.
    // If character is in bag, append to returnString.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) return(false);
    }
    return true;
}
  
function isValidChar(testingStr, userStr)
{
	var condition = true; 

	for(counter=0; counter < testingStr.length; counter++)
	{
		if(testingStr.indexOf(userStr.charAt(counter)) == -1)
		{
			condition = false;
		}
	}
	
	return condition;
}
/*
function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
		  {
		  alert(alerttxt);
		  return false
		  }
		else {
		return true
		}
	}
}


function validate_form(thisform)
{
with (thisform)
{
if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false}
}
}

*/

function EmailCheck(email){
		
		if(email.value==''){
			alert("Please Enter Email Address");
            email.focus();            
            return false;
		}
		if ( !this.isCharsInBag( email.value, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._@-" ))
		{
		      
            alert("Invalid Email Address");
            email.focus();            
            return false;
		}
	
	if(email.value != '')
	   {
		var str=email.value;	
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		var sdot=str.indexOf(dot,ldot+1);

		if (str.indexOf(at)==-1){
			alert("Invalid Email Address");
            email.focus();            
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			alert("Invalid Email Address");
            email.focus();            
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			alert("Invalid Email Address");
            email.focus();            
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
			alert("Invalid Email Address");
            email.focus();            
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			alert("Invalid Email Address");
            email.focus();            
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
			alert("Invalid Email Address");
            email.focus();            
		    return false;
		 }
		if (str.substring(ldot+1)==''){
			alert("Invalid Email Address");
            email.focus();            
		    return false;
		 }
		 if (str.substring(sdot+1)==''){
			alert("Invalid Email Address");
            email.focus();            
		    return false;
		 }
		 if (str.indexOf(" ")!=-1){
			alert("Invalid Email Address");
            email.focus();            
		    return false;
		 }
		 if(str.lastIndexOf(".") == str.length-1)
		 {
		 	alert("Invalid Email Address");
            email.focus();            
		    return false;
		 }
	}//end of else
	return true;
}


function ContactUsValidation()
{
	var name = document.frmcontactus.txtname;
	var surname = document.frmcontactus.txtsurname;
	var address = document.frmcontactus.txtaddress;
	var county = document.frmcontactus.txtcounty;
	var postcode = document.frmcontactus.txtpostcode;
	var email = document.frmcontactus.txtemail;
	var dayphone = document.frmcontactus.txtdayphone;
	//var evephone = document.frmcontactus.txtevephone;
	//var mobile = document.frmcontactus.txtmobile;
	var pricerange = document.frmcontactus.cmbpricerange;
	var numofbedrooms = document.frmcontactus.txtnofbedrooms;
	var findus = document.frmcontactus.cmbfindus;
	var pleasestate = document.frmcontactus.txtpleasestate;
	
	if (name.value == "")
	{
		alert("Please Fill the 'Name' field");
		name.focus();
		return false;
	}
	
	
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", name.value))
	{
		alert("Name fields only allow alphabet characters");
		name.select();
		return false;
	}
	
	if (surname.value == "")
	{
		alert("Please Fill the 'Surname' field");
		surname.focus();
		return false;
	}
	
	
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", surname.value))
	{
		alert("Name fields only allow alphabet characters");
		surname.select();
		return false;
	}
	
	if (address.value == "")
	{
		alert("Please Fill the 'Address' field");
		address.focus();
		return false;
	}
	
	if (county.value == "")
	{
		alert("Please Fill the 'County' field");
		county.focus();
		return false;
	}
	
	if (postcode.value == "")
	{
		alert("Please Fill the 'Postcode' field");
		postcode.focus();
		return false;
	}
	
	if(!this.EmailCheck(email))
	{
		return  false;
	}
		
	if (dayphone.value == "")
	{
		alert("Please Fill the 'Land telephone' field");
		dayphone.focus();
		return false;
	}
	
//	if (evephone.value == "")
//	{
//		alert("Please Fill the 'Evening telephone' field");
//		evephone.focus();
//		return false;
//	}

//	if (mobile.value == "")
//	{
//		alert("Please Fill the 'Mobile telephone' field");
//		mobile.focus();
//		return false;
//	}
//	
	if (pricerange.value == "")
	{
		alert("Please Fill the 'Price range' field");
		pricerange.focus();
		return false;
	}

	if (numofbedrooms.value == "")
	{
		alert("Please Fill the 'Number of bedrooms' field");
		numofbedrooms.focus();
		return false;
	}
	
	if (findus.value == "")
	{
		alert("Please Fill the 'How did you find us?' field");
		findus.focus();
		return false;
	}
	if (pleasestate.value == "")
	{
		alert("Please Fill the 'How did you find us? - Please State' field");
		pleasestate.focus();
		return false;
	}
	return true;
}

function RegisterValidation2()
{
	var name = document.frmcontactus.txtname;
	var address = document.frmcontactus.txtaddress;
	var county = document.frmcontactus.txtcounty;
	var postcode = document.frmcontactus.txtpostcode;
	var email = document.frmcontactus.txtemail;
	var dayphone = document.frmcontactus.txtdayphone;
	//var evephone = document.frmcontactus.txtevephone;
	var mobile = document.frmcontactus.txtmobile;
	//var numofbedrooms = document.frmcontactus.txtnofbedrooms;
	
	if (name.value == "")
	{
		alert("Please Fill the 'Name' field");
		name.focus();
		return false;
	}
	
	
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", name.value))
	{
		alert("Name fields only allow alphabet characters");
		name.select();
		return false;
	}
	
	if (address.value == "")
	{
		alert("Please Fill the 'Address' field");
		address.focus();
		return false;
	}
	
	if (county.value == "")
	{
		alert("Please Fill the 'County' field");
		county.focus();
		return false;
	}
	
	if (postcode.value == "")
	{
		alert("Please Fill the 'Postcode' field");
		postcode.focus();
		return false;
	}
	
	if(!this.EmailCheck(email))
	{
		return  false;
	}

	
	
	if (dayphone.value == "")
	{
		alert("Please Fill the 'Daytime telephone' field");
		dayphone.focus();
		return false;
	}
	
	if (evephone.value == "")
	{
		alert("Please Fill the 'Evening telephone' field");
		evephone.focus();
		return false;
	}
	
	if (mobile.value == "")
	{
		alert("Please Fill the 'Mobile telephone' field");
		mobile.focus();
		return false;
	}
	
	if (numofbedrooms.value == "")
	{
		alert("Please Fill the 'Number of bedrooms' field");
		numofbedrooms.focus();
		return false;
	}
	
	if (!isValidChar("0123456789", numofbedrooms.value))
	{
		alert("Invalid Characters");
		numofbedrooms.select();
		return false;
	}	
	
	return true;

}


var kwRegSub=0;
// my address finder code start here
function pcaFastAddressBegin(postcode, building, language, style, account_code, license_code, machine_id, options)
{
   var scriptTag = document.getElementById("pcaScriptTag");
   var headTag = document.getElementsByTagName("head").item(0);
   var strUrl = "";
   //Build the url
//	fetch
   strUrl = "http://services.postcodeanywhere.co.uk/inline.aspx?";
   strUrl += "&action=fetch";
   strUrl += "&postcode=" + escape(postcode);
   strUrl += "&building=" + escape(building);
   strUrl += "&language=" + escape(language);
   strUrl += "&style=" + escape(style);
   strUrl += "&account_code=" + escape(account_code);
   strUrl += "&license_code=" + escape(license_code);
   strUrl += "&machine_id=" + escape(machine_id);
   strUrl += "&options=" + escape(options);
   strUrl += "&callback=pcaFastAddressEnd";

   //Make the request
   if (scriptTag) 
   {
      headTag.removeChild(scriptTag);
   }
   scriptTag = document.createElement("script");
   scriptTag.src = strUrl
   scriptTag.type = "text/javascript";
   scriptTag.id = "pcaScript";
   headTag.appendChild(scriptTag);
   
//   setTimeout("if(kwRegSub==0){pcaFastAddressEnd();}", 5000);
}

function UpdateProfileValidation()
{
	var surname = document.frmupdateprofile.txtsurname;
	var firstname = document.frmupdateprofile.txtfirstname;
	var lastname = document.frmupdateprofile.txtlastname;
	var username = document.frmupdateprofile.txtuser;
	var oldpass = document.frmupdateprofile.txtoldpassword;
	var newpass = document.frmupdateprofile.txtnewpassword;
	var confpass = document.frmupdateprofile.txtconfpassword;
	
	
	
	if (surname.value=="")
	{
		alert("Please enter 'Sur Name'.");
		surname.select();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", surname.value))
	{
		alert("Name fields only allow alphabet characters");
		surname.select();
		return false;
	}
		
	if (firstname.value=="")
	{
		alert("Please enter 'First Name'.");
		firstname.select();
		return false;
	}
	else if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", firstname.value))
	{
		alert("Name fields only allow alphabet characters");
		firstname.select();
		return false;
	}
	
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", lastname.value))
	{
		alert("Name fields only allow alphabet characters");
		lastname.select();
		return false;
	}
	if (username.value=="")
	{
		alert("Please enter 'User Name'.");
		username.select();
		return false;
	}	
	if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", username.value))
	{
		alert("Please neter correct username.");
		username.select();
		return false;
	}	
	if(oldpass.value != "" )
	{
		
		if (!isValidChar("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", newpass.value))
		{
			alert("You entered an invalid character");
			newpass.select();
			return false;
		}
		
		if (!isValidChar("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", confpass.value))
		{
			alert("You entered an invalid character");
			confpass.select();
			return false;
		}
		
		if(newpass.value != confpass.value)
		{
			alert('Your new password and confirm password fields do not match.');
			newpass.select();
			return false;
		}
					
	}
			
	return true;	
}

function Forgotpassword()
{
	var email = document.frmforgotpassword.txtforgotemail;
	
	if(!this.EmailCheck(email))
	{
		return false ;
	}
		
	return true;	
	
}


function ReferToFriend()
{
	var email = document.frmrefertofriend.txtemail;
	
	if(!this.EmailCheck(email))
	{
		return false ;
	}
		
	return true;	
	
}

function divShowhide(chkDiv)
{
	objDiv = document.getElementById(chkDiv);
		
	if (objDiv.style.display == 'none')
	{
		objDiv.style.display = 'inline';
	}
	else if (objDiv.style.display == 'inline')
	{
		objDiv.style.display = 'none';
	}
}
function divShow(chkDiv)
{
	objDiv = document.getElementById(chkDiv);
	if(objDiv!=null)	
		if (objDiv.style.display == 'none')
		{
			objDiv.style.display = 'inline';
		}
}	
function divHide(chkDiv)
{
	objDiv = document.getElementById(chkDiv);
	if(objDiv!=null)
		if (objDiv.style.display == 'inline')
		{
			objDiv.style.display = 'none';
		}
}	


function pcaFastAddressEnd()
{kwRegSub=1;
   //Test for an error
   if (pcaIsError)
      {
         //Show the error message
         //alert(pcaErrorMessage);
		 //return false;
      }
   else
      {
         //Check if there were any items found
         if (pcaRecordCount==0)
            {
             //  alert("Sorry, no matching items found");
			 //  return false;
            }
         else
            {
			   document.getElementById("company").value	=	pca_organisation_name[0];
               document.getElementById("line1").value	=	pca_line1[0];
               document.getElementById("line2").value	=	pca_line2[0];
               document.getElementById("line3").value	=	pca_line3[0];
               document.getElementById("town").value		=	pca_post_town[0];
               document.getElementById("county").value	=	pca_county[0];
               document.getElementById("postcode").value	= 	pca_postcode[0];
			//id,seq,organisation_name,department_name,line1,line2,line3,line4,line5,post_town,county,postcode,mailsort,barcode,is_residential,is_small_organisation,is_large_organisation,admin_county,traditional_county,postal_county,delivery_point_suffix,checksum,name_or_number,sub_building_name,building_name,building_number,thoroughfare_name,thoroughfare_descriptor,dependent_thoroughfare_name,dependent_thoroughfare_descriptor,double_dependent_locality,dependent_locality,po_box_number,number_of_households,concatenation_operator,building_name_or_number,building_flat,reformatted_sub_building,reformatted_building_number,reformatted_building_name
	  
            }
      }
var name = document.frmyourdetails.txtname;
var surname = document.frmyourdetails.txtsurname;
var email = document.frmyourdetails.txtemail;
var postcode = document.frmyourdetails.postcode;
var building = document.frmyourdetails.building;


if (name.value == "")
{
	alert("Please Fill the 'Name' field");
	name.focus();
	return false;
}


if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", name.value))
{
	alert("Name fields only allow alphabet characters");
	name.select();
	return false;
}

if (surname.value == "")
{
	alert("Please Fill the 'Surname' field");
	surname.focus();
	return false;
}


if (!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ", surname.value))
{
	alert("Name fields only allow alphabet characters");
	surname.select();
	return false;
}


if(!this.EmailCheck(email))
{
	return false ;
}

if (postcode.value == "")
{
	alert("Please Fill the 'Postcode' field");
	postcode.focus();
	return false;
}

if (building.value == "")
{
	alert("Please Fill the 'Building/Door' field");
	building.focus();
	return false;
}

document.frmyourdetails.submit();
	
}

var hWnd
function OpenNewWindow( passurl , width, height, left, top)
{
	//var x = screen.availWidth/2-200;
//	var x = (screen.availWidth-width);
//	var y = 150;

	var x = left;
	var y = top;

	enterCalled = true
	window.name = "parent"
	var url = passurl
	if( !hWnd )
	{
		//if no help window is open then open a new help window and give it focus
		hWnd = window.open(url,"popup","width=" + width + ",height=" + height +", left=" + x + ", top=" + y + ", resizable=yes,scrollbars=yes")
		hWnd.focus()
	}
	else if ( hWnd.closed ) 
	{
		//if no help window is open then open a new help window and give it focus
		hWnd = window.open(url,"popup","width=" + width + ",height=" + height +", left=" + x + ", top=" + y + ", resizable=yes,scrollbars=yes")
		hWnd.focus()
	}
	else
	{
		//if the help window is already open then update it and give it focus
		hWnd.location=url
		hWnd.focus()
	}
	// handle Navigator 2, which doesn't have an opener property
	if (!hWnd.opener) { hWnd.opener = window}
}
function YourdetailsValidation(from)
{
	var obj = document.getElementById("title");
	if (obj.value=="")
	{
		alert("Please enter 'Title'.");
		obj.focus();
		return false;
	}

	var obj = document.getElementById("name");
	if (obj.value=="")
	{
		alert("Please enter 'First Name'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Name' field contain invalid characters");
		obj.select();
		return false;
	}	
	var obj = document.getElementById("lname");
	if (obj.value=="")
	{
		alert("Please enter 'Sur Name'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Name' field contain invalid characters");
		obj.select();
		return false;
	}	
	
	var obj = document.getElementById("address");
	if (obj.value=="")
	{
		alert("Please enter 'Address'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><:,.: ", obj.value))
	{
		alert("'Address' field contain invalid characters");
		obj.select();
		return false;
	}	
	var obj = document.getElementById("city");
	if (obj.value=="")
	{
		alert("Please enter 'City'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'City' field contain invalid characters");
		obj.select();
		return false;
	}
	var obj = document.getElementById("country");
	if (obj.value=="")
	{
		alert("Please enter 'Country'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Country' field contain invalid characters");
		obj.select();
		return false;
	}
	var obj = document.getElementById("postcode");
	if (obj.value=="")
	{
		alert("Please enter 'Postcode'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Postcode' field contain invalid characters");
		obj.select();
		return false;
	}
	var obj = document.getElementById("dayphone");
	if (obj.value=="")
	{
		alert("Please enter 'Day Phone'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-, ", obj.value))
	{
		alert("'Day Phone' field contain invalid characters");
		obj.select();
		return false;
	}
	var obj = document.getElementById("mobphone");
	if (obj.value=="")
	{
		alert("Please enter 'Mobile Phone'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("1234567890-", obj.value))
	{
		alert("'Mobile Phone' field contain invalid characters");
		obj.select();
		return false;
	}
	var obj = document.getElementById("price_range");
	if (obj.value=="" || obj.value=="0" )
	{
		alert("Please select 'Price Range'.");
		obj.focus();
		return false;
	}
	var obj = document.getElementById("beds");
	if (obj.value=="")
	{
		alert("Please select 'No of Beds'.");
		obj.focus();
		return false;
	}
//	if(from=="nfp")
//	{
		if(document.getElementById('radiolocalad').checked == true && document.getElementById('localad').value == "" ){
			alert("'Local ad - Please state' is required.");
			return false;
		}else if(document.getElementById('radionationalad').checked == true && document.getElementById('nationalad').value == "" ){
			alert("'National ad - Please state' is required.");
			return false;
		}else if(document.getElementById('radioother').checked == true && document.getElementById('other').value == "" ){
			alert("'Other - Please state' is required.");
			return false;
		}else if(document.getElementById('radiosearchengine').checked == true && document.getElementById('searchengine').value == "" ){
			alert("'Search engine - Please state' is required.");
			return false;
		}	
//	} // end of if(from=="nfp")
	
//	if(from=="fp")
//	{
		var obj = document.getElementById("email");
		if(!this.EmailCheck(obj))
		{
			return  false;
		}
		var obj = document.getElementById("password");
		if (obj.value=="")
		{
			alert("Please enter 'Password'.");
			obj.focus();
			return false;
		}
		else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
		{
			alert("'Password' field contain invalid characters");
			obj.select();
			return false;
		}	
//	} // end of task=="fp"
	return true;
}
function YourdetailsNPValidation()
{
	var obj = document.getElementById("title");
	if (obj.value=="")
	{
		alert("Please enter 'Title'.");
		obj.focus();
		return false;
	}

	var obj = document.getElementById("name");
	if (obj.value=="")
	{
		alert("Please enter 'First Name'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Name' field contain invalid characters");
		obj.select();
		return false;
	}	
	var obj = document.getElementById("lname");
	if (obj.value=="")
	{
		alert("Please enter 'Sur Name'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Name' field contain invalid characters");
		obj.select();
		return false;
	}	
	var obj = document.getElementById("postcode");
	if (obj.value=="")
	{
		alert("Please enter 'Postcode'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Postcode' field contain invalid characters");
		obj.select();
		return false;
	}
	var obj = document.getElementById("email");
	if(!this.EmailCheck(obj))
	{
		return  false;
	}
	return true;
}
function yourexistingdetailsValidation()
{
	var obj = document.getElementById("email");
	if(!this.EmailCheck(obj))
	{
		return  false;
	}
	
	var obj = document.getElementById("username");
	if (obj.value=="")
	{
		alert("Please enter 'Username'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Username' field contain invalid characters");
		obj.select();
		return false;
	}	
	var obj = document.getElementById("password");
	if (obj.value=="")
	{
		alert("Please enter 'Password'.");
		obj.focus();
		return false;
	}
	else if(!isValidChar("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`!@#$%^&*()_-+=|\/><: ", obj.value))
	{
		alert("'Password' field contain invalid characters");
		obj.select();
		return false;
	}	
	return true;
}