<!--
var panel=''

function dg(ob){return document.getElementById(ob)}

function Goto_Hyperlink(hn,nw,oa){
	if(nw==0){if (oa!=''){oa='?'+oa};location.href=hn+oa}
	if(nw==1){newwindow=window.open(hn,'',oa)}
}


function show_mortgagecalc(propertyindex) {
	if (window.showModalDialog) {window.showModalDialog ('../code/mortgagecalc.asp?propertyindex='+propertyindex+'&referer=searchform','','dialogHeight:465px;dialogWidth:405px;center:yes;edge:raised;help:no;resizable:no;scroll:no;status:yes;')}
	else {
		window.top.captureEvents (Event.CLICK|Event.FOCUS)
	    window.top.onclick=IgnoreEvents
	    window.top.onfocus=HandleFocus 
	    winModalWindow=window.open('../code/mortgagecalc.asp?propertyindex='+propertyindex+'&referer=searchform','','Width=400,Height=450,status=yes,scroll=no,top=10,left=10,screenX=10,screenY=10')
		winModalWindow.focus()
	}
}


function HandleFocus(){
	if(winModalWindow){
		if(!winModalWindow.closed){winModalWindow.focus()}
		else{window.top.releaseEvents(Event.CLICK|Event.FOCUS);window.top.onclick=''}
	}
	return false
}
function IgnoreEvents(e){return false}


function preload() {
	var d=document,a=arguments;if(!d.FP_imgs)d.FP_imgs=new Array()
	for(var i=0;i<a.length;i++){d.FP_imgs[i]=new Image;d.FP_imgs[i].src=a[i]}
}


function init_common(){init_menubut();init_ovbut()}


function init_menubut(){
	var mg=document.getElementsByName('menu')
	for(var i1=0;i1<mg.length;i1++){
		var mi=mg[i1].getElementsByTagName('a'),ms=mg[i1].getAttribute('menusel')
		for(var i2=0;i2<mi.length;i2++){
			mi[i2].id=ms+i2
			mi[i2].className=(i2==0)?'menu-button '+ms:'submenu '
			mi[i2].setAttribute('main',(i2==0)?1:0)
			mi[i2].setAttribute('expand',(mi.length>1)?1:0)
			mi[i2].setAttribute('gotourl',mg[i1].getAttribute('gotourl'))
			mi[i2].setAttribute('menusel',ms)
			mi[i2].onclick=menu_click
			mi[i2].onmouseover=menu_over
			mi[i2].onmouseout=menu_out
		}
	}
	var mb=document.getElementsByName('basebut')
	for(var i=0;i<mb.length;i++) {
		mb[i].className='base-but '+mb[i].getAttribute('cln')
		mb[i].onclick=menu_click
		mb[i].onmouseover=function(){swapclass(this,'base-but ','base-but-h ')}
		mb[i].onmouseout=function(){swapclass(this,'base-but-h ','base-but ')}
	}
	dg('menubox').style.display='inline'
}
var mt,st,lb
function menu_click(){Goto_Hyperlink(this.getAttribute('gotourl'),0,(this.getAttribute('gototab'))?this.getAttribute('gototab'):'')}
function menu_over(){
	if(this.getAttribute('main')==1){swapclass(this,'menu-button ','menu-button-hover ')} 
	else{swapclass(this,'submenu','submenu-hover');return}
	if(lb!=this.getAttribute('menusel')){if(lb){submenu_clear(lb);swapclass(dg(lb+'0'),'menu-button-hover ','menu-button ')}}
	if(this.getAttribute('expand')==0){return}
	mt=setTimeout('submenu_show("'+this.getAttribute('menusel')+'")',500)
}
function menu_out(e){
	var ms=this.getAttribute('menusel')
	if(window.event){
		if(window.event.toElement) {var nm=window.event.toElement.getAttribute('menusel')}
	}else{var nm=e.relatedTarget.getAttribute('menusel')}	
	if(ms!=nm){
		swapclass(dg(ms+'0'),'menu-button-hover ','menu-button ')
		if(this.getAttribute('expand')==0) {return}
		submenu_clear(ms)
		clearTimeout(mt)
	}
	if(this.getAttribute('main')==1){return}
	swapclass(this,'submenu-hover','submenu')
	this.className+=(this.getAttribute('gototab')==panel)?' '+ms:''
}
function submenu_show(mn){
	var dmn=document.getElementById(mn),sm=dmn.getElementsByTagName('a')
	lb=mn
	dmn.style.display='block'
	for(var l=0;l<sm.length;l++){if(sm[l].getAttribute('gototab')==panel){sm[l].className+=' '+sm[l].getAttribute('menusel')}}
}
function submenu_clear(mn){document.getElementById(mn).style.display='none'}


