﻿var TEST=window.location+'',isEMAIL='';if(TEST.indexOf('em=')>0)isEMAIL=TEST.split('em=')[1];TEST=TEST.indexOf('TEST');
var latitude="http://maps.google.com/staticmap?center=LAT,LON&zoom=13&size=130x100&format=jpg&markers=LAT,LON,blues&key=KEY";
var latitudeSAT="http://maps.google.com/staticmap?center=LAT,LON&zoom=13&size=130x100&maptype=satellite&format=jpg&markers=LAT,LON,blues&key=KEY";
var osidil_com="ABQIAAAAtnWM4WQtOG-H469-JQZS9RQ2dO3D6z0vzazCGjVSNYwF5DGOUhRp-EQEVS392Q2upk6nLQPdX-TYuQ";
var osidil_co_uk="ABQIAAAAtnWM4WQtOG-H469-JQZS9RTcC1Btv6Ls8Jz4xecP9VkFzy0gpBRnEcCLVXdR8sqLXO4r6667_KK1Nw";
var osidil_4prop_com="ABQIAAAAtnWM4WQtOG-H469-JQZS9RQNmMKOGmLvXwtyEwNmbp8n1GU13RQr68P0yx-diyW0N70Ji9IHvKM4Sg";
var LOGGED='',LOGIN='',MAIL='',OSIDIL='osdl',OSIDILmail='OSDLmail',resTYPE=0;
var agt=navigator.userAgent.toLowerCase();
var is_ie=(agt.indexOf("msie") != -1);  //bools
var i, j, k, ln,CNT=0,CntB=0,cntBef,CntBALL=0,IS_FILTER=false;//     numbers
var cREF='',err='',res='',aRes,CompanyName='4PROP',SID=0,aItem,PIDs,size=1;   
var arMsg=new Array('The login email MAIL does not exist!','The password for the login email MAIL is incorrect!');
var oUser={Email:'',Title:'',Firstname:'',Surname:'',Phone:'',Company:'',Postcode:'',Mobile:'',Psw:'',RQIs:'',SLs:'',Description:'',Remember:'0',Cid:'',Searches:'',urgent:0,oneyear:0,rightproperty:0,looking:0}; 
var oUserCookie="oUser={Email:'EMAIL',Title:'TITLE',Firstname:'FIRSTNAME',Surname:'SURNAME',Phone:'PHONE',Company:'COMPANY',Postcode:'POSTCODE',Mobile:'MOBILE',Psw:'PSW',RQIs:'RQIS',SLs:'SLS',Description:'DESCRIPTION',Remember:'REMEMBER',Cid:'CID',Searches:'CID',urgent:URGENT,oneyear:ONEYEAR,rightproperty:RIGHTPROPERTY,looking:LOOKING}";
var oSearchCookie="SrchxSID={SID:xSID,Date:'xDate',Matches:'xMatches',RFIs:0,IG:0,Source:'xSource',Tenure:'xTenure',Type:'xType',Subtypes:'xSubtypes',Regions:'xRegions',PCs:'',Towns:'',Towns2:'',Subregions:'xSubregions',fulTx:'xfulTx',PIDs:'xPIDs'}";
var SIDs='',sep='X9Q',AgPhEm,SHOWtitle='',pFrom=1,pTo=0,TYPE=0,AJAX,PSW,REMEMBER;
var dvSearches4Each='',htmlSearches4Each='<input type=hidden id=hcCID value=xID /><a name=CID ></a><div id=dS4ECID onmouseover="ovS4E(this);" onmouseout="ouS4E(this);" class=S4E><table width="100%"><tr><td width="15%" class=hrSrch><a href="javascript:onlyRFIs=false;cS4E(CID,xsearches,xID);" >xsearches searches</a></td><td>/</td><td width="10%" class=hrRFI>&nbsp;<a href="javascript:onlyRFIs=true;cS4E(CID,xsearches,xID);" ><span class=red>xRFI</span> RFI </a></td><td width="10%">/ xIG IG </td><td width="50%">Client: xClient</td><td align=right>Login</td></tr></table></div><div id=dsxID></div>';
var NRFIs=0,nRFIs=0,nSearches=0,nIGs=0;
var UNI='<div class=UNI>TITLE<br/>UNI</div>';
var HELPclose='<a href="javascript:HelpClose();">X</a>';
var HELPtitle='<table width="100%"><tr><td><h3>TITLE</h3></td><td align=right style="padding-right:9px">CLOSE</td></table>';
var Center,X='',ExtraPCs='',bShortlist=false,SIDbef=0,oS4E,wasSearches=false;
var arWasSearch=new Array(),arWasRFIs=new Array(),arWasMatches=new Array();
var LOADING='<center><div class=LOADING>LOADING...</div></center>';
var curdate = new Date(),cDATE=curdate.getDate()+'.';
var arStatus=Array('Available','Under Offer', 'Withdrawn','','Completed');
var intMin=0,extMin=0;

var jsPts={p1:"1.2.3.4.5.6.7.8",p2:"9.10.11.12.13.14.15.16.17.18.19.69",p3:"20.21.22.86.88",p4:"23.24.25.26.27.28.29.30.31.32.33.72.87",p5:"34.74.75.76.77.78.79.80.81.82.84.85",p6:"38.39.40.41.42.43.44.45.67.70",p7:"46.47.48.49.50.51.52.89",p8:"53.55.56.57.71.83",p9:"58.59.60.61.62.63.64.65.66"}; 
var jsRgs={r1:"60.61.62.63.64.65.66.67.68.69.70",r4:"7.14.27.44.58.59.78.81.83.95.100.106.109.114",r10:"19.20.21.23.24.25",r7:"16.22.71.79.80.82.98.99.105.111",r6:"26.40.48.57.72",r8:"1.2.3.5.6.9.11.15.30.31.33.38.46.47.50.53.54.55.56.75.76.77.84.86.87.89.90.91.93.94.101.104.108.112.115.116",r2:"8.10.12.34.37.43.45.51.52.74.85.102.103.110",r3:"4.13.18.28.29.39.49.96.113",r5:"17.32.41.42.73.88.97.107.117"};
var jsSbts={s1:"Arable",s2:"Equestrian",s3:"Fruit / PYO",s4:"Livestock",s5:"Garden Nursery",s6:"Gaming Rights",s7:"Vineyard",s8:"Woodland",s9:"A1 Retail Warehouse",s10:"A1 Shop",s11:"A1 Showroom / Gallery",s12:"A2 Shop",s13:"A3 Restaurant/Cafe",s14:"A4 Pub/Bar & Grill",s15:"Drive-in / Roadside",s16:"Garden Centre",s17:"Nightclub / Club",s18:"Stall / Shop in a Shop",s19:"Unusual other Retail",s20:"Guest House/B&B",s21:"Hotel",s22:"Motel",s23:"B1/2/8 Design & Build",s24:"B1c Light Industrial",s25:"B2 General Industrial",s26:"B8 Warehouse",s27:"Data Centre",s28:"Food Processing/Storage",s29:"HighTec/R&D/Labs",s30:"Media/Art Studios",s31:"Open Storage",s32:"Railway Arch",s33:"Garage/Repair",s34:"Ground Rents",s38:"Development - Commercial",s39:"Land - for Excavation",s40:"Commercial Car Park",s41:"Car Spaces",s42:"Car Wash",s43:"Car Showroom",s44:"Petrol Station/Car Hire",s45:"Other (air/boat/track)",s46:"Casino",s47:"Golf Course",s48:"D2 Sport - indoor only",s49:"D2 Sport - with outdoor",s50:"Auditorium/Bowl/Cinema",s51:"Holiday Park/Site",s52:"D2 Other",s53:"Office",s55:"Office With Showroom",s56:"Serviced Office",s57:"Office Storage",s58:"C2 Hospital",s59:"C2 Nursing Home",s60:"C2 Training/School - Residential",s61:"C3sg Student Accommodation",s62:"D1 Church Building/Hall",s63:"D1 Creche/Nursery",s64:"D1 Museum/Exhibition/Gallery",s65:"D1 Surgery/Consulting/Clinic",s66:"D1 Training/School - NOT Resi",s67:"Billboard/Telecoms",s69:"A5 Take Away",s70:"Development - Residential",s71:"Call Centre",s72:"Industrial Trade unit",s74:"Office Investment",s75:"Retail Investment - High Street",s76:"Industrial Investment",s77:"Other Commercial Investment",s78:"Residential Investment",s79:"Shopping Centre Investment",s80:"Retail Warehouse Investment",s81:"Office Portfolio Investment",s82:"Industrial Portfolio Investment",s83:"Disaster Recovery",s84:"Leisure/Hotel Investment",s85:"Training/Welfare Investment",s86:"Hostel",s87:"Lock-up Garage",s88:"Inn",s89:"Lakes - Watersports/Fish"};
var jsCts={s1:"Aberdeenshire",s2:"Angus",s3:"Argyll",s4:"Avon",s5:"Ayrshire",s6:"Banffshire",s7:"Bedfordshire",s8:"Berkshire",s9:"Berwickshire",s10:"Buckinghamshire",s11:"Caithness",s12:"Cambridgeshire",s13:"Channel Isles",s14:"Cheshire",s15:"Clackmannanshire",s16:"Cleveland",s17:"Clwyd",s18:"Cornwall",s19:"County Antrim",s20:"County Armagh",s21:"County Down",s22:"County Durham",s23:"County Fermanagh",s24:"County Londonderry",s25:"County Tyrone",s26:"Cumbria",s27:"Derbyshire",s28:"Devon",s29:"Dorset",s30:"Dumfriesshire",s31:"Dunbartonshire",s32:"Dyfed",s33:"East Lothian",s34:"East Sussex",s115:"Edinburgh",s37:"Essex",s38:"Fife",s116:"Glasgow",s39:"Gloucestershire",s40:"Greater Manchester",s41:"Gwent",s42:"Gwynedd",s43:"Hampshire",s44:"Herefordshire",s45:"Hertfordshire",s46:"Inverness-Shire",s47:"Isle of Lewis",s48:"Isle of Man",s49:"Isle of Scilly",s50:"Isle of Skye",s51:"Isle of Wight",s52:"Kent",s53:"Kincardineshire",s54:"Kinross-Shire",s55:"Kirkcudbrightshire",s56:"Lanarkshire",s57:"Lancashire",s58:"Leicestershire",s59:"Lincolnshire",s60:"London E(not E1/E14)",s61:"London E1/E14",s62:"London EC",s63:"London N",s64:"London NW",s65:"London SE(not SE1)",s66:"London SE1",s67:"London SW(not SW1)",s69:"London SW1/W1",s68:"London W(not W1)",s70:"London WC",s71:"Mersey",s72:"Merseyside",s73:"Mid Glamorgan",s74:"Middlesex",s75:"Midlothian",s76:"Morayshire",s77:"Nairnshire",s78:"Norfolk",s79:"North Humberside",s80:"North Yorkshire",s81:"Northamptonshire",s82:"Northumberland",s83:"Nottinghamshire",s84:"Orkney",s85:"Oxfordshire",s86:"Peeblesshire",s87:"Perthshire",s88:"Powys",s89:"Renfrewshire",s90:"Ross-Shire",s91:"Roxburghshire",s93:"Selkirkshire",s94:"Shetland Islands",s95:"Shropshire",s96:"Somerset",s97:"South Glamorgan",s98:"South Humberside",s99:"South Yorkshire",s100:"Staffordshire",s101:"Stirlingshire",s102:"Suffolk",s103:"Surrey",s104:"Sutherland",s105:"Tyne and Wear",s117:"Wales",s106:"Warwickshire",s107:"West Glamorgan",s108:"West Lothian",s109:"West Midlands",s110:"West Sussex",s111:"West Yorkshire",s112:"Wigtownshire",s113:"Wiltshire",s114:"Worcestershire"};
var JsPts={v0:"All Types",v1:"Agricultural",v2:"Retail/Catering",v3:"Hotel",v4:"Industrial",v5:"Investment",v6:"Land/Develop/Auto",v7:"Leisure",v8:"Office",v9:"D1/Training/Health"};
var JsRgs={v1:"London",v4:"Midlands",v10:"N. Ireland",v7:"North East",v6:"North West",v8:"Scotland",v2:"South East",v3:"South West",v5:"Wales"};
var shortList_js={q:''},shortList_jsClicked={q:''},arShortList=new Array();

