// === Validation Functions === //
function jfIsValid( sValue, strValidChars  ) {
	var isValid = new Boolean()
	isValid=true
	var myChar=""
	var myInt=0

	if (sValue!="" && typeof(sValue)=="string") {
		for (i=0;i<sValue.length;i++) {
			myChar=sValue.charAt(i)
			myInt=strValidChars.indexOf(myChar)

			if (myInt == -1) {
				isValid=false
				break;
			}
		}
	}
	else {
		isValid=false
	}

	return isValid
}

function jfIsDate(data,datename)
{

// function created : 31.12.03
// created by 		: Farrakh Aslam
// input paramaters : data     - the formname
//datename - the fieldname specified when calling the vbscript date box function
// description      : Can be used to validate any of the vbscript date box functions
data = "document." + data + "."

var day   = eval( data + datename + "_d.value")
var month = eval( data + datename + "_m.value")
var year  = eval( data + datename + "_y.value")

var calcYear = (year % 4 == 0)
if (!calcYear)
	{
	leapDays = 28
	}
else
	{
	leapDays = 29
	}

if (month == 02)
	{
	if (day > leapDays)
	   {
	   return false;
	   }


	}
else if (month == 04 || month == 06 || month == 09 || month == 11)
	{
	if (day > 30)
	   {
	   return false;
	   }

	}
return true;
}


function jfIsEmail(incoming) {
	var emailstring = incoming;
	var ampIndex = emailstring.indexOf("@");
	var afterAmp = emailstring.substring((ampIndex + 1), emailstring.length);
		// find a dot in the portion of the string after the ampersand only
	var dotIndex = afterAmp.indexOf(".");
		// determine dot position in entire string (not just after amp portion)
	dotIndex = dotIndex + ampIndex + 1;
		// afterAmp will be portion of string from ampersand to dot
	afterAmp = emailstring.substring((ampIndex + 1), dotIndex);
		// afterDot will be portion of string from dot to end of string
	var afterDot = emailstring.substring((dotIndex + 1), emailstring.length);
	var beforeAmp = emailstring.substring(0,(ampIndex));

	var email_regex = /^\w(?:\w|-|\.(?!\.|@))*@\w(?:\w|-|\.(?!\.))*\.\w{2,3}/
		// index of -1 means "not found"
	if ((emailstring.indexOf("@") != "-1") &&
		(emailstring.length > 5) &&
		(afterAmp.length > 0) &&
		(beforeAmp.length > 1) &&
		(afterDot.length > 1) &&
		(email_regex.test(emailstring)) ) {
		  return true;
	} else {
			return false;
	}
}

function jfIsPhoneNum( sValue ) {
	var isPhoneNum = new Boolean()
	isPhoneNum=true
	var myChar=""
	var myInt=0
	var strValidChars = "0123456789";

	if (sValue!="" && typeof(sValue)=="string") {
		for (i=0;i<sValue.length;i++) {
			myChar=sValue.charAt(i)
			myInt=strValidChars.indexOf(myChar)

			if (myInt == -1) {
				isPhoneNum=false
			}
		}

	} else {
		isPhoneNum=false
	}

	return isPhoneNum
}

function jfIsInt( sValue ) {
	var isInteger = new Boolean()
	isInteger=true
	var myChar=""
	var myInt=0

	if (sValue!="" && typeof(sValue)=="string") {
		for (i=0;i<sValue.length;i++) {
			myChar=sValue.charAt(i)
			myInt=parseInt(myChar)

			if (isNaN(myInt)) {
				isInteger=false
			}
		}

	} else {
		isInteger=false
	}

	return isInteger
}


function jfIsDecimal( sValue ) {
	var isPhoneNum = new Boolean()
	isDecimal=true
	var myChar=""
	var myInt=0
	var strValidChars = "0123456789.";

	if (sValue!="" && typeof(sValue)=="string") {
		for (i=0;i<sValue.length;i++) {
			myChar=sValue.charAt(i)
			myInt=strValidChars.indexOf(myChar)

			if (myInt == -1) {
				isDecimal=false
			}
		}

	} else {
		isDecimal=false
	}

	return isDecimal
}

function jsearch(){

	frm = document.frmSearch
	//frm.action='search.asp'; 
	frm.submit();
}