function init_ovbut(){
	var ob=document.getElementsByName('ovbut')
	for(var i=0;i<ob.length;i++){
		ob[i].className='oval-button'
		ob[i].onmousedown=function(){this.className='oval-button-down'}
		ob[i].onmouseup=function(){this.className='oval-button-hover'}
		ob[i].onmouseover=function(){this.className='oval-button-hover'}
		ob[i].onmouseout=function(){this.className='oval-button'}
//		ob[i].onkeydown=oval_keydown
//		ob[i].onkeyup=oval_keyup
//		ob[i].onfocus=oval_focus
//		ob[i].onblur=oval_blur
	}
}
//function oval_keydown(e) {if (testkey(e)==13) {this.className='oval-button-down'}}
//function oval_keyup(e) {if (testkey(e)==13) {this.className='oval-button-hover'}}
//function oval_focus() {this.style.textDecorationUnderline=true}
//function oval_blur() {this.style.textDecorationUnderline=false;this.className='oval-button'}


function init_imglink(){
	var ob=document.getElementsByName('imglink')
	for(var i=0;i<ob.length;i++){
		ob[i].src=ob[i].getAttribute('img1')
		ob[i].style.cursor='pointer'
		ob[i].onclick=gotohyperlink
		ob[i].onmouseover=imglinkover 
		ob[i].onmouseout=imglinkout
	}
}
function gotohyperlink(){
	var p=this.getAttribute('gotourl')
	if(p.substring(0,2)=='**'){history.go(p.substring(2,p.length)-0)}
	else{
		if(this.getAttribute('par1')){Goto_Hyperlink(p,this.getAttribute('par1'),(this.getAttribute('par2')==null)?'':this.getAttribute('par2'))}
		else{Goto_Hyperlink(p,0,'')}
	}
}
function imglinkover(){this.src=this.getAttribute('img2')}
function imglinkout(){this.src=this.getAttribute('img1')}



function init_srchbut(){dg('src_cal').onclick=search;dg('src_res').onclick=clear_search}


function init_ticks(){
	var ob=document.getElementsByName('tick')
	for(var i=0;i<ob.length;i++){ob[i].onclick=tickclick}
}
var tickstore=Array()
function tickclick(){
	var to=document.getElementsByName('tick'),at=dg('alltick')
	if(this.value=='Any'){
		for(lp=0;lp<to.length;lp++){
			if(to[lp].value!='Any'){
				if(this.checked==true){tickstore[lp]=to[lp].checked;to[lp].checked=true}	
				else{to[lp].checked=tickstore[lp]}
			}
		}
	}
	else{
		if(this.checked==true) {
			var tc=0
			for(lp=0;lp<to.length;lp++){if(to[lp].value!='Any' && to[lp].checked){tc++}}
			if(tc==to.length-1){at.checked=true}
		}
		else{at.checked=false}
	}
}


function init_navbut(){
	var ob=document.getElementsByName('navb')
	for(var i=0;i<ob.length;i++){
		ob[i].className='Page-nav-ButtonOn'
		ob[i].onclick=function(){SubmitForm_Results(this.getAttribute('page'))}
		ob[i].onmouseover=function(){this.className='Page-nav-ButtonOn-Hover'}
		ob[i].onmouseout=function(){this.className='Page-nav-ButtonOn'}
	}
}


function init_keypress(){
	var ob=document.getElementsByName('inp')
	for(var i=0;i<ob.length;i++){
		ob[i].onkeypress=keypress
		ob[i].onkeyup=changeval
		ob[i].onchange=frmchg
	}
}