var ckKey="all_settings",ckMail="all_mail2";;//, ckValue=new Array('','');
var ckDate=new Date();
var expires = new Date ( ckDate.getFullYear()+1, ckDate.getMonth(), ckDate.getDay());
var cookie_string,results;
var oShow,to_be_replaced;
var is_minsize=false,is_maxsize=false,was_clicked=false;
var CTIDs='',PSTIDs='',TOWNs='',arTOWNs;  
var g,town_before='',nPages=0,nResult=0,cPage=1,maxPg=5,cPageASC=1;
var ord='',ordPrev='',sort='',sortPrev='',ckSort='',ckOrd='',ckPg='',ckValue,idf='';
var txShortlist='<span class=ag id=ASREF><a href="javascript:Ad2SL(JS,REF);">Please Add to Shortlist and Login</a></span> <span class=ag2><a href="javascript:shortls();"><span style="text-decoration:none;">for Agent and full address information </span>view your Shortlist</a></span>';
var aSbt,bSbt="<input class=bsbt onmouseover=ov(this); onclick=sel_sbtype(this,ID); onmouseout=ou(this); type=button value='VAL' />";   
var aCnt,bCnt="<input class=bsbt onmouseover=ov(this); onclick=sel_county(this,ID); onmouseout=ou(this); type=button value='VAL' />";   
var arSrBy=new Array('T','P','A','Q','R','S');
var isSL=false, SHORTLS='';
function fOrd(or){ord=or;return(ordPrev==ord);}
function sortOv(x){if ($('#s'+arSrBy[x]+'w').css('font-weight')=='normal' || $('#s'+arSrBy[x]+'w').css('font-weight')=='400')$('#s'+arSrBy[x]+'w').css('color','#001177');}
function sortOu(x){if ($('#s'+arSrBy[x]+'w').css('font-weight')=='normal' || $('#s'+arSrBy[x]+'w').css('font-weight')=='400')$('#s'+arSrBy[x]+'w').css('color','');}
function sortOv2(x){if ($('#s'+arSrBy[x]+'w2').css('font-weight')=='normal' || $('#s'+arSrBy[x]+'w2').css('font-weight')=='400')$('#s'+arSrBy[x]+'w2').css('color','#001177');}
function sortOu2(x){if ($('#s'+arSrBy[x]+'w2').css('font-weight')=='normal' || $('#s'+arSrBy[x]+'w2').css('font-weight')=='400')$('#s'+arSrBy[x]+'w2').css('color','');}

function HelpClose(){flHide('floatdiv',12);}

function reg(){           
    if(!validating()) return;
    if(1==1 || res=='..1' || oUser.Email!=MAIL){ //
        AJAX = new sack();    
        AJAX.requestFile=sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexAjax.aspx?account=2&mail='+MAIL+'&p='+PSW+'&SID='+SID;//?p='+O('txPC').value;    //&t=KL
        AJAX.onCompletion = function(){regPost();};
        AJAX.runAJAX();  
    }
    else {
        if(oUser.Psw==O('bPs').value){
            AJAX = new sack();    
            AJAX.requestFile=sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexAjax.aspx?account=3&cid='+oUser.Cid+'&SID='+SID;//?p='+O('txPC').value;    //&t=KL
            AJAX.onCompletion = function(){regPost2();};
            AJAX.runAJAX();      
        }
        else{//err=arMsg[1].replace('MAIL',MAIL);
            AJAX = new sack();    
            AJAX.requestFile=sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexAjax.aspx?account=2&mail='+MAIL+'&p='+PSW+'&SID='+SID;//?p='+O('txPC').value;    //&t=KL
            AJAX.onCompletion = function(){regPost();};
            AJAX.runAJAX();                         
            //errorAccount();                        
        }
    }
    unsetOpacity();
}

function regPost(){    
    eval(AJAX.response);  
    if(myAcount.length==1){
      err=arMsg[myAcount].replace('MAIL',MAIL);
      errorAccount();               
    }
    else{ 
        res=myAcount.split('~');        
        oUserFill();    
        regPost2();
    }
}     

function regPost2(){        
    txShortlist=txShortlist.replace('and Login',''); 
    O('dvsALL').innerHTML=O('dvsALL').innerHTML.replace(/and Login/g,'');
    PIDs=oUser.SLs.split('.');
    $('#mAc').html('');
    LOGINread();//O('bEm').value
    $('#container').html('<br/><div><center>'+MAIL+' logged in</center></div><br/>');
    LOGGED=oUser.Cid;//res[8];
    Remember();
    setOsidilCookie();
    ckValue=get_cookie(ckKey);
    if(ckValue=='..1')
        ord='Q';
    else{
        ord=ckValue.split('.')[0];
        sort=ckValue.split('.')[1];
    }
    /*if(ord!='Q'){
        O('s'+ord+'w').checked=true;
        if(O('s'+ord+'w2')!=null)
        O('s'+ord+'w2').checked=true;    
    }   */ 
    deleteREFset(2.5);
}

function oUserFill(){
    oUser.Email=MAIL;oUser.Psw=res[9];
    oUser.Title=res[0];oUser.Firstname=res[1];oUser.Surname=res[2];
    oUser.Phone=res[4];oUser.Company=res[3];oUser.Postcode=res[5];oUser.Mobile=res[6];
    oUser.Description=res[7];oUser.RQIs=res[10].split('-')[0];oUser.SLs=res[10].split('-')[1];
    oUser.Cid=res[8];
    oUser.Remember=REMEMBER;
    oUser.Searches=res[11];
    oUser.urgent=res[12];
    oUser.oneyear=res[13];
    oUser.rightproperty=res[14];
    oUser.looking=res[15];
}
function Remember(){oUser.Remember=REMEMBER;}
function setOsidilCookie(){    
    set_cookie(OSIDILmail,''+oUserCookie.replace('LOOKING',oUser.looking).replace('RIGHTPROPERTY',oUser.rightproperty).replace('ONEYEAR',oUser.oneyear).replace('URGENT',oUser.urgent).replace('EMAIL',oUser.Email).replace('PSW',oUser.Psw).replace('TITLE',oUser.Title).replace('FIRSTNAME',oUser.Firstname).replace('SURNAME',oUser.Surname).replace('PHONE',oUser.Phone).replace('COMPANY',oUser.Company).replace('POSTCODE',oUser.Postcode).replace('MOBILE',oUser.Mobile).replace('DESCRIPTION',oUser.Description).replace('REMEMBER',oUser.Remember).replace('CID',oUser.Cid).replace('Searches',oUser.Searches).replace('RQIS',oUser.RQIs).replace('SLS',oUser.SLs)+'');
}
function setOsidilCookieSearch(id){    
    oS4E=eval('Srch'+id);
    set_cookie(OSIDILmail+'S'+id,''+oSearchCookie.replace('XID',id).replace('xDate',oS4E.Date).replace('xMatches',oS4E.Matches).replace('xRFIs',oS4E.RFIs).replace('xIG',oS4E.IG).replace('xTenure',oS4E.Tenure).replace('xSubregions',oS4E.Subregions).replace('xTown',oS4E.Town).replace('xfulTx',oS4E.fulTx).replace('xPCs',oS4E.PCs).replace('xSubtypes',oS4E.Subtypes).replace('xType',oS4E.Type).replace('xSource',oS4E.Source).replace('RQIS',oS4E.RQIs).replace('xRegions',oS4E.Regions)+'');
}

var ACCEPT='<div class=Accept><table border=0 cellspacing=0 cellpadding=0><tr><td height=100% valign=top>ACCEPT</td></tr><tr><td align=right valign=bottom><a href="javascript:Accept();">ACCEPT</a></td></tr></table></div>';
function Accept(){
    //alert(37);
    $('#htmPSW').html(PSWD2);        
    $('#logvr').attr('style','display:none');
}
function createLogin(o){
    if(fX==1 && O('cPh').value.length+O('cMbl').value.length<7)
    {
        err='Telephone or Mobile is mandatory!';
        errorAccount();
        return;
    }
    
    urlADD='';
    urlADD+=O('cTit').value+sep;
    urlADD+=O('cFrs').value+sep;
    urlADD+=O('cSrn').value+sep;
    urlADD+=O('cCmp').value+sep;
    urlADD+=O('cPh').value+sep;    
    urlADD+=O('cBrn').value+sep;
    urlADD+=O('cMbl').value+sep;
    urlADD+=O('txa').value.replace('eg. how many staff, what type of business','')+sep;
    urlADD+=(O('u1').checked ? 1 : 0)+sep+(O('u2').checked ? 1 : 0)+sep+(O('u3').checked ? 1 : 0)+sep;
    O('u4').checked=!O('u1').checked && !O('u2').checked && !O('u3').checked;
    urlADD+=(O('u4').checked ? 1 : 0)+sep;
    urlADD+=O('cMbl').value+sep;
    MAIL=$('#cMail').val();//ue;        
    if(O('pswcr').style.display!='none'){
        if(O('cPsw').value.length<3){alert('Your password must have at least 5 characters!');return;}
        urlADD+=O('cPsw').value+sep;
        res=urlADD.replace(/X9Q/g,'~');
        saveAccount(1);
    }
    else{        
        if(validate(MAIL,'aaa')){errorAccount(); return;}    
        Os('error','none');
        refreshUser();
        $('#logvr').attr('style','display:none');
        //alert(fX);
        try{
           if(fX==63 || AgPhEm[6].length<12)
                $('#htmPSW').html(PSWD2);        
            else{        
                $('#htmPSW').html(ACCEPT.replace('ACCEPT',AgPhEm[6].replace(/XX/g,"'").replace(/x39;/g,"'").replace(/x13;/g,'\r').replace(/<br>/g,'\r')));   
               /* if(TEST>0){
                    alert($('#htmPSW').html());
                    alert(ACCEPT.replace('ACCEPT',AgPhEm[6].replace(/XX/g,'"').replace(/&#39;/g,'"').replace(/&#13;/g,'<br>')));
                }*/
            }
        }
        catch(e){
            $('#htmPSW').html(PSWD2);
        }
    }    
    unsetOpacity();
}
function CheckPsw(){
    //err=O('NewPsw').value;
    if(O('NewPsw').value.length<6){
        err='your password must have at least 6 characters!';
        errorAccount();err='';
    }
    else if(O('NewPsw').value=='enter a password'){
        err='"enter a password" is not a valid password!';
        errorAccount();err='';    
    }
    else{
        //urlADD+='&psw='+O('NewPsw').value;
        PSW=O('NewPsw').value;
        urlADD+=PSW+sep;
        oUser.Psw=PSW;
        oUser.Cid=0;
        Os('error','none');
        saveAccount(0);
    }

}
function refreshUser(){
    oUser.Email=MAIL;
    oUser.Title=O('cTit').value; 
    oUser.Firstname=O('cFrs').value; 
    oUser.Surname=O('cSrn').value; 
    oUser.Phone=O('cPh').value; 
    oUser.Company=O('cCmp').value; 
    oUser.Postcode=O('cBrn').value; 
    oUser.Mobile=O('cMbl').value; 
    oUser.Psw=O('cPsw').value;
    oUser.Description=O('txa').value; 
    oUser.urgent=(O('u1').checked ? 1 : 0); 
    oUser.oneyear=(O('u2').checked ? 1 : 0); 
    oUser.rightproperty=(O('u3').checked ? 1 : 0); 
    oUser.looking=(O('u4').checked ? 1 : 0); 
        
}
function saveAccount(x){
    if(x>0)refreshUser();
    $('#container').html('We are updating your information...'); 
    AJAX = new sack();    
    AJAX.requestFile=sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexAjax.aspx?account=1&mail='+MAIL+'&p='+urlADD+'&CompanyName='+CompanyName+'&CID='+oUser.Cid+'&SID='+SID;//+"~Sv";
    AJAX.onCompletion = function(){saveAccountPost(x);};
    AJAX.runAJAX();  
}
function saveAccountPost(x){
    if(x==1){
        $('#container').html('Your account was updated!');
        deleteREFset(2);
        setOsidilCookie();
        LOGINread();
    }
    else {    
        $('#container').html('<br/><div style="text-align:left;margin-left:20px;">Your account has been created'+'<br/>email: '+oUser.Email+'<br/><b>password:<span style="font-size:20px;"> '+oUser.Psw+'</span></b></div></br>');
        $('#mAc').html('');
        oUser.Cid=AJAX.response;
        LOGGED=oUser.Cid;
        //alert(oUser.Cid);
        setTimeout(closeFloating,3000);    
        LOGINread();
    }
}
//DisShow
//function DisShow2(){DisShow();$('#container').html('');}

function validate(em,psw){
    err='';    
    if(em.length<6) err="Email is too short";
    else if(em.indexOf('@')==-1) err="Email must contain '@'";
    else if(em.indexOf('.')==-1) err="Email must contain '.'";
    else if(em.indexOf(',')>-1) err="Email cannot contain ','";
    else if(em.indexOf('¬')>-1) err="Email cannot contain '¬'";
    else if(em.indexOf('@')==0) err="Email cannot begin with '@'";
    else if(em.split('@')[1].length<5) err="Email must contain at least 4 letters after '@'";
    else if(em.split('@')[1].indexOf('.')==-1) err="Email must contain at least 1 '.' after '@'";
    if(err.length==0){
        if(MAIL==psw) err="Password cannot be the same as your email";
        else if(psw.length<3) err="Password must have at least 3 characters";    
    }
    return (err.length>0);
}

function validating(){
    MAIL=O('bEm').value;
    PSW=O('bPs').value;
    REMEMBER=(O('RmPs').checked ? '1' : '0');
    Os('error','none');
    if(validate(MAIL,PSW)){
        errorAccount();
        return false;
    }        
    return true;
}    
function errorAccount(){Os('error','block');O('error').innerHTML=err;}
function populateAccount(val){Os('error','none');O('container').innerHTML=val;flShow('floatdiv',12);}

function blr(o){if(o.value=="")return;o.style.background="#efefef";o.style.color="#0f0f0f";o.style.fontStyle="normal";o.style.fontWeight="bold";}
function fcs(o){o.select();o.style.background="#FFEBC9";o.style.color="#902100";o.style.fontStyle="italic";o.style.fontWeight="normal";
        o.style.width="300px";o.style.border="1px solid gray";o.style.height="17px";
}
function ro(o){o.style.color='#FFFFFF';o.style.backgroundColor='#707070';}
function ru(o){o.style.color='#707070';o.style.backgroundColor='#FFFFFF';}
function fcse2(o){}function fcsp2(o){}
function fcse(o){o.select();}
function fcsp(o){}
function no(o){o.className='AcO';}
function nu(o){o.className='Ac';}
function fo(o){o.className='FpswO';}
function fu(o){o.className='Fpsw';}