function jrefine( iEventType ){

	frm = document.frmSearch
	if (iEventType == 1){
		frm.action = "lettings_search.asp"
	}
	else{
		frm.action = "sales_search.asp"
	}
	frm.txtMode.value = 1
	frm.submit();
}

function jdirectory( iLevel, iLocation ){

	iNode = "dir_" + iLevel + "_" + iLocation
	sImage = "img_" + iLevel + "_" + iLocation

	if (document.getElementById(iNode).style.display=="none"){
		document.getElementById(iNode).style.display="";
		document.getElementById(sImage).src="images/btn_minus.gif";
	}
	else{
		document.getElementById(iNode).style.display="none";
		document.getElementById(sImage).src="images/btn_plus.gif";
	}
}

function jnavigate( iEventType, iPage ){

	frm = document.frmSearch
	if (iEventType == 1){
		frm.action = "lettings_search.asp"
	}
	else{
		frm.action = "sales_search.asp"
	}
	
	frm.txtEvent.value = 0
	iMaxPage = frm.txtMaxPage.value
	if ( iPage == 0 ){
		iPage = 1
	}
	else if ( iPage >= iMaxPage ){
		iPage = iMaxPage
	}
	frm.txtPage.value = iPage
	frm.submit();
}

function jfulldetails( iEvent ){
	
	frm = document.frmSearch

	frm.txtEvent.value = iEvent
	frm.target="_blank"
	frm.submit();
}

function jnavigateproperty( iEvent ){
	
	frm = document.frmSearch

	frm.txtEvent.value = iEvent
	frm.submit();
}

function jswapimage( sRoot, iProperty, iImage, iRnd ){

	document.getElementById("img_main").src = sRoot + 'property/' + iProperty + '/' + iImage + '.jpg?' + iRnd;
}


function jcalculate1(){

	frm = document.frmCalculator1
	iAmmount = frm.txtAmmount.value
	iYear = frm.txtYear.value
	iRate = frm.txtRate.value

	//iAmmount = 225000
	//iYear = 30
	//iRate = 7.8

	if (iAmmount == ""){
		alert("Please enter the loan ammount.")
		frm.txtAmmount.focus()
		return;
	}
	else if (jfIsInt(iAmmount) == false){
		alert("Please enter a numeric value for the loan ammount.")
		frm.txtAmmount.focus()
		return;
	}

	if (iYear == ""){
		alert("Please enter the repayment period.")
		frm.txtYear.focus()
		return;
	}
	else if (jfIsInt(iYear) == false){
		alert("Please enter a numeric value for the repayment period.")
		frm.txtYear.focus()
		return;
	}

	if (iRate == ""){
		alert("Please enter the interest rate.")
		frm.txtRate.focus()
		return;
	}
	else if (jfIsDecimal(iRate) == false){
		alert("Please enter a numeric value for the interest rate.")
		frm.txtRate.focus()
		return;
	}

	iInterest = eval(((iAmmount/100)*iRate)/12)
	iInterest = Math.round(iInterest*100)/100
	document.getElementById("divInterest1").innerHTML = "£" + iInterest


	iRepayment = eval( ( ((iRate/100)/12) *iAmmount ) / (1 - Math.pow( (1+((iRate/100)/12) ), -(iYear*12) ) ) )
	iRepayment = Math.round(iRepayment*100)/100
	document.getElementById("divRepayment1").innerHTML = "£" + iRepayment
}

function jclear1(){

	frm = document.frmCalculator1
	frm.txtAmmount.value = ""
	frm.txtYear.value = ""
	frm.txtRate.value = ""
}