var storeval='',storeinp=''
function keypress(e){
	if(!e)var e=window.event
	if(typeof(e.which)=='number'){var cd=e.which;var ob=e.target} 
	else if(typeof(e.keyCode)=='number'){var cd=e.keyCode;var ob=e.srcElement} 
	else if(typeof(e.charCode)== 'number'){var cd=e.charCode;var ob=e.srcElement}
	else{return}
	var it=ob.getAttribute('dec')
	storeval=ob.value
	storeinp=ob.id
	if(cd==0){return}
	var ch=String.fromCharCode(cd),vl='0123456789',al='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
	switch(it){
		case'flo':{vl+='.';if(ch=='.' && ob.value.indexOf(ch)!=-1){return false};break}
		case'tel':{vl+=' +()';break}
		case'txt':{vl+=al+' -=_+[]{}#~;:@/?.>,<\|`¬!"£$%^&*()';break}
		case'nam':{vl+=al+' -_+.,`()';break}
		case'eml':{if(ch=='@' && ob.value.indexOf(ch)!=-1 ){return false};vl+=al+'-_@.';break}
		case'eml':{if(ch=='@' && ob.value.indexOf(ch)!=-1 ){return false};vl+=al+'-_@.';break}
		case'pcd':{vl+=al+' ';break}
	}
	if(vl.indexOf(ch)!=-1 || cd==8){return}
	if(cd==13){if(ob.type=='textarea'){return};frment(this)}
	return false
}


function frmchg(){
	if(this.getAttribute('frm')!='inc'){
		switch(this.id){
		    case'price':{setdeposit('prc');break}
			case'deposit':{setdeposit('dep');break}
			case'depositper':{setdeposit('sel');clearmortcalcres();break}
			case'term':{clearmortcalcres()}
		}
	}
}


function init_select(){
	var ob=document.getElementsByName('sel')
	for(var i=0;i<ob.length;i++){
		ob[i].onchange=frmchg
		ob[i].onkeyup=selkey
	}
}
function selkey(e){
	if(!e){var e=window.event}
	if(typeof(e.which)=='number'){var cd=e.which} 
	else if(typeof(e.keyCode)=='number'){var cd=e.keyCode} 
	else if(typeof(e.charCode)== 'number'){var cd=e.charCode}
	if(cd==13){frment(this)}
}


function init_tooltip(){
	var ob=document.getElementsByName('inf')
	for(var i=0;i<ob.length;i++){
		ob[i].onmouseover=function tooltip(){showtooltip(this,1)}
		ob[i].onmouseout=function tooltip(){showtooltip(this,0)}
	}
}
var ptip=0
function showtooltip(curobj,display){
	showtooltipf=function(){
		tt.className='tip'
		t.display='block'
		t.height='auto'
		tt.innerHTML=tip[n]
		if(tipw[n]==''){var ts1=new Dimension(tt);var tw=ts1.w-12+'px'} 
		else{var tw=tipw[n]}
		t.width=tw
		var ps=new Position(curobj)
		var tl=ps.l+30+'px'
		t.left=tl
		var ts2=new Dimension(tt)
		var th=ts2.h
		var ttp=ps.t-parseInt((th-20)/2)+'px'
		t.top=ttp 
		var sx=(dc.all)?dc.documentElement.scrollLeft:window.pageXOffset
		var ww=(dc.all)?dc.documentElement.clientWidth:window.innerWidth
		r=(ww+sx)-parseInt(tl)-20
		l=parseInt(tl)-sx
		if (r<parseInt(tw) && l>r) {tl=ps.l-10-parseInt(tw)+'px';t.left=tl}
	    tt.style.zIndex=100
		var b=navigator.userAgent.toLowerCase()
		if(b.indexOf('opera')==-1){
			f.width=parseInt(tw)+12+'px'
			f.height=th+'px'
			f.left=tl
			f.top=ttp
		    f.zIndex=99
			f.display='block'
		}

	}
	var n=curobj.getAttribute('index'),dc=document,f=dg('tipf').style,tt=dg('tipc'),t=tt.style
	if(display==0){clearTimeout(ptip);ptip=0;t.display='none';f.display='none';return}
	if(ptip==0){ptip=setTimeout('showtooltipf()',400);return}
	ptip=0
}