function Account(){
    populateAccount(dAcn.replace('LEGEND','Register a new Account for me').replace('BUTTON','Submit'));
    Os('pswcr','none');
   H=(document.documentElement.clientHeight - $('#floatdiv').height())/2+10;
   $('#floatdiv').animate({top:$(window).scrollTop()+H+"px" },{queue: false, duration: 100});
    
    //alert(52);
    if(fX==63){
        //alert(56);
        $('#aMbl').html('Phone');//$('#cMbl').attr('style','display:block;width:129px;');
    }
}
function Forgotten(){MAIL=O('bEm').value;populateAccount(dFp);O('tFp').value=MAIL;}

var nSend=0;
function ForgottenNoSend(){nSend=1;}
function ForgottenSend(){
    if(nSend==1){nSend=0;return;}
    MAIL=O('tFp').value;
    validate(MAIL,'aaa');    
    if(err!=''){   
        errorAccount();
        return;
    }
    $.post(sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexAjax.aspx', {        
        account:4
        ,mail:MAIL
        ,COmpanyName:CompanyName
        }, function(data){
            ForgottenPost(data);
            
    });  

  /*  AJAX = new sack();    
    AJAX.requestFile=sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexAjax.aspx?account=4&mail='+MAIL+'&CompanyName='+CompanyName;//?p='+O('txPC').value;    //&t=KL
    AJAX.onCompletion = function(){ForgottenPost();};
    AJAX.runAJAX();
*/
}
function ForgottenPost(D){
if(D.length>0)
    {populateAccount('<br/><div><center>Your password was sent to '+MAIL+'</center></div><br/>');
    setTimeout(LoginInfo,2500);
   }
else 
    {
    populateAccount('<br/><div><center>There is no account for '+MAIL+'. Create a new account.</center></div><br/>');
    setTimeout(Account,2500);
    }
}
function fpo(o){o.className='fpdvO';}
function fpu(o){o.className='fpdv';}

function editAccount(){
    populateAccount(dAcn.replace('LEGEND','Edit Account').replace('BUTTON','Save Account'));
    Os('cAlr','none');
    setOpacity();
    editAccounT();
}

function ShowFloatDiv(x){$('#container').html($('#'+x).html());flShow('floatdiv',12);}
function DisShowFloatDiv(){flHide('floatdiv',12);}
function DisShow(){$('#container').html('');}
function editAccounT(){
    //$('#txEmail').html('<div style="font-weight:bold;color:#337711;width:100%;text-align:left;padding-left:35px;">'+MAIL+'</div>');
    O('cMail').value=MAIL;
    O('cTit').value=oUser.Title; 
    O('cFrs').value=oUser.Firstname;O('cSrn').value=oUser.Surname; 
    O('cPh').value=oUser.Phone;O('cCmp').value=oUser.Company;O('cBrn').value=oUser.Postcode; 
    if(fX!=63)
        $('#aMbl').html('Mobile*');//$('#cMbl').attr('style','display:block;');
    
    O('cMbl').value=oUser.Mobile;
    O('cPsw').value=oUser.Psw;
    O('txa').value=oUser.Description;
    O('u1').checked=parseInt(oUser.urgent);
    O('u2').checked=parseInt(oUser.oneyear);
    O('u3').checked=parseInt(oUser.rightproperty);
    O('u4').checked=parseInt(oUser.looking);
    popInfo();
}
function txf(o){if(o.value=='eg. how many staff, what type of business')o.value="";o.style.height="70px";}
function LOGINread(){
    LOGIN='Logged in as <b>'+MAIL+'</b>';
    if(oUser.Title+' '+oUser.Firstname+' '+oUser.Surname!='')LOGIN+=', '+oUser.Title+' '+oUser.Firstname+' '+oUser.Surname;
    if(oUser.Company!='')LOGIN+=', '+oUser.Company;
    if(oUser.Phone!='')LOGIN+=', phone: '+oUser.Phone;
    if(oUser.Mobile!='')LOGIN+=', mobile: '+oUser.Mobile;
    if(oUser.Description!='')LOGIN+=', '+oUser.Description;
    if(LOGIN.length>100)LOGIN=LOGIN.substring(0,93);
    document.title=LOGIN.replace('<b>','').replace('</b>','');
    window.status=document.title;    
    if($('#LOGIN').html()=='')
        LoginBar();
    else
        $('#tdLOGIN').html(LOGIN);
}     

function editO(){O('LOGINedit').style.display='block';}function editU(){O('LOGINedit').style.display='none';}
function ReqO(){O('cREQUESTED').style.display='block';}function ReqU(){O('cREQUESTED').style.display='none';}
function SrcO(){O('cSEARCHES').style.display='block';}function SrcU(){O('cSEARCHES').style.display='none';}
function GivO(){O('cGIVEN').style.display='block';}function GivU(){O('cGIVEN').style.display='none';}

var hMySearches='<table id=dRQI onmouseover="ovRQI();" onmouseout="ouRQI();" class=RQ cellspacing=0 border=0 cellpadding=0><td id=tdnRFIs style="width:45px;"><a onmouseover="ReqO();" onmouseout="ReqU();" href="javascript:allRFIs();">click&nbsp;to&nbsp;see&nbsp;<b>my&nbsp;<span id=NRFIs>xNRFIs</span>&nbsp;Requests&nbsp;for&nbsp;Information</b></a>&nbsp;<div id=cREQUESTED>Properties for which you requested<br/>information from our Agency,<br/>but not yet received information.</div></td><td id=iIGs class=sIGs><a onmouseover="GivO();" onmouseout="GivU();" href="javascript:allIGs();"><b>nIGs&nbsp;Information&nbsp;Given</b></a>';
hMySearches+='<div id=cGIVEN>Properties for which our Agency<br/> has sent you the Information.</div></td>';
hMySearches+='<td align=right><table><tr><td id=tdnSearches><a onmouseover="SrcO();" onmouseout="SrcU();" href="javascript:showSearches();">click&nbsp;to&nbsp;see&nbsp;<b>my&nbsp;<span id=nSearches>xnSearches</span>&nbsp;Searches</b></a>';
hMySearches+='<div id=cSEARCHES>Click to see the searches<br/>you are currently running.</div></td>';
hMySearches+='</tr></table></td></tr></table>';

function SlsO(a){//alert(a);
            $("div[@name=infoSL"+a+"]").each(function(){
                $(this).attr('style','position:absolute;background:#eefeff;width:200px;text-align:left;color:Gray;border:1px solid gray;padding:3px;margin-top:20px;margin-left:-130px;');
                $(this).html('List of Property Information you are<br/>about to request from our Agency.');
            }); }
function SlsU(a){
            $("div[@name=infoSL"+a+"]").each(function(){
                $(this).attr('style','display:none');                
            }); 

}
function ConO(o,a){  o.style.backgroundColor='#cc0066';
            $("div[@name=infoRFI"+a+"]").each(function(){
                $(this).attr('style','position:absolute;background:#eefeff;width:190px;text-align:left;color:Gray;border:1px solid gray;padding:3px;');
                $(this).html('Click to prepare to send email.');
            });  
}
function ConU(o,a){o.style.backgroundColor='';
            $("div[@name=infoRFI"+a+"]").each(function(){
                $(this).attr('style','display:none');
            }); 
}
var bContactAg="<div class=EB onclick='MailSL();' onmouseover='ConO(this,XXXX);' onmouseout='ConU(this,XXXX);'>click here to <span>SAVE</span> selection and <span>Contact Agency</span> for more info</div>";
var SHORTLIST="<table border=0 cellspacing=0 cellpadding=0 class=EM><tr><td width=200px id=slTitleXXXX><a onmouseover='SlsO(XXXX);' onmouseout='SlsU(XXXX);' href='javascript:shortls();'>SHORTLIST selected Properties</a>";
SHORTLIST+="<div name=infoSLXXXX></div></td><td id=slTitle2XXXX align=right>"+bContactAg;
SHORTLIST+="<div name=infoRFIXXXX></div></td></tr></table>";

function LoginBar(){    
    UNI='<table cellspacing=0 cellpadding=0 class=LG><tr><td id=tdLOGIN>&nbsp;'+LOGIN+'</td><td align=right class=hEDIT><a onmouseover="editO();" onmouseout="editU();" href="javascript:editAccount();" >click&nbsp;to&nbsp;edit&nbsp;my&nbsp;account</a><div id=LOGINedit>Edit contact details that<br/>you have released to&nbsp;our&nbsp;Agency.</div></td></tr></table>';
   //if(TEST>0)alert(nSearches);
    if(nSearches>0){
        UNI+=hMySearches.replace('xNRFIs',NRFIs).replace('nIGs',nIGs).replace('xnSearches',nSearches);
        //if()
    }
        
    UNI+='<div id=dSL0></div><div id=dSearches></div>';    
    $('#LOGIN').html(UNI);
    if(nSearches>0 && NRFIs==0){
        $('#tdnRFIs').html('');
        if(nIGs==0)
            $('#iIGs').html('');
    }
        
    
    if(bShortlist)loadSL();else $('#dSL').html('');
    
    Os('LOGIN','block');
}
function allRFIs(){
   if(NRFIs==0)return;
   prevURL='';   
   if(wasSearches){$('#dSearches').html('');O('dSearches').style.height='0px';wasSearches=false;}   
   COLOR='#FFFFDC';
   AJAX = new sack();
   AJAX.requestFile = sLevel.substring(1,url_level+1).replace(/./g,'../')+'json.aspx?RFIs='+oUser.RQIs;
   AJAX.onCompletion=function(){showRQIpost();}
   AJAX.runAJAX(); 
   Oc('dRQI','RQc');
}
function showRQIpost(){
    eval(AJAX.response);
    cPage=0;
    nResult=CNT=NRFIs;
    Os('leftpanel','none');Os('rightpanel','none');
    Os('result','block');
    Os('searchlisting','block');
    TYPE=1;
    page_a();
    //try{catch(e){}}
}
function allIGs(){alert('No information given yet');}
function SrchDelete(sid){
   var del=window.confirm("Are you sure you want to delete this search?")
   if(!del)return;
   AJAX = new sack();
   AJAX.requestFile = sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexAjax.aspx?SearchDelete=1&SID='+sid;
   AJAX.onCompletion=function(){SrchDeletePost(sid);}
   AJAX.runAJAX(); 
}
function SrchDeletePost(sid){
    $('#OSR'+sid).html('');
    O('OSR'+sid).style.height='0px';
    $('#dS'+sid).html('');
    O('dS'+sid).style.height='0px';
    nSearches--;
    oS4E=eval('Srch'+sid);    
    NRFIs-=oS4E.RFIs;// rfi;    
    SIDs=SIDs.replace(','+sid,'');
    $('#NRFIs').html(NRFIs);
    $('#nSearches').html(nSearches);
    oUser.Searches=nSearches;
    //oUser.RQIs=NRFIs;
    setOsidilCookie();
}


function closeLnd(){Os('Central','none');}
function oMat(sid){if(O('bM'+sid).className!='bMC')O('bM'+sid).className='bMO';O('HvM'+sid).style.display='block';}
function uMat(sid){if(O('bM'+sid).className!='bMC')O('bM'+sid).className='bM';O('HvM'+sid).style.display='none';}
function oRfi(sid){if(O('bR'+sid).className!='bRC')O('bR'+sid).className='bRO';O('HvR'+sid).style.display='block';}
function uRfi(sid){if(O('bR'+sid).className!='bRC')O('bR'+sid).className='bR';O('HvR'+sid).style.display='none';}
function oDel(sid){O('HvD'+sid).style.display='block';}
function uDel(sid){O('HvD'+sid).style.display='none';}

var hSrch='';
function showSearches(){
    prevURL='';
    if(wasSearches){
        //if(dvSearches4Each)    
        if($('#dSearches').html().length>0)
            $('#dSearches').html('');
        else     
            $('#dSearches').html(dvSearches4Each);
        return;
    }
    arSIDs=SIDs.split(',');
    dvSearches4Each=''
    try{
        for(var i=1;i<=nSearches;i++){
            oS4E=eval('Srch'+arSIDs[i]);            
            dvSearches4Each+=htmlSearchResult.replace('LEFT',sLeft.replace('nig',oS4E.RFIs>0 ? 'nig' : 'n').replace('bR',oS4E.RFIs>0 ? 'bR' : 'n').replace('Date',oS4E.Date).replace('bG',(oS4E.IGs>0 ? 'bG' : 'n'))).replace(/SID/g,oS4E.SID).replace(/xMatches/g,oS4E.Matches).replace(/xRFIs/g,oS4E.RFIs).replace(/xIGs/g,oS4E.IG).replace('CENTER',retLoc()).replace('RIGHT',sRight.replace('SOURCE',oS4E.Source.toLowerCase()).replace(/SID/g,oS4E.SID));
        }
    }  catch(e){   }
    O('dSearches').style.height='';
    $('#dSearches').html(dvSearches4Each);//innerHTM
    $('#dvsALL').html('');
    Os('searchlisting','none');
    Os('searchlisting2','none');    
    wasSearches=true;
}
var arMatches=Array();

