<!--
function pageinit() {
	if (arguments.callee.done) return;
	arguments.callee.done = true;
	init_common()
	switch (panel) {
		case 'pricecalc':{
			init_tooltip()
			init_keypress()
			init_calcbut()
			calc_getvalues()
			break
		}
		case 'salesappraisal':{
			init_tooltip()
			init_appbut()
			init_input()
			errmsg(0,'')
			window.onunload = appunload
			window.onblur = makefocus
			break
	}	}
	}


function init_calcbut() {
	dg('prc_cal').onclick=calc1
	dg('prc_res').onclick=clear1
}
function calc1() {
	clearpriceerr()
	if (!checkpricecalc()) {return}
	incomecalc()
	mc=pricev.value-redemptionv.value-feesv.value-costsv.value-furnishingv.value-equityv.value
	lc=mc+asslow
	hc=mc+asshigh
	dg('lowest').innerHTML=addCommas(lc)
	dg('highest').innerHTML=addCommas(hc)
}
function clear1() {
	var ob=document.getElementsByName('inp')
	for(var i=0 ; i < ob.length ; i ++) {dg(ob[i].id).value=''}
	clearpricevar()
	clearpriceres()
	clearpriceerr()	
}


function frmchg() {}
function changeval() {checkincstat()}


function frment(ob) {
	switch (ob.getAttribute('frm')) {
		case 'sal':{calc1();break}
		case 'app':{appsub(1);break}
	}
}


function calc_getvalues() {
	pricev=dg('price')
	redemptionv=dg('redemption')
	feesv=dg('fees')
	costsv=dg('costs')
	furnishingv=dg('furnishing')
	equityv=dg('equity')
	borrowcalc_getvalues()
}


function clearpriceres() {
	dg('lowest').innerHTML = ""
	dg('highest').innerHTML = ""
}
function clearpriceerr() {
		errtxt(1,"");errtxt(2,"")		
		errbox('price',0);errbox('app1',0)
}

function checkpricecalc() {
	var r=true
	if (pricev.value==0) {errtxt(1,err[1]);errbox('price',1);r=false}
	if (income1v.value==0) {errtxt(2,err[2]);errbox('app1',1);r=false}
	return r
}


function init_appbut() {
	dg('app_sub').onclick=function() {appsub(1)}
	dg('app_res').onclick=appres
}
function appsub(frmnum) {
	var sp=String.fromCharCode(1)
	var st="Thank you. A member of our sales team will contact you shortly."
	var ss="Free Sales Appraisal"+sp+st+sp+dg('subject').value+sp
	submit_email(frmnum,ss,245,'Sales Appraisal')
}
function appres() {
	if (AppWinHandle.closed==undefined) {AppWinHandle.closed=true}
	if (!AppWinHandle.closed) {return}
	app_clear()
	document.salesapp.reset()
	dg('Name').focus()
}


function checkmailform() {
	app_clear() 
	var	m=''
	var r=true
	if (dg('Name').value=='') {errbox('Name',1);errtxt(1,err[3]);r=false}
	var e=dg('Email').value
	if (e=='') {errbox('Email',1);errtxt(2,err[4]);r=false}
	else {
		if (e.toUpperCase()!='NONE') {
			var filter=/^.+@.+\..{2,3}$/
			if (!filter.test(e)) {m='- Invalid email address';errbox('Email',1);errtxt(2,err[5]);r=false}
		}	
	}	
	if (dg('Telephone Number').value=='') {errbox('Telephone Number',1);errtxt(3,err[6]);r=false}
	if (dg('Telephone Number').value.length<7 &&dg('Telephone Number').value!=''){m+='- Invalid Telephone';errtxt(3,err[7]);errbox('Telephone Number',1);r=false}	
	
	if (r) {return true}
 	errmsg(1,m)
	return false
}


function app_clear() {
	 	errmsg(0,'')
		errtxt(1,"");errtxt(2,"");errtxt(3,"")
		errbox('Name',0);errbox('Email',0);errbox('Telephone Number',0)		
}


function clearmailform() {appres()}
-->