function Dimension(e){
	this.w=0;this.h=0
	if(e==document){this.w=e.body.clientWidth;this.h=e.body.clientHeight}
	else if(e!=null){this.w=e.offsetWidth;this.h=e.offsetHeight}
}

function Position(e){
	this.l=0;this.t=0
	var cl=0,ct=0
	if(e.offsetParent){while(e.offsetParent){ct+=e.offsetTop;cl+=e.offsetLeft;e=e.offsetParent}}
	else if(e.x){ct+=e.y;cl+=e.x}
	this.l=cl;this.t=ct 
}

function addCommas(nStr){
	nStr+=''
	x=nStr.split('.')
	x1=x[0]
	x2=(x.length>1)?'.'+x[1]:''
	var rgx=/(\d+)(\d{3})/
	while(rgx.test(x1)){x1=x1.replace(rgx,'$1'+','+'$2')}
	return x1+x2
}


function setdeposit(ob){
	if(!pricev.value>0){depositperv.selectedIndex=0;return}
	if(ob=='dep'|| ob=='prc'){
		var cd=(depositv.value/pricev.value*100).toFixed(2)-0,t1=((cd/5).toFixed(2))-0,t2=((cd/5).toFixed(0))-0
		if(t1==t2 && t2<20){depositperv.selectedIndex=t2}
		else{
			if(depositperv.length<= 20){depositperv.length++}
			var dt=(cd<100)?cd+'%':'>100'
			depositperv.options[20].value=cd
			depositperv.options[20].text=dt
			depositperv.selectedIndex=20
		}
	}
	if(ob=='sel'){var cd=(pricev.value/100*depositperv.value).toFixed(0)-0;depositv.value=(cd==0)?'':cd}
}



/////////////////
// upt to here //
/////////////////




function calcmor(){
	clearmortcalcerr()
	setdeposit('prc')
	if (!checkmortcalc()) {return}
	var l=(pricev.value-depositv.value)
	dg('loan').innerHTML=addCommas(l)
	var m=((l*interestv.value)/(1200))
	dg('interestonly').innerHTML=addCommas(m.toFixed(0))+' pcm'
	var t=(l*interestv.value*12)
	var md=Math.pow((1+(interestv.value/1200)),(-termv.value*12))
	md=(100*12*(1-md))
	var mr=((t/md)/12)
	dg('repayment').innerHTML=addCommas(mr.toFixed(0))+' pcm'
}


function clearmortcalcres() {
	dg('loan').innerHTML=''
	dg('interestonly').innerHTML=''
	dg('repayment').innerHTML=''
}


function borrowcalc_getvalues() {
	income1v=dg('app1')
	income2v=dg('app2')
	bonus1v=dg('bon1')
	bonus2v=dg('bon2')
}


function checkincstat() {
	bonus1en = true;bonus2en = true;income2en = true
	if (income1v.value!='') {income2en=!true;bonus1en=!true}
	if (income2v.value!='' && !income2en) {bonus2en=!true}
	dg('app2').disabled=income2en 
	dg('bon1').disabled=bonus1en 
	dg('bon2').disabled=bonus2en 
}


function clearpricevar() {
	dg('app1').value=''
	dg('app2').value=''
	dg('bon1').value=''
	dg('bon2').value=''
	dg('app2').disabled=true
	dg('bon1').disabled=true
	dg('bon2').disabled=true
}


var asslow,asshigh
function incomecalc() {
	var n1=income1v.value-0 
	var n2=(!income2v.disabled)?income2v.value-0:0
	var b1=(!bonus1v.disabled)?bonus1v.value-0:0
	var b2=(!bonus2v.disabled)?bonus2v.value-0:0
	if(n2>n1){n1=income2v.value-0;n2=income1v.value-0}
	if (b1>0){b1=(b1*0.5)}
	if (b2>0){b2=(b2*0.5)}
	n1=(n1+b1)
	r1=n1
	n2=(n2+b2)
	r2=n2
	var res1=(n1+n2)
	res1=(res1*2.5)
	var	res2=(n1*3.25)
	i1=((r1*4)+r2)
	i2=((r1+r2)*2.75)
	var lval=(res1>=res2)?res1:res2
	var hval=(r1>=r2)?i1:i2
	asslow = parseInt(lval)
	asshigh = parseInt(hval)
}