function normMatches(){
    arSIDs=SIDs.split(',');
    try{
    for(i=1;i<arSIDs.length;i++){
        if(arSIDs[i]!=null){
            Oc('bM'+arSIDs[i],'bM');
            //alert('W'+O('bR'+arSIDs[i]).className+'W');
            //alert(O('bR'+arSIDs[i]).className!='n');
            if(O('bR'+arSIDs[i]).className!='n')
                Oc('bR'+arSIDs[i],'bR');
            O('dS'+arSIDs[i]).innerHTML='';
            O('dS'+arSIDs[i]).style.height='0px';    
        }
    }
    }    catch(e){//alert(e.message);
    }
}
function Matches(sid,N){    
    if(O('bM'+sid).className=='bMC')
    {   O('dS'+sid).innerHTML='';
        O('dS'+sid).style.height='0px';
        Oc('bM'+sid,'bM');
        return;
    }    
    normMatches();
    O('dS'+sid).style.height='';    
    Oc('bM'+sid,'bMC');
    if(arMatches[sid]!=undefined){
        O('dS'+sid).innerHTML=arMatches[sid];
        return;
    }
    oS4E=eval('Srch'+sid);
    O('dS'+sid).innerHTML=LOADING;
    
    COLOR='';
    //alert('json.aspx?CM=0&FL=0&Search=1&SID='+sid);
    AJAX = new sack();    
    AJAX.requestFile =sLevel.substring(1,url_level+1).replace(/./g,'../')+'json.aspx?CM=0&FL=0&Search=1&SID='+sid;    
    AJAX.onCompletion = function(){MatchesPost(sid,N);};
    AJAX.runAJAX();    
}
//var kk=0;
function MatchesPost(sid,n){    
    eval(AJAX.response);
    dItems='';
    $('#dvsALL').html('');
    CNT=n;//
    //alert(AJAX.response);
    for(var i=1;i<=CNT;i++){
        try{
        COLOR='';
        //alert(eval('Q'+i).p);
        if(oUser.RQIs.indexOf(eval('Q'+i).p)>-1)COLOR='#FFFFDC';
        pop_all(i);                
        }
        catch(e){//alert(e.message);
        }
       
        //kk++;        if(kk>5)break;
    }
    arMatches[sid]=dItems.replace(/Nnn/g,'n');    
    $('#dS'+sid).html(arMatches[sid]);
}
function showSearchesPost(){}
//function RFIoff(sid){O('bR'+sid).className='bR';O('dS'+sid).innerHTML='';O('dS'+sid).style.height='0px';}
function RFIs(sid,N){
    if(O('bR'+sid).className=='bRC')
    {   O('dS'+sid).innerHTML='';
        O('dS'+sid).style.height='0px';
        Oc('bR'+sid,'bR');
        return;
    }    
    normMatches();
    O('dS'+sid).style.height='';    
    Oc('bR'+sid,'bRC');       
    if(arWasRFIs[sid]!=undefined){
        O('dS'+sid).innerHTML=arWasRFIs[sid];
        return;
    }     
    O('dS'+sid).innerHTML=LOADING;
    COLOR='#FFFFDC';
    AJAX = new sack();
    AJAX.requestFile = sLevel.substring(1,url_level+1).replace(/./g,'../')+'json.aspx?SID='+sid;
    AJAX.onCompletion=function(){showRFIs(sid,N);}
    AJAX.runAJAX(); 
}

function showRFIs(sid,N){     
    eval(AJAX.response);
    dItems='';
    try{
    for(var i=1;i<=N;i++)
        pop_all(i);            
     }
     catch(e){}//alert(12);
    arWasRFIs[sid]=dItems.replace(/Nnn/g,'n');
    $('#dS'+sid).html(arWasRFIs[sid]);
}
function ouRQI(){if(O('dRQI').className!="RQc")Oc('dRQI','RQ');}
function ovRQI(){if(O('dRQI').className!="RQc")Oc('dRQI','RQo');}
function deleteREFset(x){setTimeout(DisShowFloatDiv,x*1000-1000);}
function closeFloating(){flHide('floatdiv',12); unsetOpacity();}
function openFloating(){flShow('floatdiv',12);}

function mail(){    //delete_cookie(OSIDILmail);    
    if(LOGGED==''){
       setOpacity();
       res=get_cookie(OSIDILmail);           
       //if(res!='..1' || isEMAIL.length>0)
          //  Login();
        //else            Account();       
        if(isEMAIL.length>0){
            MAIL=isEMAIL;    
            LoginInfo();            
        }
        else{
            try{ 
                oUser=eval(res); 
                MAIL=oUser.Email;    
                REMEMBER=oUser.Remember;
                PSW=oUser.Psw;    
                LoginInfo();        
            }
            catch(e){
                MAIL='';
                LoginInfo();
                /*if(isEMAIL.length==0)
                    Account();
                else{
                    MAIL=isEMAIL;    
                    LoginInfo();
                }*/
                
            }
        }        
    }       
}

function setOpacity(){
    $('#dvsALL').css('opacity',0.5);    
    $('#propsearch').css('opacity',0.5);    
    if(fX==63){
        $('#pagetext').css('opacity',0.5);
        $('#header').css('opacity',0.5);
        $('#ukmap').css('opacity',0.5);
        $('#content').css('opacity',0.5);
        $('#imhome').css('opacity',0.5);
        $('#sTitle').css('opacity',0.5);
        $('#mAc').css('opacity',0.5);
        $('#right').css('opacity',0.5);
    } 
}
function unsetOpacity(){
    $('#dvsALL').css('opacity',null);    
    $('#propsearch').css('opacity',null);    
    if(fX==63){
        $('#pagetext').css('opacity',null);
        $('#header').css('opacity',null);
        $('#ukmap').css('opacity',null);
        $('#content').css('opacity',null);
        $('#imhome').css('opacity',null);
        $('#sTitle').css('opacity',null);
        $('#mAc').css('opacity',null);
        $('#right').css('opacity',null);
    } 
}


//function Login(){}
function LoginInfo(){populateAccount(dLgn.replace('MAIL',MAIL).replace('PSW',(REMEMBER=='1' ? PSW : '')).replace('checked',(REMEMBER=='1' ? 'checked' : '')));}
function check(id){
    ev=eval('cb'+arCbs[id]);
    if(ev.checked){
        ev.checked=false;
        ev=eval('sp'+arCbs[id]);
        ff=ev.className;    
        ev.className="spcb";
    }
    else{
        ev.checked=true;
        ev=eval('sp'+arCbs[id]);
        ff=ev.className;
        ev.className="spcb clic3";
    }
}
function popInfo(){
      if(fX==63)return;
  //  alert($('#aCmp').html());
    if($('#aCmp').html()==''){
        $('#aCmp').html('Company');
        $('#aBrn').html('Postcode');
        $('#aPh').html('Phone 2');
        Oc('cCmp2','block');Oc('cBrn2','block');Oc('cPh2','block');
    }
}

function shortls_post(){
   dItems='';//COLOR='#F0F0FF';
   bShortlist=true;
   for(i=0;i<arShortList.length;i++){
        if(arShortList[i]!=null){
            aItem=slItm;
            ob=arShortList[i];            
            pop_allPost();
        }
    }
    Os('loading','none');
    LoginBar();
    wasSearches=false;
    O('dvsALL').innerHTML+=dItems;   
}

function MailSL(){  mailSL();//populateAccount(Request4Info);
}
function Sent(){DisShowFloatDiv();bShortlist=false;   Return();}

var iMails4PROP=0,urlADD2='',ps='';
function Mails4PROP(){
    ob=arShortList[iMails4PROP];
    if(ob!=null){
        ps+=ob.I+',';
        NRFIs++;
        //urlADD2=ob.I;
        urlADD+=ob.t+', '+(ob.e=='' ? '' : ob.e+', ')+(ob.l=='' ? '' : ob.l+', ')+ob.c+'WQX';    
        AJAX = new sack();        
        AJAX.requestFile=sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexMails.aspx?Ids='+ob.I+'&Visitor='+oUser.Cid;//mailTo='+ob.g+'&mailFrom='+MAIL+'&SL='+urlADD2+'&ps='+ps+'&CID='+oUser.Cid+'&SID='+aSIDs[iMails4PROP]+'&Source=4PROP&CLIENT='+CLIENT();
        AJAX.runAJAX();           
    }
    iMails4PROP++;
    if(iMails4PROP<arShortList.length){
       setTimeout(Mails4PROP,500);    
    }
    else
    {
      iMails4PROP=0;
      ps=ps.substring(0,ps.length-1);
      SentPost(ps); 
    }
}
function mailSL(){

    ps='';urlADD='';
    $('#dSL').html('');$('#dSL0').html('');        
    if(fX==63){// AgPhEm==undefined){
        var AgMails='';
        urlADD='';
        setTimeout(Mails4PROP,500);  
    }
    else{      
        for(i=0;i<arShortList.length;i++){
            if(arShortList[i]!=null){  
                ob=arShortList[i];
                ps+=ob.I+',';
                NRFIs++;
                urlADD+=ob.t+', '+(ob.e=='' ? '' : ob.e+', ')+(ob.l=='' ? '' : ob.l+', ')+ob.c+'WQX';
            }
        }     
        ps=ps.substring(0,ps.length-1);
        AJAX = new sack();
       // if(TEST>0)
         //   alert('IndexMails.aspx?Ids='+ps+'&Visitor='+oUser.Cid+'&CompanyAB='+AgPhEm[0]);
        AJAX.requestFile=sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexMails.aspx?Ids='+ps+'&Visitor='+oUser.Cid+'&CompanyAB='+AgPhEm[0];   //mailTo='+AgPhEm[2]+'&mailFrom='+MAIL+'&SL='+urlADD+'&ps='+ps+'&CID='+oUser.Cid+'&SID='+lastSlSID+'&Source='+AgPhEm[0].replace('&','')+'&CLIENT='+CLIENT();        
        AJAX.runAJAX();
        SentPost(ps);
    }
    
    nSearches=SIDs.split(',').length-1;//++;    
    if(O('nSearches')!=null){//nSearches>1
        $('#nSearches').html(nSearches);
        $('#NRFIs').html(NRFIs);
    }
    else
        O('LOGIN').innerHTML+='<table id=dRQI onmouseover="ovRQI();" onmouseout="ouRQI();" cellspacing=0 cellpadding=0 class=RQ><td id=tdnRFIs><a href="javascript:allRFIs();"><span id=NRFIs>'+NRFIs+'</span>&nbsp;Requestes&nbsp;for&nbsp;Information</a>'+REQUESTED+'</td><td><table><tr><td id=tdnSearches><a href="javascript:showSearches();"><span id=nSearches>'+nSearches+'</span>&nbsp;Searches</a></td><td class=sIGs><a href="javascript:allIGs();">'+nIGs+'&nbsp;Information&nbsp;Given</a></td><td class=Report><a href="javascript:Report();">Report</a></td></tr></table></td></tr></table>';
          
    Oc('EM','n');     
}

function SentPost(ps){ 
  if(AgPhEm!=undefined)//null
    populateAccount(dReply2Client.replace(/PIDS/,urlADD.replace(/WQX/g,'<br/><br/>')).replace(/COMPANY/,AgPhEm[0]).replace(/PHONE/,AgPhEm[1]));
  else
    populateAccount(dReply2Client.replace(/PIDS/,urlADD.replace(/WQX/g,'<br/><br/>')).replace(/COMPANY/,'4PROP').replace(/PHONE/,'')); 
        //ShortlistSEND(ps);
  oUser.RQIs+='.'+ps.replace(/,/g,'.');
  setOsidilCookie();
  bShortlist=false;

  $('#dvsALL').html('');  
  Os('searchlisting','none');
  shortList_js.q='';
  arShortList=new Array();
}

function toShortlistDB(pid,del){                      
   urlADD=sLevel.substring(1,url_level+1).replace(/./g,'../')+'IndexAjax.aspx?pid='+pid+'&del='+del+'&cid='+LOGGED+'&sid='+SID;
   //if(TEST>0)alert(urlADD);
   AJ(urlADD);    
}

function AJ(url){AJAX = new sack();AJAX.requestFile = url;AJAX.runAJAX();}
	
