// JavaScript Document

<!--


// Check for null and for empty

function isFilled(elm) {
    if (elm.value == "" ||
        elm.value == null) 
    return false;
    else return true;
}

function isQuoteReady(form) {

    if (isFilled(form.pprice) == false && isFilled(form.sprice) == false ) {
    	alert("Please enter either a sale price or a purchase price or both");
    	form.sprice.focus();
    	return false;
    }

	if (!areAllNumbers (form.pprice.value)) {
		alert ('Please enter only whole numbers for the purchase price'); 
		form.pprice.select(); 	form.pprice.focus() 
		return false;	
	}

	if (form.pprice.value > 10000000) {
		alert ('Sorry, we dont give quotes for over 10 million pound properties'); 
		form.pprice.select(); 	form.pprice.focus() 
		return false;	
	}

	if (!areAllNumbers (form.sprice.value)) {
		alert ('Please enter only whole numbers for the sale price'); 
		form.sprice.select(); 	form.sprice.focus() 
		return false;	
	}
	
	if (form.sprice.value > 10000000) {
		alert ("Sorry, we dont give quotes for over 10 million pound properties"); 
		form.sprice.select(); 	form.sprice.focus() 
		return false;	
	}

    if (isFilled(form.email) == true && isEmail(form.email) == false) { 
    alert("Please enter a valid email address.");
    form.email.focus();
    return false;
    }
	

	var codeisok="no";
	for ( i=0; i<splitcodes.length; i++ ) {
		if ( splitcodes[i] == form.offer_code.value ) {
   		var codeisok="yes";
		}
	}


 	if (codeisok == "no" ) { 
    alert("This is not a valid offer code.");
	form.offer_code.focus();
    return false;
	} 


return true;
}

function areAllNumbers (item) {
for (j = 0; j<item.length; j++) {
if (!isNumber (item.charAt (j))) { return false }
}
return true
}

function isNumber (item) {
numeric = "0123456789kK"
for (var i = 0; i < numeric.length; i++) {
if (item == numeric.charAt (i)) {return true}
}
return false
}

function openHelp(url) {
hwindow=window.open(url,"testimonials","width=580,height=400,scrollbars=yes");
hwindow.document.close();
hwindow.focus(); 
}

function isEmail(elm) {
    if (elm.value.indexOf("@") + "" != "-1" &&
        elm.value.indexOf(".") + "" != "-1" &&
        elm.value != "") 
    return true;
    else return false;
}

function showintrotip() {
	Tip('<table width="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td colspan="2" align="left"><img src="http://www.fidler.co.uk/_img/nerd-gui-icon_R.gif" width="32" height="32" class="floatLeft" />If you just want to see the figures straight away then fill in this form and click on the \'show me the quote now\' button. <BR>Click anywhere to make me go away.</td></tr><tr><td width="50%" align="center"></td><td width="50%" align="center"></td></tr></table>', WIDTH, 300, BALLOON, true, FADEIN, 300, FADEOUT, 300, STICKY, true, CLICKCLOSE, true, FIX, ['conquote', 60, -20], ABOVE, true)
}

function setCookie(name, value) {
var expDate = new Date()
expDate.setTime(expDate.getTime() + 60*60*1000);
document.cookie = name + "=" + escape(value) + ";" + expDate.toGMTString();
}

setCookie('JSCookie', 'true');


//-->