function init_buttons() {
	var ob=document.getElementsByName('ovbut')
	for(var i=0 ; i < ob.length ; i ++) {
		switch (ob[i].id) {
		    case 'calc':{	ob[i].onclick=calcclick
		    				break}
			case 'map':{	ob[i].onclick=mapclick
							break}
			case 'detail':{	ob[i].onclick=detailclick
							break}
			case 'view':{	ob[i].onclick=viewclick
							break}
			case 'print':{	ob[i].onclick=printclick
							break}
		}
	}
}
function calcclick() {show_mortgagecalc(this.getAttribute('action1'))}
function mapclick() {Goto_Hyperlink('http://www.multimap.com/map/browse.cgi?local=rp&amp;scale=10000&amp;title='+this.getAttribute('action1')+'&amp;pc='+this.getAttribute('action2')+'&amp;icon=x',1,'menubar=no,width=645,height=530,resizable=yes,scrollbars=yes,toolbar=yes,location=no,directories=no,status=no,left=20,top=20,screenX=20,screenY=20')}
function detailclick() {SubmitForm_Details(this.getAttribute('action1'))}
function printclick() {Print_Page(this.getAttribute('action1'))}


var VieWinHandle=new Object()
VieWinHandle.closed=true
function viewclick() {
	if (VieWinHandle.closed==undefined) {VieWinHandle.closed=true}
//	var h=(screen.height<750)?400:640
//	var s=(screen.height<750)?'yes':'no'

	var h=640
	var s='no'


	if (window.showModalDialog) {
		retval=window.showModalDialog ("../code/viewing1.asp?ref=vi1&prop="+this.getAttribute('action1')+"&ptitle="+this.getAttribute('action2'),'',"dialogHeight:"+h+"px;dialogWidth:460px;center:yes;edge:raised;help:no;resizable:no;scroll:"+s+";status:no;")

	}else{
    	VieWinHandle=window.open("../code/viewing1.asp?ref=vi1&prop="+this.getAttribute('action1')+"&ptitle="+this.getAttribute('action2'),'','Width=460,Height='+h+',innerWidth=460,innerHeight='+h+',status=yes,scrollbars='+s+',resizable=no,top=10,left=10,screenX=10,screenY=10,alwaysRaised,dependent,fullscreen=no')
		if (VieWinHandle.opener==null) {VieWinHandle.opener=self}
		VieWinHandle.focus()
	}
}


function makefocus1() {
	if (VieWinHandle.closed==undefined) {VieWinHandle.closed=true}
	if (!VieWinHandle.closed) {VieWinHandle.focus()}
}


function appunload1()  {
	if (VieWinHandle.closed==undefined) {VieWinHandle.closed=true}
	if (VieWinHandle && VieWinHandle.open && !VieWinHandle.closed) VieWinHandle.close()
}


function init_images() {
	var ob=document.getElementsByName('srcimg')
	for(var i=0 ; i < ob.length ; i ++) {
		switch (ob[i].getAttribute('tp')) {
			case 'buy':{ob[i].className='saleres-thumb';break}
			case 'rent':{ob[i].className='rentres-thumb';break}
		}	
		ob[i].title='Click for more details'
		ob[i].alt='Click for more details' 
		ob[i].onclick=detailclick
		ob[i].onmouseover=imgover 
		ob[i].onmouseout=imgout
	}
}
function imgover() {
	switch (this.getAttribute('tp')) {
		case 'buy':{this.className='saleres-thumb-hover';break}
		case 'rent':{this.className='rentres-thumb-hover';break}
	}
}
function imgout() {
	switch (this.getAttribute('tp')) {
		case 'buy':{this.className='saleres-thumb';break}
		case 'rent':{this.className='rentres-thumb';break}
	}
}


function init_input() {
	var ob=document.getElementsByName('inp')
	for(var i=0 ; i < ob.length ; i ++) {ob[i].onkeypress=keypress}
}