function jcalculate2 (){

	frm = document.frmCalculator2

	iOutstanding = frm.txtOutstanding.value
	iInterest = frm.txtInterest.value
	iRecalculation = frm.optRecalculation.value
	iYear = frm.txtYear.value
	iPayment = frm.txtPayment.value

	if (iOutstanding == ""){
		alert("Please enter the outstanding balance of loan.")
		frm.txtOutstanding.focus()
		return;
	}
	else if (jfIsInt(iOutstanding) == false){
		alert("Please enter a numeric value for the outstanding balance of loan.")
		frm.txtOutstanding.focus()
		return;
	}

	if (iInterest == ""){
		alert("Please enter the new interest rate.")
		frm.txtInterest.focus()
		return;
	}
	else if (jfIsDecimal(iInterest) == false){
		alert("Please enter a numeric value for the new interest rate.")
		frm.txtInterest.focus()
		return;
	}

	if (iYear == ""){
		alert("Please enter the years remaining.")
		frm.txtYear.focus()
		return;
	}
	else if (jfIsInt(iYear) == false){
		alert("Please enter a numeric value for the years remaining.")
		frm.txtYear.focus()
		return;
	}

	if (iPayment == ""){
		alert("Please enter the current monthly payments.")
		frm.txtPayment.focus()
		return;
	}
	else if (jfIsDecimal(iPayment) == false){
		alert("Please enter a numeric value for the current monthly payments.")
		frm.txtPayment.focus()
		return;
	}

	var D4, D5, D6, D12, D7, D9;
	var Topform,Botform, x, y;


	D4 = iOutstanding;
	D5 = iInterest/100;


	D12 = iRecalculation
	D7 = iYear;
	D9 = iInterest;

	Topform = D4*(D5/12);
	x=(1+(D5/D12));
	y=((D7*D12)*-1);
	Botform = 1-Math.pow(x,y);
	document.getElementById("divNewRepayment2").innerHTML = "£" +  (Math.round(100*Topform/Botform))/100;
	document.getElementById("divDifference2").innerHTML = "£" +  (Math.round(100*((Topform/Botform) - iPayment)))/100;
}

function jclear2(){

	frm = document.frmCalculator2
	
	frm.txtOutstanding.value = ""
	frm.txtInterest.value = ""
	frm.optRecalculation.value = ""
	frm.txtYear.value = ""
	frm.txtPayment.value = ""
}

function jcalculate3 (){

	frm = document.frmCalculator3

	iOutstanding = frm.txtOutstanding.value
	iInterest1 = frm.txtInterest1.value
	iInterest2 = frm.txtInterest2.value

	if (iOutstanding == ""){
		alert("Please enter the outstanding balance of loan.")
		frm.txtOutstanding.focus()
		return;
	}
	else if (jfIsInt(iOutstanding) == false){
		alert("Please enter a numeric value for the outstanding balance of loan.")
		frm.txtOutstanding.focus()
		return;
	}

	if (iInterest1 == ""){
		alert("Please enter the current interest rate.")
		frm.txtInterest1.focus()
		return;
	}
	else if (jfIsDecimal(iInterest1) == false){
		alert("Please enter a numeric value for the current interest rate.")
		frm.txtInterest1.focus()
		return;
	}
	
	if (iInterest2 == ""){
		alert("Please enter the new interest rate.")
		frm.txtInterest2.focus()
		return;
	}
	else if (jfIsDecimal(iInterest2) == false){
		alert("Please enter a numeric value for the new interest rate.")
		frm.txtInterest2.focus()
		return;
	}

	var B2,B4,B6;

	B2 = iOutstanding;
	B4 = iInterest1/100;
	B6 = iInterest2/100;
	B7 = (Math.round(B2*B4*100/12))/100;
	B8 = (Math.round(B2*B6*100/12))/100;
	document.getElementById("divCurrentRepayment3").innerHTML = "£" + B7
	document.getElementById("divNewRepayment3").innerHTML = "£" + B8
	document.getElementById("divDifference3").innerHTML = "£" + (Math.round((B8-B7)*100))/100;
}

function jclear3(){

	frm = document.frmCalculator3
	
	frm.txtOutstanding.value = ""
	frm.txtInterest1.value = ""
	frm.txtInterest2.value = ""
	
}

 function jmenuopen(iLink,iTotal){

	
	for (i=1;i<=iTotal;i++) {
		
		sClass="menu-tab-u" 
		
		t=document.getElementById("menu_" + i);
		o=document.getElementById("tab_" + i);
		t.style.display="none";
				
		if ( iLink+1 == i)
			sClass = sClass + "-sh"
		if ( iTotal == i)
			sClass = sClass + "-e"
			
		
		o.className = sClass
	}

	sClass = "menu-tab-s"
	if ( iTotal == iLink)
		sClass = sClass + "-e"

	t=document.getElementById("menu_" + iLink);
	t.style.display = "block";
	
	o=document.getElementById("tab_" + iLink);
	o.className = sClass
 }
 
 function jmenuclick(iLink,iSubLink,sAction){
 	
 	frm = document.frmMenu
 	
 	frm.optLink.value = iLink
 	frm.optSubLink.value = iSubLink
 	frm.action = sAction
 	frm.submit();
 }