var rep1='*';
function retLoc(){
    Center='<b>T: </b>'+Type(oS4E.Type);
    if(oS4E.Subtypes.length>0)
      Center+=' ('+Subs('Sbts',oS4E.Subtypes.split(','))+')';
    Center+='<br/><b>L: </b>';
    if(oS4E.Regions.length>0 && oS4E.Regions!='0'){
        Center+=Region(oS4E.Regions);  
        if(oS4E.Subregions.length>0)
          Center+=' ('+Subs('Cts',oS4E.Subregions.split(','))+')';
    }
    else if(oS4E.London.length>0)Center+=oS4E.London;      
    else if(oS4E.PCs.length>0) Center+=oS4E.PCs;
    else if(oS4E.Towns.length>0) Center+=oS4E.Towns;
    else if(oS4E.Towns2.length>0) Center+=oS4E.Towns2.replace(/\*/g,', ');
                  
    if(oS4E.fulTx.length>0){
        oS4E.fulTx=oS4E.fulTx.replace(/OR/g,'').replace(/\*/g,'').replace(/\"/g,'');
        Center+='<br/>searched words:'+oS4E.fulTx;    
    }
    Center+='<br/>'+retTenure(oS4E.Tenure);    
    return Center;
}
function retTenure(tenure){
    switch(parseInt(tenure)){
        case 0:
            return 'All Tenures';
            break;    
        case 15:
            return 'All Tenures';
            break;
        case 12:
            return 'Freeholds / Long Leases';
            break;
        case 3:
            return 'Leases / Short Leases';
            break;    
    }
}

function Type(x){return eval('JsPts.v'+x);}
function Region(x){return eval('JsRgs.v'+x);}

function Subs(typ,xs){
    xX='';
    for(var i=0;i<xs.length;i++){
    if(xs[i].length>0)
    xX+=eval('js'+typ+'.s'+xs[i])+', ';
    }
    return xX.substring(0,xX.length-2);
}

function s3wCh(){
    if((O('selPT').selectedIndex>0 ||  O('selRG').selectedIndex>0)
        && O('s3w').value.length>2 && O('s3w').value.split(' ').length<4 && O('s3w').value!='match on all searchwords max 3' )
        GoOn();
      else
      GoOf();
}
var prevURL='', bS3W=0;

function S3W(){
    bS3W=0;
    if(O('s3w').value=="match on all searchwords max 3")bS3W=1;
    if(O('s3w').value.split(' ').length>3)bS3W=2;
    if(O('s3w').value.length<2)bS3W=3;
}

function page_number(){
    SHOWtitle='all '+nResult;
    if(nResult>20){
        if(parseInt(20*(cPage-1)+21)>nResult)
            SHOWtitle=parseInt(nResult-20)+'-'+nResult+' of '+nResult;
        else 
            SHOWtitle=parseInt(20*(cPage-1)+1)+'-'+parseInt(20*(cPage-1)+20)+' of '+nResult;
    }
}



function set_cookie(key,value){
  cookie_string = key + "=" + escape ( value );
  cookie_string += "; expires=" + expires.toGMTString();   
  document.cookie = cookie_string;
}

function get_cookie(key){
  results = document.cookie.match ( '(^|;) ?' + key + '=([^;]*)(;|$)' );//cookie_name
  if ( results )
    return ( unescape ( results[2] ) );
  else
    return '..1';
}

function get_mail()//cookie_name
{
  results = document.cookie.match ( '(^|;) ?' + ckMail + '=([^;]*)(;|$)' );//cookie_name
  if ( results )
    return ( unescape ( results[2] ) );
  else
    return '!!!!!';
}
function set_mail (value)//name,, exp_y, exp_m, exp_d, path, domain, secure )
{
  cookie_string = ckMail + "=" + escape ( value );//name
  expires = new Date ( ckDate.getFullYear()+1, ckDate.getMonth(), ckDate.getDay());// exp_y, exp_m, exp_d
  cookie_string += "; expires=" + expires.toGMTString();   
  document.cookie = cookie_string;
}

function delete_cookie(key){
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = key += "=; expires=" + cookie_date.toGMTString();
}

function flShow(x,trn){
    Os(x,'block');
    if(!is_ie)return;    
    O(x).filters[0].Apply();
    O(x).style.visibility="visible";
    O(x).filters[0].transition=trn; 
    O(x).filters.revealTrans.play();    
}

function flHide(x,trn){
    if(!is_ie){Os(x,'none');return;};   
    O(x).filters[0].Apply();
    O(x).style.visibility="hidden";
    O(x).filters[0].transition=trn;
    O(x).filters.revealTrans.play();    
}
function O(id){return document.getElementById(id)}
function Os(id,vl){try{O(id).style.display=vl;}catch(e){}}
function Oc(id,cl){try{O(id).className=cl;}catch(e){}}
String.prototype.trim = function () {return this.replace(/^\s*/, "").replace(/\s*$/, "");}
function check_phone(o){if (!IsNumeric(o.value)){alert('Phone must be numeric');o.value="";}}


function pop_all(id){
    Html(id);
}
var AGENCY,Ag0='',Ag='<span class=agAB id=ASREF><a href="javascript:Ad2SL(xID,REF);">NAME</a></span> <span class=agAB2 id=AS2REF style="display:none;" ><a href="javascript:shortls();"><span style="text-decoration:none;">go to shortlist to request detailed information</span>'; 
var aStatus=Array('Available','Under Offer','Withdrawn','','Completed');
var oUNI,HTM;
function retPic(){
   if(showPIC==0  && oUNI.M==0)
        return img.replace('PID_thumb','NO');  
    if(oUNI.H==0){
        if (oUNI.Gd==1)
            return imgGoogle.replace('PID',oUNI.I);
        else
            return latitude.replace(/LAT/g,oUNI.Lat).replace(/LON/g,oUNI.Lon);
     }        
    else
        return img.replace('PID',oUNI.I);
}
function retPicT(){return oUNI.H==0 ? 'xIW' : 'xIpc';  }
var FilesCid='',FilesBid='';
function showMap(x){
    oUNI=eval('Q'+x);
    window.open('http://www.4prop.com/map1.htm?g='+oUNI.Lat+'*'+oUNI.Lon,"Google","status=1,resizable=1,toolbar=0,height=650,width=510"); 
}

var htmMultipleFiles='<fieldset class=Register><legend>There are XX attachments&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
htmMultipleFiles+='<input onclick="closeFloating();" class=lgClose2 style="width:25px;" type=button value=X /></legend>';
htmMultipleFiles+='<table style="width:600px;position:relative;top:-4px;" cellpadding=0 cellspacing=0>';
htmMultipleFiles+='<tr><td class=FilesPids>PIDS</td></tr>';
htmMultipleFiles+='<tr><td class=LoginBodyBottom ></td></tr></table>';
htmMultipleFiles+='</fieldset>';

function FcO(o){$(o).attr('style','background:#aabbee;color:#001133');}
function FcU(o){$(o).attr('style','');}
function FilesClose(){document.getElementById('FILESclose').style.display="none";}

var zeroes="0000000000000";
function ret10(p){return zeroes.substr(0,10-p.length)+p;}
function showDetSpec(fid,ext){
   document.getElementById('FILESclose').style.display="block"; 
   document.getElementById('FILESclose').style.top=$(window).scrollTop()+"px";
   document.getElementById('FILES').src='http://www.4prop.com/Files.aspx?CID='+FilesCid+'&BID='+FilesBid+'&FID='+fid+'&Ext='+ext+'&u='+oUser.Cid+'&p='+oUNI.I+'&s=4';
}

function showDet(x){
    oUNI=arShortList[x];
    if(oUNI==undefined)
	oUNI=eval('Q'+x);	
    if(oUser.Cid.length==0)oUser.Cid=0;
    n_files='';
           
	if(oUNI.f==1){
           document.getElementById('FILESclose').style.display="block"; 
           document.getElementById('FILESclose').style.top=$(window).scrollTop()+"px";
           document.getElementById('FILES').src="http://www.osidil.com/Files.aspx?CID="+ret10(oUNI.Fp.split(',')[0])+'&BID='+ret10(oUNI.Fp.split(',')[1])+'&FID='+oUNI.Fp.split(',')[2]+'&Ext='+oUNI.Fp.split(',')[3].split('.')[1].split('_')[0]+'&u='+oUser.Cid+'&p='+oUNI.I+'&s=4';
	}
	else{ 
       var hF=oUNI.Fp.split('*'),hF2='',hFb='<div class=Files><a style="width:325px;" href="javascript:showDetSpec(FID,\'EXT\')">XX</a></div>';
	   FilesCid=ret10(hF[0].split(',')[0]);
	   FilesBid=ret10(hF[0].split(',')[1]);

            for(var i=0;i<hF.length;i++)
               hF2+=hFb.replace('FID',hF[i].split(',')[2]).replace('XX',hF[i].split(',')[3]).replace('EXT',hF[i].split(',')[3].split('.')[1].split('_')[0]);        
        
            populateAccount(htmMultipleFiles.replace('XX',hF.length).replace('PIDS','<br/>'+hF2));
	}


}

function Desc3(){
    return oUNI.s.replace(/,/g,'<br/>')
}

function PopBlock(i){//alert(HTM);
    loc=(oUNI.l=='' ? '' : '<b>'+oUNI.l+'</b><br>')+oUNI.c+(oUNI.e=='' ? '' : '<br>'+oUNI.e);         
     if(oUNI.M==0 && fX!=63) 
         AGENCY=Ag.replace('NAME','add to shortlist for our Acquisition service');       
     else 
         AGENCY=Ag.replace('NAME','add to shortlist for more information');     
    //if(TEST>0){alert("oUNI.M="+oUNI.M+", oUNI.f"+oUNI.f);}
    if(oUNI.f==0 || oUNI.M==0)// && fX!=63))
        return HTM.replace('SHORTLIST',AGENCY).replace('<a href="javascript:showDet(xID);" class=xB title="Select this ">PDF</a>&nbsp;<a class=xD title="Select this ">Word</a>','').replace(/xID/g,i).replace('xSTATUS',aStatus[oUNI.a]).replace('TITLE',oUNI.t).replace(/REF/g,oUNI.I).replace('DESC4',oUNI.D).replace('aSTATUS',oUNI.a).replace('SRC',retPic()).replace('xIpc',retPicT()).replace('DESC1',loc).replace('DESC2',oUNI.S+'<br>'+oUNI.P).replace('DESC3',Desc3());
    else
        return HTM.replace('SHORTLIST',AGENCY).replace(/xID/g,i).replace('xSTATUS',aStatus[oUNI.a]).replace('TITLE',oUNI.t).replace(/REF/g,oUNI.I).replace('DESC4',oUNI.D).replace('aSTATUS',oUNI.a).replace('SRC',retPic()).replace('xIpc',retPicT()).replace('DESC1',loc).replace('DESC2',oUNI.S+'<br>'+oUNI.P).replace('DESC3',Desc3());
}
function rAgency(){
    if(fX==63)
        return oUNI.g;
    else
        return oUNI.M==1 ? "<span class=Blu>"+AgPhEm[0]+"<span>" : '';
}
function PopBlockSL(i){
    loc=(oUNI.l=='' ? '' : '<b>'+oUNI.l+'</b><br>')+oUNI.c+(oUNI.e=='' ? '' : '<br>'+oUNI.e);    
    if(oUNI.f==0 || (oUNI.M==0 && fX!=63))
        return HTM.replace('Select ?</a>','Deselect ?</a>&nbsp;&nbsp;&nbsp;<a href="javascript:Return();">Return</a>').replace('xDv','xDv0Sel').replace('SHORTLIST',rAgency()).replace('<a href="javascript:showDet(xID);" class=xB title="Select this ">PDF</a>&nbsp;<a class=xD title="Select this ">Word</a>','').replace(/xID/g,i).replace('xSTATUS',aStatus[oUNI.a]).replace('TITLE',oUNI.t).replace(/REF/g,oUNI.I).replace('DESC4',oUNI.D).replace('aSTATUS',oUNI.a).replace('SRC',retPic()).replace('xIpc',retPicT()).replace('DESC1',loc).replace('DESC2',oUNI.S+'<br>'+oUNI.P).replace('DESC3',Desc3());
    else
        return HTM.replace('Select ?</a>','Deselect ?</a>&nbsp;&nbsp;&nbsp;<a href="javascript:Return();">Return</a>').replace('xDv','xDv0Sel').replace('SHORTLIST',rAgency()).replace(/xID/g,i).replace('xSTATUS',aStatus[oUNI.a]).replace('TITLE',oUNI.t).replace(/REF/g,oUNI.I).replace('DESC4',oUNI.D).replace('aSTATUS',oUNI.a).replace('SRC',retPic()).replace('xIpc',retPicT()).replace('DESC1',loc).replace('DESC2',oUNI.S+'<br>'+oUNI.P).replace('DESC3',Desc3());
}

function Html(id){
    //alert(id);
    try{oUNI=eval('Q'+id); 
     HTM=htmItem.replace('DATE',oUNI.d).replace(/COLOR/g,COLOR);
     //HTM=htmItem;
     dItems+=PopBlock(id);
     } catch(e)
     { 
        alert(e.message);
        return;
     }  
     //pop_allPost();  
     //alert(dItems);
}
function Select(I,p){
    if($('#dVw'+I).html().indexOf('Select ?')>-1)
        Ad2SL(I,p);
    else{    
        $('#dVw'+I).html($('#dVw'+I).html().replace('Deselect ?','Select ?'));
        O('dVw'+I).className='xDv';
        Deselect(I,p);
     }
}
function Deselect(js,p){
    shortList_js.q=shortList_js.q.replace(','+p,'');
    if(isSL)
        oUNI=arShortList[js];
    else
        ob=eval('Q'+js);
    if(AgentAB_B)    
        NotShowAgentPids=NotShowAgentPids.replace(','+p,'');

    oS4E.PIDs=oS4E.PIDs.replace(','+p,'');
    oS4E.RFIs--;        
    if(oS4E.PIDs.length<2)
        SIDs=SIDs.replace(','+SID,'');        
    //del ajax        
    toShortlistDB(p,1);
    
    if(isSL)
        $('#dVw'+js).html('');        
    else
    {
        if(TYPE==2){
        }
        else{
            try{
                O('AS2'+p).style.display='none';
                if(ob.M==0) //mine
                    $('#AS'+p).html(Ag.replace('NAME','add to shortlist for more information'));       //  agent[1]   
                else 
                    $('#AS'+p).html(Ag.replace('NAME','add to shortlist for our Acquisition service'));                 
                    
            }            
            catch(e){}
        }
    }
    ShortlisCheck();
    for(i=0;i<arShortList.length;i++){
        if(arShortList[i]!=null && arShortList[i]==ob){
            arShortList[i]=null;                
        }
    }
}

function ShortlisCheck(){
    if(O('slTitle0')!=null){
        if(shortList_js.q.split(',').length<2){
            $('#slTitle0').html("All items of your shortlist were removed");                 
            $('#slTitle20').html('');
            $('#slTitle77').html("All items of your shortlist were removed");                 
            $('#slTitle277').html('');
            $('#slTitle88').html("All items of your shortlist were removed");                 
            $('#slTitle288').html('')            
            bShortlist=false;
            setTimeout(LoginBar,1000);
        }
        else{
            $('#slTitle0').html("<a href='javascript:shortls();'>click to view "+parseInt(shortList_js.q.split(',').length-1)+" selected Properties</a>"); 
            $('#slTitle77').html("<a href='javascript:shortls();'>click to view "+parseInt(shortList_js.q.split(',').length-1)+" selected Properties</a>"); 
            $('#slTitle88').html("<a href='javascript:shortls();'>click to view "+parseInt(shortList_js.q.split(',').length-1)+" selected Properties</a>");                 
        }
    }
}

function to_shortlist_del(js,p){//ord,js,
        shortList_js.q=shortList_js.q.replace(','+p,'');
        ob=eval('Q'+js);
        if(AgentAB_B)    
            NotShowAgentPids=NotShowAgentPids.replace(','+p,'');

        oS4E.PIDs=oS4E.PIDs.replace(','+p,'');
        oS4E.RFIs--;        
        if(oS4E.PIDs.length<2)
        SIDs=SIDs.replace(','+SID,'');        
        //del ajax
        
        toShortlistDB(p,1);
        if(TYPE==2){Os('si'+p,'none');Os('si2'+p,'none');}
        else{
            O('si'+p).style.background='';
            O('si2'+p).style.background='';
            try{$('#AS'+p).html('<a href="javascript:Ad2SL('+js+','+p+');">Please Add to Shortlist</a>&nbsp;');}
            catch(e){}
        }
        
        ShortlisCheck();
        for(i=0;i<arShortList.length;i++){
            if(arShortList[i]!=null && arShortList[i]==eval('Q'+js)){
                arShortList[i]=null;                
            }
        }
}
var NotShowAgentPids='',aSIDs=new Array();
var AgentAB_B=false,arCIDs=new Array(),arSIDs=new Array(),CIDs='',lastSlSID='',SIDs='',SIDs2Send='';

function floatDismis(x){setTimeout(floatDismisPost,x);}
function floatDismisPost(){flHide('floatdiv',12);}
function get_resultErr(msg){
    O('container').innerHTML=UNI.replace('UNI','DISMIS').replace('TITLE',HELPtitle).replace('TITLE','Incomplete search information').replace('CLOSE',HELPclose).replace('UNI',msg);
    flShow('floatdiv',12);
    floatDismis(3000);
}
function ov(o){
    if(o.className.indexOf('clicked')==-1) o.className+=' over'; 
    else o.className=o.className.replace('clicked', 'overC');  
}
function ou(o){
    if(o.className.indexOf('overC')==-1) o.className=o.className.replace(' over', '');
    else o.className=o.className.replace('overC', 'clicked');
}  
function ov2(o){
    if(o.className.indexOf('clic')==-1) o.className+=' over2';
    else o.className=o.className.replace('clic', 'overC');          
}
function ou2(o){
    if(o.className.indexOf('overC')==-1) o.className=o.className.replace(' over2', '');
    else o.className=o.className.replace('overC', 'clic');
}  
function ov4(o){
    if(o.className.indexOf('clic')==-1) o.className+=' over4';
    else o.className=o.className.replace('clic', 'overC');  
}
function ou4(o){
    if(o.className.indexOf('overC')==-1) o.className=o.className.replace(' over4', '');
    else o.className=o.className.replace('overC', 'clic');
} 
function ov3(o){
    if(o.className.indexOf('clic3')==-1) o.className+=' over3';
    else o.className=o.className.replace('clic3', 'overC3');  
}
function ou3(o){
    if(o.className.indexOf('overC3')==-1) o.className=o.className.replace(' over3', '');
    else o.className=o.className.replace('overC3', 'clic3');
} 

function Ad2SL(js,p){    
    if(shortList_js.q.indexOf(','+p)>-1)
        Deselect(js,p);
    else{
        try{$('#AS'+p).html('');O('AS2'+p).style.display='block';} catch(e){}    			
        shortList_js.q+=','+p;      
        lastSlSID=SID;
        if(AgentAB_B)    
            NotShowAgentPids+=','+p;
        mail();
        ob=eval('Q'+js);
        toShortlistDB(p,0);
        aSIDs[aSIDs.length]=SID;
        arShortList[arShortList.length]=ob;   
        
        O('dVw'+js).className='xDv0Sel';
        O('dVw'+js).innerHTML=O('dVw'+js).innerHTML.replace('Select ?','Deselect ?');
        oS4E.PIDs+=','+p;
        oS4E.RFIs++;
        if(SIDs.indexOf(','+SID)==-1) 
              SIDs+=','+SID;
        if(O('slTitle0')!=null){
            $('#slTitle0').html("<a href='javascript:shortls();'>"+parseInt(shortList_js.q.split(',').length-1)+" selected Properties</a>");                
            $('#slTitle77').html("<a href='javascript:shortls();'>"+parseInt(shortList_js.q.split(',').length-1)+" selected Properties</a>");
            $('#slTitle88').html("<a href='javascript:shortls();'>"+parseInt(shortList_js.q.split(',').length-1)+" selected Properties</a>");
        }
        else{
            bShortlist=true;
	    
	        if(LOGGED!='' && $('#dSL').html().length==0)
                loadSL();
        }    
    }
    $('#AS'+p).html('');
    O('AS2'+p).style.display='block';
}

function loadSL(){
   $('#dSL').html(SHORTLIST.replace(/XXXX/g,'88').replace('SHORTLIST','click to view '+parseInt(shortList_js.q.split(',').length-1)));
   if($('#dvsALL').html().length>0)
        $('#dvsALL').html($('#dvsALL').html()+SHORTLIST.replace(/XXXX/g,'77').replace('SHORTLIST','click to view '+parseInt(shortList_js.q.split(',').length-1)));
   $('#dSL0').html(SHORTLIST.replace(/XXXX/g,'0').replace('SHORTLIST','click to view '+parseInt(shortList_js.q.split(',').length-1)));//dSL0
   $('#dSL').animate({top:$(window).scrollTop()+7+"px" },{queue: false, duration: 100});    
}
function shortls(){
    if(shortList_js.q.length<2){
        alert('You have not yet selected any item to the shortlist!');
        return;
    }    
    if(LOGGED==''){
        alert('Please login, if you want to access your shortlist.');
        return;    
    }
    SHORTLS=$('#dvsALL').html();    
    $('#dvsALL').html('');
    TYPE=2;
    setTimeout(shortlsPost,500);  
    isSL=true;  
}

function shortlsPost(){
   dItems='';
   bShortlist=true;
   for(i=0;i<arShortList.length;i++){
        if(arShortList[i]!=null){
            aItem=slItm;
            oUNI=arShortList[i];                        
            dItems+=PopBlockSL(i);//pop_allPost();
        }
    }
    Os('loading','none');
    //alert(1);
    LoginBar();
    wasSearches=false;
    O('dvsALL').innerHTML+=dItems;   
}

var wasReturn=false;
function Return(){    
    TYPE=0;
    CntB=cntBef; 
    wasReturn=true;
    Os('dvs','block');
    //bShortlist=false;
    isSL=false;
    LoginBar();
    Os('noresult','none');        
    Os('hP','block');Os('tbSrch','block');
    $('#dvsALL').html(SHORTLS);
    try{
    Os('propsubmit','block');
    Os('aGO','block');
    }catch(e){}
}


function sortBy(id){   
    ord=arSrBy[id];
    if(ordPrev==ord)return;
    ordPrev=ord;
    $('#dvsALL').html(LOADING);     
    setTimeout(PagePost,100);
}

function sortOrder(){
    sort=sort=='a' ? '' : 'a';
    $('#dvsALL').html(LOADING);
    setTimeout(PagePost,100);    
}

function ShowPage(page){    
    $('#dvsALL').html(LOADING);
    if(page==0){page_a();return;}
    pFrom=20*(page-1)+1;          
    pTo=20*page;
    if(pFrom+19>CNT){pFrom=CNT-19;pTo=CNT;if(pFrom<1)pFrom=1;}    
    setTimeout(PagePost,100);
    page_number();
}

function page_a(){
    O('dvsALL').innerHTML=LOADING;
    cPage=0;pFrom=1;pTo=CNT;
    setTimeout(PagePost,100);    
}

function PagePost(){  
    //alert(13);
    dItems='';COLOR='';
    try{
    if(TYPE==1)COLOR='#FFFFDC';
     if(shortList_js.q.length<2 || TYPE==1) {        
        if(oUser.RQIs.length==0 || TYPE==1){//
            if(ord=='Q'){
                if(sort=='a')
                    for(i=pTo;i>=pFrom;i--)//
                        Html(i);                        
                else
                    for(i=pFrom;i<=pTo;i++)
                         Html(i);                                         
            }
            else{
                if(sort=='a')
                    for(i=pTo;i>=pFrom;i--)
                        Html(eval(ord+i).q);            
                else
                    for(i=pFrom;i<=pTo;i++)
                        Html(eval(ord+i).q);                             
            }        
        }
        else {
        if(ord=='Q'){
            if(sort=='a')
                for(i=pTo;i>=pFrom;i--){
                    COLOR='';
                    if(oUser.RQIs.indexOf('.'+eval(ord+i).p)>-1)
                     COLOR='#FFFFDC';   
                     Html(i);                                         
                }
            else
                for(i=pFrom;i<=pTo;i++)
                {   COLOR='';
                    if(oUser.RQIs.indexOf('.'+eval(ord+i).p)>-1)
                    COLOR='#FFFFDC';
                    Html(i);       
                }            
        }
        else{
            if(sort=='a')
                for(i=pTo;i>=pFrom;i--){
                    COLOR='';
                    if(oUser.RQIs.indexOf('.'+eval('Q'+eval(ord+i).q).p)>-1)  
                     COLOR='#FFFFDC';   
                     Html(eval(ord+i).q);            
                }
            else
                for(i=pFrom;i<=pTo;i++)
                {   COLOR='';
                    if(oUser.RQIs.indexOf('.'+eval('Q'+eval(ord+i).q).p)>-1) 
                    COLOR='#FFFFDC';                    
                    Html(eval(ord+i).q);                             
                }
        }                                          
        }
    }
    else{    
        if(ord=='Q'){
            if(sort=='a')
                for(i=pTo;i>=pFrom;i--){
                    COLOR='';
                    if(shortList_js.q.indexOf(','+eval(ord+i).p)>-1)
                     COLOR='#F0F0FF';   
                     Html(i);                                         
                }
            else
                for(i=pFrom;i<=pTo;i++)
                {   COLOR='';
                    if(shortList_js.q.indexOf(','+eval(ord+i).p)>-1)
                    COLOR='#F0F0FF';
                    Html(i);       
                }            
        }
        else{
            if(sort=='a')
                for(i=pTo;i>=pFrom;i--){
                    COLOR='';
                    if(shortList_js.q.indexOf(','+eval('Q'+eval(ord+i).q).p)>-1)  
                     COLOR='#F0F0FF';   
                     Html(eval(ord+i).q);            
                }
            else
                for(i=pFrom;i<=pTo;i++)
                {   COLOR='';
                    if(shortList_js.q.indexOf(','+eval('Q'+eval(ord+i).q).p)>-1) 
                    COLOR='#F0F0FF';                    
                    Html(eval(ord+i).q);                             
                }
        }  
    }
    }catch(e){}
    if(pTo==nResult && pFrom==1 && TYPE==0)
        SHOWtitle='all of '+nResult;
    if(TYPE==1){
        SHOWtitle='You requested for information for the following properties:';
        TYPE=0;Os('spage','none');Os('spage2','none');//Os('pgs','none');        
        dItems=dItems.replace(/Nnn/g,'n');
    }
    //SORTBYAGENCY
       $('#dvsALL').html(searchControlA.replace(/XQ/g,'').replace('TITLE',SHOWtitle)+dItems);             
       if(CNT>9)                  
           O('dvsALL').innerHTML+=searchControlA.replace(/XQ/g,2).replace('TITLE',SHOWtitle);
      
       if(CntBALL>0 && CNT>0)
          O('dvsALL').innerHTML+="<br/><br/>"+AgentABitems.replace('xCntB',CntBALL);
       
       if(CntBALL<0){
           CntBALL=0;       
           AgentAB_B=true;
       }       
       SORT();
    
}
function SORT(){sortSet(ord,'#000050','bold');}
var arSrBy=new Array('T','P','A','Q','R','S');

var pageFL=false;
function page_p(){       // alert(O('p1').className);
    if(cPage<6 && (O('p1').value=='1' && O('p1').className=='bp overC' ))return;
    selPage=3;
    if(parseInt(O('p1').value)-3<1)
        page_f();
    else{pageFL=true;
        Page(parseInt(O('p3').value)-2);}     
}
function page_n(){
    if(cPage==nPages && parseInt(O('p5').value)==nPages)return;    
    selPage=3;
    if(parseInt(O('p5').value)+3>nPages)
        page_l();
    else{pageFL=true;
        Page(parseInt(O('p3').value)+2); }
    
}
function page_f(){selPage=1;Page(1);}
function page_l(){selPage=5;Page(nPages);}
function create_pages(){
    Oc('p1','bp clicked');
    Oc('p12','bp clicked');
    for(i=2;i<6;i++){
        Oc('p'+i,(i<=maxPg ? 'bp' : 'n'));
        Oc('p'+i+'2',(i<=maxPg ? 'bp' : 'n'));
    }
}

function xPage(o){selPage=o.id.substr(1,1);if(selPage==1)page_p();else if(selPage==5)page_n();else Page(o.value);}
function xPage2(o){xPage(o);}
var selPage=1;
function Page(V){//alert(V);
    if(((cPage==V && !pageFL) || $('#dvsALL').html()==LOADING) && !forcePage ) return;    
    forcePage=false;
    $('#dvsALL').html(LOADING);
    cPage=V;
    ShowPage(cPage);
}


function search_nrm(){
    O('cb_reg').checked=false;O('cb_pcs').checked=false;O('cb_tw').checked=false;
    Oc('sp_reg','s_search');Oc('sp_pcs','s_search');Oc('sp_tw','s_search');  
}

function sortSet(id,color,weight){
    //alert(1);
    try{
    O('s'+id+'w').style.color=color;
    O('s'+id+'w').style.fontWeight=weight;
    if(sort=='a')
        O('sImg').src=O('sImg').src.replace('Desc','Asc');
    if(CNT>9){    
        O('s'+id+'w2').style.color=color;
        O('s'+id+'w2').style.fontWeight=weight;    
        O('sImg2').src=O('sImg').src;
    }
    NormSelbar();
    if(cPage<selPage)selPage=1;
    if(CNT>20){
        if(selPage>0 && cPage>0){//clicked
            Oc('p'+selPage,'bp clicked');
            Oc('p'+selPage+'2','bp clicked');
            
            for(i=1;i<=5;i++){
                O('p'+i).value=i+parseInt(cPage)-selPage;
                O('p'+i+'2').value=i+parseInt(cPage)-selPage;                
            }  
        }
        
        if(CNT<101){
            Oc('pFt','n');Oc('pLt','n');Oc('pR','n');Oc('pL','n');
            Oc('pFt2','n');Oc('pLt2','n');Oc('pR2','n');Oc('pL2','n');
        }
        else{
            if(cPage==1){Oc('pFt','bp clicked');
                Oc('pFt2','bp clicked');
                Oc('pL','n');Oc('pL2','n');
            }
            if(cPage>=nPages){
                Oc('pLt','bp clicked');Oc('pLt2','bp clicked');Oc('pR','n');Oc('pR2','n');
            }
        }        
    }
    else{
        Oc('spage','n');
        Oc('spage2','n');
    }
    if(cPage==0){Oc('pA','bp clicked');Oc('pA2','bp clicked');}
    set_cookie(ckKey,ord+'.'+sort+'.1');    
    }catch(e){}
    
}
function NormSelbar(){
    for(i=1;i<=5;i++){
        Oc('p'+i,(i<=nPages ? 'bp' : 'n'));                
        Oc('p'+i+'2',(i<=nPages ? 'bp' : 'n'));    
    }
}

var arSIDs;
var htmItem='<div id=dVwxID class=xDv><table cellpadding=0 cellspacing=0 class=xTb style="background:COLOR;">';
htmItem+='<tr><td class=xIm valign=top><img src=SRC class=xIpc /></td>';
htmItem+='<td valign=top style="width:100%">';
htmItem+='<table style="width:100%" cellpadding=0 cellspacing=0>';
htmItem+='<tr class=bgaSTATUS><td colspan=3 class=RowaSTATUS ><table style="width:100%;float:left" cellpadding=0 cellspacing=0><tr class=xTR><td class=xT>&nbsp;<span>TITLE</span></td><td class=xR>DATE</td><td class=xR><span>REF</span></td><td class=xS><span>xSTATUS</span>&nbsp;</td></tr></table></td></tr>';
htmItem+='<tr><td style="width:90px;" class=xX valign=top><table><tr><td>DESC1</td></tr></table></td>';
htmItem+='<td style="width:165px;" class=xX valign=top><table><tr><td>DESC2</td></tr></table></td>';
htmItem+='<td style="width:155px;" class=xX valign=top><table><tr><td>DESC3</td></tr></table></td>';        
htmItem+='</tr></table></td></tr>';
htmItem+='<tr><td colspan=3><div style="width:100%;">DESC4</div></td></tr>';
htmItem+='<tr><td colspan=2 class=xRw><table cellpadding=0 cellspacing=0><tr><td style="width:135px;" align=left class=aSel><a href="javascript:Select(xID,REF);">Select ?</a></td><td style="width:195px;" align=left>';
htmItem+='<a href="javascript:showMap(xID);" class=xB title="Select this ">Map</a>&nbsp;<a href="javascript:showDet(xID);" class=xB title="Select this ">PDF</a>&nbsp;<a class=xD title="Select this ">Word</a>';
htmItem+='</td><td class=xAg>SHORTLIST</td></tr></table></td></tr></table></div>';
var slItm='<div id=siREF class=sim>';
slItm+='<table cellpadding=0 cellspacing=0 width=100% height=100% ><tr><td><img class=IMGn src="image/thumb/REF_thumb.jpg" /><div class="dl NEWn"><h4>NEW <span>DAT</span></h4><br/>No map position <br/>No agency information<br/> can be given for this Property<br/>in the first 30 days</div></td></tr><tr><td><span style="float:left;padding-left:3px;"><input onclick="to_shortlist_del(JS,REF);" class=del_but onmouseover="ov4(this);" onmouseout="ou4(this);" type=button value=Delete /> from Shortlist  <input type=button class=ret onclick="Return();" onmouseover="ov(this);" onmouseout="ou(this);"  value=return />&nbsp;</span><span style="float:right;"><input type=button class=detCSS onclick="show_det_a(JS);" onmouseover="ov(this);" onmouseout="ou(this);"  value=Details />&nbsp;<input onmouseover="ov(this);" onmouseout="ou(this);" type=button onclick="show_map_a(JS);" class=fl value=Map ></span></td></tr></table></div>';
slItm+='<div id=si2REF class=stx><div class=searchtexthead><div class=searchtextheadSTS><table cellpadding=0 cellspacing=0 width=100% ><tr><td align=left>LOC</td><td>&nbsp;</td><td class=rfr>Ref:REF</td><td class=sts>STS</td></tr></table></div></div>';
slItm+='<div class=searchdetails><table cellpadding=0 cellspacing=0 class=tag ><tr><td>TYP</td></tr><tr><td class=ag>AGN</td></tr></table></div></div>';
slItm+='<div class=clear id=clREF></div>';
var searchControlA="<div class=sList><table width=100% cellpadding=0 cellspacing=0><tr><td>&nbsp;TITLE</td>";
searchControlA+="<td id=spageXQ style='padding-bottom:2px;'><input id=pFtXQ class=bp type=button onmouseout='ou(this);' onmouseover='ov(this);' style='width:28px;' onclick='page_f();' value=1st />&nbsp;<input onclick='page_p();' class=bp id=pLXQ onmouseout='ou(this);' onmouseover='ov(this);' type=button value='«' />&nbsp;";
searchControlA+="<input class=bp id=p1XQ onmouseover='ov(this);' onclick='xPageXQ(this);' onmouseout='ou(this);' type=button value=1><input class=bp id=p2XQ onmouseover='ov(this);' onclick='xPageXQ(this);' onmouseout='ou(this);' type=button value=2>&nbsp;<input class=bp id=p3XQ onmouseover='ov(this);' onclick='xPageXQ(this);' onmouseout='ou(this);' type=button value=3>&nbsp;<input class=bp id=p4XQ onmouseover='ov(this);' onclick='xPageXQ(this);' onmouseout='ou(this);' type=button value=4>&nbsp;<input class=bp id=p5XQ onmouseover='ov(this);' onclick='xPageXQ(this);' onmouseout='ou(this);' type=button value=5>";
searchControlA+="&nbsp;<input onmouseout='ou(this);' onclick='page_n();' onmouseover='ov(this);' class=bp id=pRXQ type=button value='»'/><input onclick='page_l();' id=pLtXQ class=bp type=button value=end onmouseout='ou(this);' onmouseover='ov(this);' style='width:28px;' />&nbsp;<input onclick='page_a();' id=pAXQ class=bp type=button value=all onmouseout='ou(this);' onmouseover='ov(this);' /></td>";
searchControlA+="<td align=right class=Sort style='padding-bottom:2px;'>Sort&nbsp;<image id=sImgXQ onclick='sortOrder();' src='../../../../image/Desc.gif' />&nbsp;by&nbsp;<input type=button id=sTwXQ onclick='sortBy(0);' onmouseover='sortOvXQ(0);' onmouseout='sortOuXQ(0);' value=Town /><input type=button id=sPwXQ onclick='sortBy(1);' onmouseover='sortOvXQ(1);' onmouseout='sortOuXQ(1);' value=Postcode /><input type=button class=AgencySort id=sAwXQ onclick='sortBy(2);' onmouseover='sortOvXQ(2);' onmouseout='sortOuXQ(2);' value=Agency /><input type=button id=sQwXQ onclick='sortBy(3);' onmouseover='sortOvXQ(3);' onmouseout='sortOuXQ(3);' value=Date />&nbsp;&nbsp;<input type=button id=sRwXQ onclick='sortBy(4);' onmouseover='sortOvXQ(4);' onmouseout='sortOuXQ(4);' value=Rent />&nbsp;&nbsp;<input type=button  id=sSwXQ onclick='sortBy(5);' onmouseover='sortOvXQ(5);' onmouseout='sortOuXQ(5);' value=Size /></td>";
searchControlA+="</tr></table></div>";
var htmlSearchResult='<input type=hidden id=hsSID value=xID /><a name=sSID></a><div id=OSRSID class=OSR><table width=100% height=100% cellpadding=0 cellspacing=0><tr><td width=20% class=osrL>LEFT';
htmlSearchResult+='</td><td class=osrC>CENTER</td><td width="20%" align=right class=osrR>RIGHT</td></tr></table></div><div class=dssid id=dSSID></div>';
var sLeft='<table cellspacing=0 cellpadding=0 style="padding-left:3px;"><tr><td class=Dt>Date</td></tr><tr><td><input class=bM id=bMSID type=button onmouseover="oMat(SID);" onmouseout="uMat(SID);" onclick="Matches(SID,xMatches);" value="xMatches Matches" />';
sLeft+='<div class=Hv1 id=HvMSID>See the Properties that<br/>match this search</div>';
sLeft+='</td></tr><tr><td><input class=bR id=bRSID onclick="RFIs(SID,xRFIs);" onmouseover="oRfi(SID);" onmouseout="uRfi(SID);" type=button value="xRFIs RFIs" />';
sLeft+='<div class=Hv2 id=HvRSID>see the Properties in this search<br/>for which you requested Information</div>';
sLeft+='</td></tr><tr><td><input class=bG type=button value="xIGs IGs" /><span class=nig>No&nbsp;information&nbsp;given</span></td></tr></table>';
var sRight='<table><tr><td>SOURCE</td></tr><tr><td><a onmouseover="oDel(SID);" onmouseout="uDel(SID);"  href="javascript:SrchDelete(SID);">delete</a>'
sRight+='<div class=Hv3 id=HvDSID>click to delete<br/>this search</div></td></tr></table>';
var Request4Info='<fieldset class=Register><legend><table class=LoginHead width=100%><tr><td>Request For Information</td>';
Request4Info+='<td align=right><input onclick="closeFloating();" style="width:25px;" class=lgClose2 type=button value=X /></td></tr></table></legend>';
Request4Info+='<table style="width:600px;position:relative;top:-4px;" cellpadding=0 cellspacing=0>';
Request4Info+='<tr><td align=center width=100%><div class=fpdv onclick="mailSL();" onmouseover="fpo(this);" onmouseout="fpu(this);"><b>Please click here to request more information on these properties</b></div>';
Request4Info+='</td></tr>';
Request4Info+='<tr><td class=LoginBodyBottom ></td></tr></table>';
Request4Info+='</fieldset>';

var dReply2Client='<fieldset class=Register><legend><table class=LoginHead width=100%><tr><td>Thank you for your enquiry</td>';
dReply2Client+='<td align=right><input onclick="closeFloating();" style="width:25px;" class=lgClose2 type=button value=X /></td></tr></table></legend>';
dReply2Client+='<table style="width:600px;position:relative;top:-4px;" cellpadding=0 cellspacing=0>';
dReply2Client+='<tr><td align=center width=100%>PIDS</td></tr>';
dReply2Client+='<tr><td style="padding-left:10px;">We shall contact you shortly to discuss your Requirement in more detail<br/><br/>Regards<br/><br/>COMPANY<br/><br/>PHONE<br/></td></tr>';
dReply2Client+='<tr><td style="padding-right:30px;" align=right><input type=button value="return to search" onclick="Sent();" /></td></tr>';
dReply2Client+='<tr><td class=LoginBodyBottom ></td></tr></table>';
dReply2Client+='</fieldset>';
var dLgn='<fieldset class=Register><legend><table class=LoginHead width=100%><tr><td>Login</td>';
dLgn+='<td align=right><input onclick="closeFloating();" style="width:25px;" class=lgClose2 type=button value=X /></td></tr></table></legend>';
dLgn+='<table cellpadding=0 cellspacing=0 style="width:600px;position:relative;top:-4px;"><tr><td align=left style="padding-left:15px;vertical-align:bottom;padding-bottom:13px;padding-top:10px;color:#333333;">&nbsp;&nbsp;&nbsp;Please&nbsp;login&nbsp;to&nbsp;your&nbsp;account<br/><br/><br/><br/><br/><input onmouseover="no(this);" id=bAc class=Ac style="width:180px;" onmouseout="nu(this);" onclick="Account();" type=button value="Register a new account for me" /></td>';
dLgn+='<td id=lgPar align=left style="padding-left:0px;">';
dLgn+='<table style="width:50px;height:25px;">';
dLgn+='<tr><td align=center>';
dLgn+='<table border=0 style="width:50px;height:25px;">';
dLgn+='<tr><td align=right>email:</td><td><input id=bEm type=text value="MAIL" onfocus="fcse(this);" /></td></tr>';
dLgn+='<tr><td align=right>password:</td><td><input id=bPs onfocus="fcsp(this);" type=password value="PSW" /></td></tr>';
dLgn+='<tr><td colspan=2 align=right><input id=bRg class=Rg onmouseover="ro(this);" onmouseout="ru(this);" type=button onclick="reg();" value="Login" />&nbsp;';
dLgn+='<br/><input onmouseover="fo(this);" id=bFrPs class=Fpsw onmouseout="fu(this);" onclick="Forgotten();" type=button value="Forgotten password?" />&nbsp;</td></tr>';
dLgn+='</table></td></tr></table></td><td align=left id=LL style="vertical-align:middle;font-size:10px;padding-left:15px;">';
dLgn+='<input style="cursor:hand;width:23px;" id=RmPs checked type=checkbox />remember&nbsp;password&nbsp;</td></tr>';
dLgn+='<tr><td colspan=4 class=LoginBodyBottom></td></tr></table></fieldset>';
var dFp='<fieldset class=Register><legend><table class=LoginHead width=100%><tr><td>Forgotten password</td><td align=right>';
dFp+='<input onclick="closeFloating();" style="width:25px;" class=lgClose2 type=button value=X /></td></tr></table></legend>';
dFp+='<table style="width:600px;position:relative;top:-4px;" cellpadding=0 cellspacing=0>';
dFp+='<tr><td align=center width=100%><div class=fpdv onclick="ForgottenSend();" onmouseover="fpo(this);" onmouseout="fpu(this);">Click here to send me my password to my email <input onclick="ForgottenNoSend();" id=tFp /></div>';
dFp+='</td></tr><tr><td class=LoginBodyBottom ></td></tr></table></fieldset>';

var dAcn='<fieldset class=Register ><legend><table class=LoginHead width=100%><tr><td>LEGEND</td>';
//dAcn+='<td><span class=cAlr><input type=button onmouseover="ro(this);" style="width:245px;" onmouseout="ru(this);" onclick="LoginInfo();" value="Please click here if you already have an account" /></td>';
dAcn+='<td align=right><input onclick="closeFloating();" style="width:25px;" class=lgClose2 type=button value=X /></td></tr></table>';
dAcn+='</legend>';
dAcn+='<table style="width:100%;text-align:left;" cellpadding=0 cellspacing=0 border=0>';
dAcn+='<tr><td  style="padding-left:75px;" >';
dAcn+='<br/>Please register below subject to our 4 simple <a style="text-decoration:underline" href="javascript:Terms();">Terms & Conditions </a>';
dAcn+='<div id=Terms class=n><table style="background:#d0e0ff;width:400px;padding:4px;border:0px solid navy;color:navy;margin-left:0px;" >';
dAcn+='<tr><td>1) you are a Company and permit us to store and use your name</td><td align=right><a href="javascript:TermsX()">x</a></td></tr>';
dAcn+='<tr><td colspan=2>2) we shall not sell or give your name to anyone outside this service</td></tr><tr><td colspan=2>3) you understand the Property information shown may be inaccurate</td></tr> <tr><td colspan=2>4) you accept there is no implied contract from the information on this site</td></tr>';
dAcn+='</table></div></td></tr>';
dAcn+='<tr><td style="padding-left:70px;width:400px;padding-top:9px;">';
dAcn+='<table cellpadding=0 cellspacing=1 border=0 style="margin-top:5px;width:400px;">';
dAcn+='<tr><td colspan=2 style="margin-left:-25px;display:none">Please give some of the following information</td></tr>';
dAcn+='<tr><td align=right1 style="color:#252525;"><b>Email</b><span class=rd>*</span></td><td align=right><input type=text id=cMail style="width:300px;" onfocus="fcse2(this);" onblur="blr(this);" /></td></tr>';
dAcn+='<tr><td align=right1 ><span  id=aMbl>Phone<span class=rd>*</span></td><td align=right></span><input id=cMbl onclick="popInfo();" style="width:300px;" onfocus="fcs(this);" onblur="blr(this);" /></td></tr>';
dAcn+='<tr><td align=right1 >Title</td><td align=right><input style="width:300px;" id=cTit onfocus="fcs(this);" onblur="blr(this);" /></td></tr>';
dAcn+='<tr><td align=right1 >Firstname</td><td align=right><input style="width:300px;" id=cFrs onfocus="fcs(this);" onblur="blr(this);" /></td></tr>';
dAcn+='<tr><td align=right1 >Surname</td><td align=right><input onclick="popInfo();" style="width:300px;" id=cSrn onfocus="fcs(this);" onblur="blr(this);" /></td></tr>';
dAcn+='<tr class=n id=cCmp2><td><span id=aCmp></span></td><td align=right><input  type=text style="width:300px;" id=cCmp onfocus="fcs(this);" onblur="blr(this);" /></td></tr>';
dAcn+='<tr class=n id=cBrn2><td><span id=aBrn>Postcode</span></td><td align=right><input id=cBrn style="width:300px;" type=text onfocus="fcs(this);" onblur="blr(this);" /></td></tr>';
dAcn+='<tr class=n id=cPh2><td><span id=aPh>Phone 2</span></td><td align=right><input style="width:300px;" id=cPh type=text onfocus="fcs(this);" onblur="blr(this);" /></td></tr>';
dAcn+='</table></td></tr><tr><td style="padding-left:70px;"><br/>';
dAcn+='<input id=u1 style="width:19px;background-color:transparent;border:0px;" type=radio name=Motive />&nbsp;urgent - move within 3 months<br/>';
dAcn+='<input id=u2 style="width:19px;background-color:transparent;border:0px;" type=radio name=Motive />&nbsp;must move in 3-12 months<br/>';
dAcn+='<input id=u3 style="width:19px;border:0px;background-color:transparent;" type=radio name=Motive />&nbsp;will move for the right Property<br/>';
dAcn+='<input id=u4 style="width:19px;border:0px;background-color:transparent;" type=radio name=Motive />&nbsp;just looking';
dAcn+='</td></tr><tr><td style="padding-left:70px;">';
dAcn+='<table style="margin-top:15px;background:blue1;width:400px;" border=0><tr><td colspan=2>Please&nbsp;tell&nbsp;us&nbsp;what&nbsp;you&nbsp;are&nbsp;looking&nbsp;for</td></tr>';
dAcn+='<tr><td colspan=2><textarea onfocus="txf(this);" id=txa>eg. how many staff, what type of business</textarea></td></tr>';
dAcn+='<tr><td colspan=2 id=htmPSW></td></tr>';
dAcn+='<tr><td colspan=1 ><span id=pswcr >change&nbsp;password: <input id=cPsw style="width:100px;" type=password /></span></td><td align=right>';
dAcn+='<span id=logvr><input onclick="createLogin(this);" style="width:100px;font-weight:bold;" type=button onmouseover="ro(this);" onmouseout="ru(this);" value=BUTTON /></span>';
dAcn+='</td></tr></table></td></tr><tr><td class=LoginBodyBottom></td></tr></table></fieldset>';
function Terms(){$('#Terms').slideDown('slow');}
function TermsX(){$('#Terms').slideUp('fast'); }

var PSWD='<fieldset class=Register><legend><table class=LoginHead width=100%><tr><td>Please choose a password for this account</td>';
PSWD+='<td align=right><input onclick="closeFloating();" style="width:25px;" class=lgClose2 type=button value=X /></td></tr></table></legend>';
PSWD+='<table style="width:600px;position:relative;top:-4px;" border=0 cellpadding=0 cellspacing=0>';
PSWD+='<tr><td align=left colspan=2 style="padding-left:10px;"><br/>to save this and make more Searches, please enter your choice of password below<br/><br/></td></tr>';
PSWD+='<tr><td align=left style="padding-left:10px;color:#003311">(6+ characters)&nbsp;<input id=NewPsw value="enter a password" onclick="this.select();" />';
PSWD+='<td align=right style="padding-right:80px;"><input style="font-size:10px;background:white;cursor:hand" onmouseover="ro(this);" onmouseout="ru(this);" type=button value="open an account for me" onclick="CheckPsw();" /></td></tr>';
PSWD+='<tr><td class=LoginBodyBottom></td></tr></table></fieldset>';

var PSWD2='<table style="width:100%;position:relative;top:0px;" border=0 cellpadding=0 cellspacing=0>';
PSWD2+='<tr><td align=left colspan=2 style="padding-left:0px;"><br/>to save this and further Searches, <span style="font-weight:bold;color:red;">enter your choice of password below</span><br/><br/></td></tr>';
PSWD2+='<tr><td align=left style="padding-left:0px;color:#003311">(6+ characters)<input id=NewPsw style="color:red;font-weight:bold" value="enter a password" onclick="this.select();" />';
PSWD2+='<td align=right style="padding-right:1px;"><input style="font-size:10px;background:white;cursor:hand" onmouseover="ro(this);" onmouseout="ru(this);" type=button value="open an account for me" onclick="CheckPsw();" /></td></tr>';
PSWD2+='</table>';


var H;
try{
$(window).scroll(function()
{
    if($('#floatdiv').height()>500)return;
    H=(document.documentElement.clientHeight - $('#floatdiv').height())/2+10;
    
    $('#floatdiv').animate({top:$(window).scrollTop()+H+"px" },{queue: false, duration: 100});
    //$('#floatdiv').animate({bottom:$(window).scrollTop()+H+"px" },{queue: false, duration: 100});
    $('#dSL').animate({top:$(window).scrollTop()+7+"px" },{queue: false, duration: 100});    
    //$('#dSL').animate({bottom:$(window).scrollBottom()+7+"px" },{queue: false, duration: 100});    
    
    //alert($('#floatdiv').height());
});
}catch(e){}

var aSize=Array('floor&nbsp;space','land');
function Size(){//
    if($('#IntExt').html()=='Internal'){
        size=2;
        $('#IntExt').html('External');
        $('#inf').html('land');
        $('#Sizes').html('<input id=cFt type=radio checked name=Sq>sf<input id=cMt type=radio name=Sq>sm<INPUT id=cAc type=radio name=Sq>acr<INPUT id=cHc type=radio name=Sq>hec');
    }
    else{        
        size=1;
        $('#inf').html('floor&nbsp;space');        
        $('#IntExt').html('Internal');
        $('#Sizes').html('<input id=cFt type=radio checked name=Sq>sf<input id=cMt type=radio name=Sq>sm');
    }
}
//<span style="position:relative;top:-5px;">

function IsNumeric(sText){
    var ValidChars = "0123456789.";
    var IsNumber=true;
    var Char;
    if(sText.length==0) return false;
    for (i = 0; i < sText.length && IsNumber == true; i++) 
    { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
             return IsNumber = false;
         }
    }
    return IsNumber;   
} 