var AppWinHandle=new Object()
AppWinHandle.closed=true
function submit_email(subid,sndst,wheight,ptitle) {
	if (AppWinHandle.closed==undefined) {AppWinHandle.closed = true}
	if (!checkmailform() || !AppWinHandle.closed) {return false}
	var ob=document.getElementsByName('inp')
	var ss=sndst
	var sp=String.fromCharCode(1)
	for(var i=0 ; i < ob.length ; i ++) {if (ob[i].getAttribute('sub')==subid) {ss=ss+ob[i].id+sp+ob[i].value+sp}}
	if (window.showModalDialog) {
		var sv=new Object()
		sv.sendval=ss
		retval=window.showModalDialog ('../code/mailform1.asp?ref=mf1&pgtitle='+escape(ptitle),sv,'dialogHeight:300px;dialogWidth:300px;center:yes;edge:raised;help:no;resizable:no;scroll:no;status:no;')
//		retval=window.showModalDialog ('../code/mailform1.asp?ref=mf1&pgtitle='+escape(ptitle),sv,'dialogHeight:380px;dialogWidth:400px;center:yes;edge:raised;help:no;resizable:no;scroll:no;status:no;')
//		retval=window.showModalDialog ('../code/mailform1.asp?ref=mf1',sendvar,'dialogHeight:600px;dialogWidth:500px;center:yes;edge:raised;help:no;resizable:no;scroll:no;status:yes;')
		email_test(retval)
		retval=null
	}else{
		document.mailform.sendvar.value=ss
		document.mailform.pgtitle=ptitle
    	AppWinHandle = window.open('about:blank','appreswin','Width=400,Height=380,innerWidth=380,innerHeight=400,status=no,scroll=no,resizable=no,top=10,left=10,screenX=10,screenY=10,alwaysRaised,dependent,fullscreen=no')
//		AppWinHandle = window.open('about:blank','appreswin','Width=600,Height=600,outerWidth=600,outerHeight=600,status=no,scroll=no,resizable=yes,top=10,left=10,screenX=10,screenY=10,alwaysRaised,dependent,fullscreen=no,dialog=yes')
		if (AppWinHandle.opener==null) {AppWinHandle.opener=self}
		document.mailform.submit()
		AppWinHandle.focus()
		setTimeout('email_test()',100)
	}
}


var appretval=''
function email_test(retval) {
	if (AppWinHandle.closed==undefined) {AppWinHandle.closed=true}
	if (window.showModalDialog) {appretval=retval;AppWinHandle.closed=true}
	else {
		if (!AppWinHandle.closed) {appretval=AppWinHandle.returnValue;setTimeout("email_test()",100);return false}
	}
	if (AppWinHandle.closed) {if (appretval=='done') {clearmailform()}}
}


function testkey(obj) {
	if (!obj) var obj = window.event;
	if(typeof(obj.which)=='number'){var cd = obj.which} 
	else if(typeof(obj.keyCode)=='number'){var cd = obj.keyCode} 
	else if(typeof(obj.charCode)== 'number'){var cd = obj.charCode}
	return cd
}


function makefocus() {if (!AppWinHandle.closed) {AppWinHandle.focus()}}


function appunload() {if (AppWinHandle && AppWinHandle.open && !AppWinHandle.closed) {AppWinHandle.close()}}


function errbox(ob,st) {
	var c=(st!=0)?'#ff0000':'#7b9ebd'
	dg(ob).style.border='solid 1px '+c
}

function errmsg(st,msg) {
	var c=(st!=0)?'#ff0000':'#000080'
	dg('errmsg').innerHTML='Fields marked with * must be completed '+msg
	dg('errmsg').style.color=c
}

function errtxt(er,msg) {dg('er'+er).innerHTML=msg}



function winsize() {
	this.w=0;this.h=0
 	var myWidth = 0;var myHeight = 0
  	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
   		myWidth = window.innerWidth
    	myHeight = window.innerHeight
  	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    	myWidth = document.documentElement.clientWidth
    	myHeight = document.documentElement.clientHeight
  	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    	myWidth = document.body.clientWidth
    	myHeight = document.body.clientHeight
  	}
  	this.w=myWidth
	this.h=myHeight
}

function swapclass(ob,c1,c2){ob.className=ob.className.replace(c1,c2)}
-->