function jsearchbycounty(iForm, iMode){

	frm = eval("document.frmSearch" + iForm)
	
	if (frm.optCounty.value == 0){
		alert("Please select a county.")
		frm.optCounty.focus()
		return;
	}

	if (iMode == 0){
		iMode = jsearchbycountymode(iForm)
	}
	
	frm.txtMode.value = iMode
	//alert(frm.txtMode.value)
	frm.submit()
}

function jsearchbycountymode(iForm){

	frm = eval("document.frmSearch" + iForm)
	radMode = frm.radMode
	if(!radMode)
		return "";
	var radioLength = radMode.length;
	if(radioLength == undefined)
		if(radMode.checked)
			return radMode.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radMode[i].checked) {
			return radMode[i].value;
		}
	}
	return "";

}

function jsubmitcontactus(){
	frm = document.frmContactUs
	var iError = -1
	cssNormal = "textnormal"
	cssRequired =  'textred'
	cssInvalid =  'textblue'

	sAlpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz- '()"


	// Branch //
	if (frm.optBranch.value == 0){
		if ( iError == -1 ){ frm.optBranch.focus()}
		iError = 1
		document.getElementById( 'tr_1' ).className = cssRequired
		alert("Please select a branch.")
		return;
	}
	else {
		document.getElementById( 'tr_1' ).className = cssNormal
	}

	// First Name //
	if (frm.optBranch.value ==""){
		if ( iError == -1 ){ frm.optBranch.focus()}
		iError = 1
		document.getElementById( 'tr_1' ).className = cssRequired
		alert("Please enter your name.")
		return;
	}
	else if (frm.txtName.value.length < 3){
		if ( iError == -1 ){ frm.txtName.focus()}
		iError = 1
		document.getElementById( 'tr_1' ).className = cssInvalid
		alert("Your name must be greater than 3 characters in length.")
		return;
	}
//	else if (jfIsValid (frm.txtName.value, sAlpha) == false){
//		if ( iError == -1 ){frm.txtName.focus()}
//		iError = 1
//		document.getElementById( 'tr_1' ).className = cssInvalid
//		alert("Your name must contain alphabetic characters only.")
//		return;
//	}
	else {
		document.getElementById( 'tr_1' ).className = cssNormal
	}

	// Email Address //
//	if ( frm.txtEmail.value == ""){
//		if ( iError == -1 ){ frm.txtEmail.focus()}
//		iError = 8
//		document.getElementById( 'tr_4' ).className = cssRequired
//		alert("Please enter your email address.")
//		return;
//	}
//	else if ( jfIsEmail(frm.txtEmail.value) == false){
//		if ( iError == -1 ){ frm.txtEmail.focus()}
//		iError = 8
//		document.getElementById( 'tr_4' ).className = cssInvalid
//		alert("Please enter a valid email address.")
//		return;
//	}
//	else {
//		document.getElementById( 'tr_4' ).className = cssNormal
//	}

	//===Submit form if no errors found ===/

	if ( iError == -1 ){
		frm.submit();
	}
}


function jsubmitmortgage(){
	frm = document.frmMortgage
	var iError = -1
	cssNormal = "textnormal"
	cssRequired =  'textred'
	cssInvalid =  'textblue'

	sAlpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz- '()"

	// Enquring About //
	if (frm.optBranch.value == 0){
		alert("Please select a branch.")
		frm.optBranch.focus();
		return;
	}
	
	// Enquring About //
	if (frm.optQ1.value == 0){
		alert("Please select what you are enquiring about.")
		frm.optQ1.focus();
		return;
	}

	
	// First Name //
	if (frm.txtFirstName.value ==""){
		alert("Please enter your first name.")
		frm.txtFirstName.focus();
		return;
	}
	else if (frm.txtFirstName.value.length < 3){
		alert("Your first name must be greater than 3 characters in length.")
		frm.txtFirstName.focus();
		return;
	}
	else if (jfIsValid (frm.txtFirstName.value, sAlpha) == false){
		alert("Your first name must contain alphabetic characters only.")
		frm.txtFirstName.focus();
		return;
	}

	// First Name //
	if (frm.txtLastName.value ==""){
		alert("Please enter your last name.")
		frm.txtLastName.focus();
		return;
	}
	else if (frm.txtLastName.value.length < 3){
		alert("Your last name must be greater than 3 characters in length.")
		frm.txtLastName.focus();
		return;
	}
	else if (jfIsValid (frm.txtLastName.value, sAlpha) == false){
		alert("Your last name must contain alphabetic characters only.")
		frm.txtLastName.focus();
		return;
	}
	
	// Daytime Telephone //
	if (frm.txtTel1.value == ""){
		alert("Please enter your daytime telephone number.")
		frm.txtTel1.focus();
		return;
	}
	else if (frm.txtTel1.value.length < 9){
		alert("Please enter a valid daytime telephone number.")
		frm.txtTel1.focus();
		return;		
	}

	// Email Address //
	if ( frm.txtEmail.value == ""){
		alert("Please enter your email address.");
		frm.txtEmail.focus();
		return;
	}
	else if ( jfIsEmail(frm.txtEmail.value) == false){
		alert("Please enter a valid email address.")
		frm.txtEmail.focus();
		return;
	}

	frm.submit();

}