function valid_postcode(o){   
    o.value=o.value.trim();
    var valid_pc=o.value;
    if(valid_pc.indexOf("@")>-1 || valid_pc.indexOf("/")>-1   
       || valid_pc.indexOf("*")>-1 || valid_pc.indexOf("-")>-1   
       || valid_pc.indexOf("#")>-1 || valid_pc.indexOf("&")>-1   
       || valid_pc.indexOf("~")>-1 || IsNumeric(valid_pc.substr(0,1))
    )
    {
        alert("Entered postcode: "+valid_pc +" is not valid UK postcode!");
        o.value='';
        return;
    }  
}


function retDate(){
    if(cDATE.length==2)cDATE='0'+cDATE;
    if(curdate.getMonth().length==1)cDATE+='0'+curdate.getMonth();
    else cDATE+='0'+curdate.getMonth();
    cDATE+='.'+curdate.getYear();
}


setTimeout(BEG,1000);
function BEG(){retDate();if(isEMAIL.length>0)mail();}    


    if(fX==63){
        if(latitude.indexOf('KEY')>-1){
            var wnloc=window.location+'';   
            if(wnloc.indexOf('osidil.com')>-1)
                latitude=latitude.replace('KEY',osidil_com);         
            else if(wnloc.indexOf('osidil.co.uk')>-1)
                latitude=latitude.replace('KEY',osidil_co_uk);
            else if(wnloc.indexOf('4prop.com')>-1)
                latitude=latitude.replace('KEY',osidil_4prop_com);
        } 
        unsetOpacity();        
    }