// register

function jregister(){

	frm = document.frmRegister
	var iError = -1
	cssNormal = "textnormal"
	cssRequired =  'textred'
	cssInvalid =  'textblue'

	sAlpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz- '()"
	sAlphaNumeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"

	// Title //
	if (frm.optTitle.value == 0){
		alert("Please select your title.")
		frm.optTitle.focus();
		return;
	}

	
	// First Name //
	if (frm.txtFirstName.value ==""){
		alert("Please enter your first name.")
		frm.txtFirstName.focus();
		return;
	}
	else if (frm.txtFirstName.value.length < 2){
		alert("Your first name must be greater than 2 characters in length.")
		frm.txtFirstName.focus();
		return;
	}
	else if (jfIsValid (frm.txtFirstName.value, sAlpha) == false){
		alert("Your first name must contain alphabetic characters only.")
		frm.txtFirstName.focus();
		return;
	}

	// Last Name //
	if (frm.txtLastName.value ==""){
		alert("Please enter your last name.")
		frm.txtLastName.focus();
		return;
	}
	else if (frm.txtLastName.value.length < 2){
		alert("Your last name must be greater than 2 characters in length.")
		frm.txtLastName.focus();
		return;
	}
	else if (jfIsValid (frm.txtLastName.value, sAlpha) == false){
		alert("Your last name must contain alphabetic characters only.")
		frm.txtLastName.focus();
		return;
	}
	
	// Contact Telephone //
	if (frm.txtTel.value == ""){
		alert("Please enter your contact telephone number.")
		frm.txtTel.focus();
		return;
	}
	else if (frm.txtTel.value.length < 9){
		alert("Please enter a valid contact telephone number.")
		frm.txtTel.focus();
		return;		
	}

	// Email Address //
	if ( frm.txtEmail.value == ""){
		alert("Please enter your email address.");
		frm.txtEmail.focus();
		return;
	}
	else if ( jfIsEmail(frm.txtEmail.value) == false){
		alert("Please enter a valid email address.")
		frm.txtEmail.focus();
		return;
	}

	// Password //
	if (frm.txtPassword.value ==""){
		alert("Please enter your password.")
		frm.txtPassword.focus();
		return;
	}
	else if (frm.txtPassword.value.length < 6){
		alert("Your password must be greater than 6 characters in length.")
		frm.txtPassword.focus();
		return;
	}
	else if (jfIsValid (frm.txtPassword.value, sAlphaNumeric) == false){
		alert("Your last name must contain alphabetic numeric characters only.")
		frm.txtPassword.focus();
		return;
	}

	frm.submit();

}

function jLogin( iMode ){

	frm = document.frmAccount
	frm.txtMode.value = iMode
	frm.submit()

}

function jRedirect( iClient ){

	frm = document.frmRegister
	frm.action = "account.asp?optClient=" + iClient
	frm.submit()

}

function jaccount( iMode, iAction, iClientProfile ){

	frm = document.frmAccount
	frm.txtMode.value = iMode
	frm.txtAction.value = iAction
	frm.optClientProfile.value = iClientProfile
	
	if (iAction == 1 ){
		if (frm.optUsage.value == 0){
			alert("Please select the property usage.")
			frm.optUsage.focus();
			return;
		}
		else if (frm.optCounty.value == 0){
			alert("Please select a county.")
			frm.optCounty.focus();
			return;
		}		
	}
	frm.submit()
}



function jsMaximise(){

	window.parent.moveTo(0,0);
	if (document.all) {
	window.parent.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById) {
	if (window.parent.outerHeight<screen.availHeight||window.parent.outerWidth<screen.availWidth){
	window.parent.outerHeight = screen.availHeight;
	window.parent.outerWidth = screen.availWidth;
	}
	}

}

function jsSend(){

	frm = document.frmSend
	var iError = -1
	cssNormal = "textnormal"
	cssRequired =  'textred'
	cssInvalid =  'textblue'

	sAlpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz- '()"
	sAlphaNumeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"

	
	// From //
	if (frm.txtFrom.value ==""){
		alert("Please enter an e-mail address.")
		frm.txtFrom.focus();
		return;
	}
	else if ( jfIsEmail(frm.txtFrom.value) == false){
		alert("Please enter a valid e-mail address.")
		frm.txtFrom.focus();
		return;
	}

	// To //
	if (frm.txtTo.value ==""){
		alert("Please enter your freind's e-mail address.")
		frm.txtTo.focus();
		return;
	}
	else if ( jfIsEmail(frm.txtTo.value) == false){
		alert("Please enter a valid freind's e-mail address.")
		frm.txtTo.focus();
		return;
	}
	
	// Subject //
	if (frm.txtSubject.value == ""){
		alert("Please enter a subject.")
		frm.txtSubject.focus();
		return;
	}

	frm.submit();

}

function jsViewing(){

	frm = document.frmViewing
	var iError = -1
	cssNormal = "textnormal"
	cssRequired =  'textred'
	cssInvalid =  'textblue'

	sAlpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz- '()"
	sAlphaNumeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"

	
	// First Name //
	if (frm.txtFirstName.value ==""){
		alert("Please enter your first name.")
		frm.txtFirstName.focus();
		return;
	}
	else if (frm.txtFirstName.value.length < 2){
		alert("Your first name must be greater than 2 characters in length.")
		frm.txtFirstName.focus();
		return;
	}
	else if (jfIsValid (frm.txtFirstName.value, sAlpha) == false){
		alert("Your first name must contain alphabetic characters only.")
		frm.txtFirstName.focus();
		return;
	}

	// Last Name //
	if (frm.txtLastName.value ==""){
		alert("Please enter your last name.")
		frm.txtLastName.focus();
		return;
	}
	else if (frm.txtLastName.value.length < 2){
		alert("Your last name must be greater than 2 characters in length.")
		frm.txtLastName.focus();
		return;
	}
	else if (jfIsValid (frm.txtLastName.value, sAlpha) == false){
		alert("Your last name must contain alphabetic characters only.")
		frm.txtLastName.focus();
		return;
	}
	
	// Email //
	if (frm.txtEmail.value ==""){
		alert("Please enter an e-mail address.")
		frm.txtEmail.focus();
		return;
	}
	else if ( jfIsEmail(frm.txtEmail.value) == false){
		alert("Please enter a valid e-mail address.")
		frm.txtEmail.focus();
		return;
	}

	// Contact Telephone //
	if (frm.txtTel.value == ""){
		alert("Please enter your contact telephone number.")
		frm.txtTel.focus();
		return;
	}
	else if (frm.txtTel.value.length < 9){
		alert("Please enter a valid contact telephone number.")
		frm.txtTel.focus();
		return;		
	}
		
	frm.submit();

}

function jsSelectAll(frm,CheckValue,FieldName){

	//frm = "frmSearch"
	//CheckValue = "true"
	//FieldName = "optArea"
	//alert(CheckValue)

	if(!document.forms[frm]){
		return;
	}
	
	var objCheckBoxes = document.forms[frm].elements[FieldName];
	
	if(!objCheckBoxes)
		return;
		
	var countCheckBoxes = objCheckBoxes.length;

	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
	
}

function jQuickSearch(){
	
	frm = document.frmQuickSearch
	iEventType = frm.optEventType.value
	
	if (iEventType == 0){
		alert("Please select a service.")
		frm.optEventType.focus();
		return;
	}
	else if(iEventType == 1){
		frm.action = "lettings_search.asp"
	}
	else if(iEventType == 2){
		frm.action = "sales_search.asp"
	}	
	
	frm.submit()

}

function jQuickLogin(){

	frm = document.frmQuickLogin
	frm.submit()

}