var cal1,cal1Exists,cal1Shown;
var cal2,cal2Exists,cal2Shown;
cal1Exists=false;
cal2Exists=false;
cal1Shown=false;
cal2Shown=false;
var dt=new Date();
var cur_year=dt.getYear();
if(cur_year<1000){
cur_year=cur_year+1900;
}
var min_holdate=(dt.getMonth()+1)+"/"+(dt.getDate()+1)+"/"+cur_year;
var max_holdate=(dt.getMonth()+1)+"/"+(dt.getDate()+1)+"/"+(cur_year+2);
function calHide(){
if(cal1Exists){
cal1.hide();
cal1Shown=false;
}
if(cal2Exists){
cal2.hide();
cal2Shown=false;
}
}
function changeSelect(_1,_2){
var _3=false;
for(var _4=0;_4<_1.options.length;_4++){
if(_1.options[_4].value==_2){
_1.selectedIndex=_4;
_3=true;
break;
}
}
return _3;
}
function updateBoxes(_5,_6){
var ym=_6[0]+"-";
if(_6[1]<10){
ym=ym+"0"+_6[1];
}else{
ym=ym+_6[1];
}
var _8=document.getElementById(_5+"_dt2");
changeSelect(_8,ym);
_8=document.getElementById(_5+"_dt1");
changeSelect(_8,_6[2]);
}
function getCalData(_9){
var _a=document.getElementById(_9+"_dt1");
var _b=document.getElementById(_9+"_dt2");
var _c=_b.options[_b.selectedIndex].value.split("-");
var _d=[];
_d[0]=_c[1]+"/"+_a.options[_a.selectedIndex].value+"/"+_c[0];
_d[1]=_c[1]+"/"+_c[0];
return _d;
}
function setCalDate(_e,_f){
var _10=getCalData(_e);
_f.select(_10[0]);
_f.cfg.setProperty("pagedate",_10[1]);
_f.render();
}
function updateDepart(){
var _11=document.getElementById("arrive_dt1");
var _12=document.getElementById("arrive_dt2");
var _13=_11.options[_11.selectedIndex].value;
var _14=_12.options[_12.selectedIndex].value;
var _15=document.getElementById("depart_dt1");
var _16=document.getElementById("depart_dt2");
var _17=_15.options[_15.selectedIndex].value;
var _18=_16.options[_16.selectedIndex].value;
if(_14>_18){
changeSelect(_16,_14);
changeSelect(_15,_13);
}
if((_14=_18)&&(_13>_17)){
changeSelect(_15,_13);
}
}
function handleArriveClick(){
if(cal1Shown){
cal1.hide();
cal1Shown=false;
}else{
showArriveCal();
cal1Shown=true;
}
}
function handleDepartClick(){
if(cal2Shown){
cal2.hide();
cal2Shown=false;
}else{
showDepartCal();
cal2Shown=true;
}
}
var arriveSelected=function(_19,_1a,obj){
var _1c=_1a[0];
var _1d=_1c[0];
updateBoxes("arrive",_1d);
updateDepart();
cal1.hide();
cal1Shown=false;
};
var departSelected=function(_1e,_1f,obj){
var _21=_1f[0];
var _22=_21[0];
updateBoxes("depart",_22);
cal2.hide();
cal2Shown=false;
};
function showArriveCal(){
calHide();
if(cal1Exists){
setCalDate("arrive",cal1);
cal1.show();
}else{
var _23=getCalData("arrive");
cal1=new YAHOO.widget.Calendar("cal1","cal1Container",{mindate:min_holdate,maxdate:max_holdate,title:"Choose a date:",selected:_23[0],pagedate:_23[1]});
cal1.selectEvent.subscribe(arriveSelected);
cal1.render();
cal1Exists=true;
}
}
function showDepartCal(){
calHide();
if(cal2Exists){
setCalDate("depart",cal2);
cal2.show();
}else{
var _24=getCalData("depart");
cal2=new YAHOO.widget.Calendar("cal2","cal2Container",{mindate:min_holdate,maxdate:max_holdate,title:"Choose a date:",selected:_24[0],pagedate:_24[1]});
cal2.selectEvent.subscribe(departSelected);
cal2.render();
cal2Exists=true;
}
}
function fnCallbackClick(e){
var _26=YAHOO.util.Event.getTarget(e);
var _27=true;
while(_26.nodeName.toUpperCase()!="BODY"){
if((YAHOO.util.Dom.hasClass(_26,"se_calcon"))||(_26.className=="cal_icon")){
_27=false;
break;
}else{
_26=_26.parentNode;
}
}
if(_27){
calHide();
}
}
var selected_lid;
var map_buff;
var map_buff_off;
var selected_region;
var bb_left;
var bb_top;
var bb_size;
var bb_lid;
reset_globals();
var request_id=0;
var cm_name="clickmap0";
window.onload=start_engine;
function reset_globals(){
selected_lid=0;
map_buff=0;
map_buff_off=1;
selected_region=0;
bb_left=0;
bb_top=0;
bb_size=0;
bb_lid=0;
}
function start_engine(){
YAHOO.util.Event.addListener(document.body,"click",fnCallbackClick);
if(document.getElementById(cm_name)){
var _28=document.getElementById(cm_name);
var _29=null;
var _2a=undefined;
for(var _2b=_28.childNodes.length-2;_2b>=0;_2b--){
_29=_28.childNodes[_2b];
if(_29.getAttribute("hl_bl")){
_2a=_29.getAttribute("hl_bl");
}
if(_29.getAttribute("hl_select")){
selected_lid=parseInt(_29.getAttribute("hl_select"));
}
}
if(_2a!=undefined){
document.getElementById("map_base"+map_buff_off).src="maps/"+_2a+".gif";
}
}
var _2c=window.location.href.split("#");
if(_2c[1]!=null){
document.getElementById("load_anim").style.display="block";
var _2d=_2c[1].split("=");
var _2e=document.getElementById(_2d[0]);
_2e.disabled=false;
_2e.options[_2e.options.length]=new Option("Please wait...",_2d[1]);
_2e.options.selectedIndex=_2e.options.length-1;
document.myform.action="search_easy.asp";
document.myform.submit();
}
}
function mouseX(evt){
if(evt.pageX){
return evt.pageX;
}else{
if(evt.clientX){
return evt.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);
}else{
return null;
}
}
}
function mouseY(evt){
if(evt.pageY){
return evt.pageY;
}else{
if(evt.clientY){
return evt.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);
}else{
return null;
}
}
}
function show_tip(_31){
var _32=document.getElementById("map_title");
var _33=mouseX(_31);
var _34=(parseInt(document.body.clientWidth)-_33);
if(_34<200){
_32.style.left="";
_32.style.right=(_34+15)+"px";
}else{
_32.style.right="";
_32.style.left=(_33+15)+"px";
}
_32.style.top=(mouseY(_31)+15)+"px";
}
function create_tip(lid){
var _36=document.getElementById("map_title");
_36.style.display="block";
_36.innerHTML=document.getElementById("cl_"+lid).getAttribute("hltitle");
}
function destroy_tip(){
var _37=document.getElementById("map_title");
_37.style.display="none";
_37.innerHTML="";
}
function showlayer(lid){
var o=document.getElementById("im_"+lid);
o.style.visibility="visible";
create_tip(lid);
}
function hidelayer(lid){
if(lid!=selected_lid){
var o=document.getElementById("im_"+lid);
o.style.visibility="hidden";
}
destroy_tip();
}
function fix_layer(_3c){
if(selected_lid!=0){
if(document.getElementById("im_"+selected_lid)){
var o=document.getElementById("im_"+selected_lid);
o.style.visibility="hidden";
}
}
var _3e=document.getElementById("im_"+_3c);
_3e.style.visibility="visible";
selected_lid=_3c;
}
function start_anim(_3f,_40){
if(document.getElementById("cl_"+_40)){
var cl=document.getElementById("cl_"+_40);
bb_lid=parseInt(cl.getAttribute("hl_bl"));
bb_left=parseInt(cl.getAttribute("hl_bx"));
bb_top=parseInt(cl.getAttribute("hl_by"));
bb_size=parseInt(cl.getAttribute("hl_bs"));
var _42=cl.getAttribute("hlmap");
if(_42=="1"){
start_zoom(_40,cl.getAttribute("hlx"),cl.getAttribute("hly"),cl.getAttribute("hlscale"));
}else{
if(_42=="2"){
load_new_map(_40,_3f);
}else{
if(_42=="3"){
start_pan(_40,cl.getAttribute("hlx"),cl.getAttribute("hly"),cl.getAttribute("hlscale"));
}else{
if(_42=="4"){
var _43=selected_lid;
selected_lid=_40;
hidelayer(_43);
}else{
if(_42=="5"){
zoom_out(_40,cl.getAttribute("hlx"),cl.getAttribute("hly"),cl.getAttribute("hlscale"));
}else{
fix_layer(_40);
}
}
}
}
}
}else{
if(document.getElementById(cm_name)){
load_new_map(_40,_3f);
}else{
if(_3f=="country"){
load_new_map(_40,_3f);
}else{
}
}
}
store_history(_3f,_40);
}
function change_box(_44){
request_id++;
var sb=document.getElementById("loc_"+_44);
var _46=sb.options[sb.selectedIndex].value;
if((_46=="17")&&(_44=="region")){
changeloc("country",_46);
}
if((_46=="11")&&(_44=="region")){
changeloc("country",_46);
}
if((_46=="42")&&(_44=="region")){
changeloc("country",_46);
}
if((_46=="any")&&(_44=="town")){
_44="subregion";
sb=document.getElementById("loc_"+_44);
_46=sb.options[sb.selectedIndex].value;
}
if((_46=="any")&&(_44=="subregion")){
_44="region";
sb=document.getElementById("loc_"+_44);
_46=sb.options[sb.selectedIndex].value;
}
if((_46=="any")&&(_44=="region")){
_44="country";
sb=document.getElementById("loc_"+_44);
_46=sb.options[sb.selectedIndex].value;
}
if((_46=="--please select--")&&(_44=="country")){
clear_children(_44);
}else{
update_children(_44,_46);
}
if(_44=="town"){
store_history(_44,_46);
}else{
start_anim(_44,_46);
}
}
function changeloc(_47,_48){
request_id++;
if((_48==selected_lid)&&(document.getElementById(cm_name))){
}else{
var _49="0";
if(document.getElementById("cl_"+_48)){
var cl=document.getElementById("cl_"+_48);
if(cl.getAttribute("hlparent")){
_49=cl.getAttribute("hlparent");
}
}
var _4b=_47;
var _4c=_48;
if(_49!="0"){
_47="country";
_4c=_49;
selected_region=_48;
}
var sb=document.getElementById("loc_"+_47);
var _4e=false;
for(var _4f=0;_4f<sb.options.length;_4f++){
if(sb.options[_4f].value==_4c){
sb.selectedIndex=_4f;
_4e=true;
break;
}
}
update_children(_47,_4c,_48);
start_anim(_4b,_48);
}
}
function update_children(_50,_51,_52){
clear_children(_50);
var _53="sr_ajax.asp?action=children&parent="+_51+"&ms="+new Date().getTime()+"&req="+request_id;
if(_52!=undefined){
_53=_53+"&crumbstart="+_52;
}
var _54=YAHOO.util.Connect.asyncRequest("GET",_53,{success:handle_child_data,failure:show_error});
}
function clear_map(){
var _55=document.getElementById(cm_name);
for(var _56=_55.childNodes.length-1;_56>=0;_56--){
_55.removeChild(_55.childNodes[_56]);
}
_55=document.getElementById("highlights");
for(var _56=_55.childNodes.length-1;_56>=0;_56--){
_55.removeChild(_55.childNodes[_56]);
}
}
function pre_anim(_57){
var _58=document.getElementById("map_title");
_58.style.display="none";
_58.innerHTML="";
document.getElementById("townsoverlay").style.display="none";
document.getElementById("highlights").style.display="none";
document.getElementById("too").src="maps/"+_57+"-towns.gif";
document.getElementById("map_base"+map_buff_off).src="maps/"+_57+".gif";
clear_map();
var _59="sr_ajax.asp?action=highclick&parent="+_57+"&ms="+new Date().getTime()+"&req="+request_id;
var _5a=YAHOO.util.Connect.asyncRequest("GET",_59,{success:repop_map,failure:show_error});
}
function start_zoom(_5b,_5c,_5d,_5e){
pre_anim(_5b);
zoom_anim.element="map_base"+map_buff;
zoom_anim.start_zoom(_5c,_5d,200-_5c,200-_5d,_5e,"swap_map();",-7,0);
selected_lid=_5b;
}
function start_pan(_5f,_60,_61,_62){
var _63=document.getElementById("map_base"+map_buff_off);
_63.src="maps/"+bb_lid+".gif";
_63.style.width=bb_size+"px";
_63.style.height=bb_size+"px";
_63.style.left=bb_left+"px";
_63.style.top=bb_top+"px";
swap_map(false);
pre_anim(_5f);
zoom_anim.element="map_base"+map_buff;
zoom_anim.start_zoom(_60,_61,((-bb_left-_60)+200),((-bb_top-_61)+200),_62,"swap_map();",bb_left,bb_top);
selected_lid=_5f;
}
function zoom_out(_64,_65,_66,_67){
var _68=document.getElementById("map_base"+map_buff_off);
_68.src="maps/"+bb_lid+".gif";
_68.style.width=bb_size+"px";
_68.style.height=bb_size+"px";
_68.style.left=bb_left+"px";
_68.style.top=bb_top+"px";
swap_map(false);
pre_anim(_64);
zoom_anim.element="map_base"+map_buff;
zoom_anim.start_zoom(-bb_left+200,-bb_top+200,_65,_66,_67,"swap_map()",bb_left,bb_top);
selected_lid=0;
}
function load_new_map(_69,_6a){
document.getElementById("townsoverlay").style.display="none";
document.getElementById("highlights").style.display="none";
document.getElementById("load_anim").style.display="block";
document.getElementById("map_base"+map_buff).style.opacity="0.5";
document.getElementById("map_base"+map_buff).style.filter="Alpha(opacity=50)";
reset_globals();
selected_lid=_69;
var _6b="sr_ajax.asp?action=newmap&lid="+_69+"&level="+_6a+"&ms="+new Date().getTime()+"&req="+request_id;
var _6c=YAHOO.util.Connect.asyncRequest("GET",_6b,{success:reset_map,failure:show_error});
}
function reset_map(o){
var _6e=o.responseText;
_6e=valid_request(_6e);
if(_6e==null){
return false;
}
document.getElementById("load_anim").style.display="none";
document.getElementById("map_title").style.display="none";
document.getElementById("htmlmap").innerHTML=_6e;
document.getElementById("too").useMap="#clickmap"+request_id;
cm_name="clickmap"+request_id;
}
function swap_map(_6f){
var _70=document.getElementById("map_base"+map_buff_off);
if((_6f==undefined)||(_6f)){
_70.style.left="";
_70.style.top="";
_70.style.width="";
_70.style.height="";
}
_70.style.visibility="visible";
_70=document.getElementById("map_base"+map_buff);
_70.style.visibility="hidden";
_70.style.left="";
_70.style.top="";
_70.style.width="";
_70.style.height="";
if(map_buff==0){
map_buff=1;
map_buff_off=0;
}else{
map_buff=0;
map_buff_off=1;
}
document.getElementById("townsoverlay").style.display="";
document.getElementById("highlights").style.display="";
document.getElementById("load_anim").style.display="none";
}
function clear_children(_71){
var _72=null;
switch(_71){
case "country":
_72=document.getElementById("loc_region");
_72.selectedIndex=0;
_72.disabled="disabled";
case "region":
_72=document.getElementById("loc_subregion");
_72.selectedIndex=0;
_72.disabled="disabled";
_72.style.display="none";
case "subregion":
_72=document.getElementById("loc_town");
_72.selectedIndex=0;
_72.disabled="disabled";
}
}
function show_error(o){
var _74=o.status;
if(_74==-1){
}else{
var err=document.getElementById("map_crumbs");
err.style.backgroundColor="#cc0000";
err.innerHTML="Communication error with holidaylettings.co.uk - please try your search again.";
}
}
function valid_request(_76){
var _77=_76.split("|||");
if(parseInt(_77[0])==request_id){
var _78=_77[1];
}else{
var _78=null;
}
return _78;
}
function handle_child_data(o){
var _7a="";
var _7b="";
var _7c="";
var _7d="";
var _7e=o.responseText;
_7e=valid_request(_7e);
if(_7e==null){
return false;
}
updates=_7e.split("|");
for(i in updates){
if(i%3==0){
_7a=updates[i];
}else{
if(i%3==1){
_7b=updates[i];
}else{
_7c=updates[i];
switch(_7a){
case "tg_data":
if(_7b!="n"&&_7b!=""){
_7d=_7b;
}
break;
case "rmo_link":
var rmo=document.getElementById("aaatest2");
if(_7b!="n"&&_7b!=""){
rmo.innerHTML="<a id='rmo_link' href='http://www.rightmove.co.uk/overseas/search/"+_7c+"' target='_blank'>Property to buy in "+_7b+"</a><span id='fr'> from RightmoveOverseas</span>";
}else{
rmo.innerHTML="<a id='rmo_link'></a>";
}
break;
case "select":
repop_boxes(_7b,_7c);
break;
case "crumbs":
var _80=document.getElementById("map_crumbs");
if(_7d!=""&&_7b.charAt(1)=="s"){
var _80=document.getElementById("map_crumbs");
_80.innerHTML="<span style='float:right;'><a id='map_tg' style='text-decoration:none;color:#ffffff;' href='travel_guide/to."+_7d+"/'>Travel Guide to "+_7d+"</a></span>"+_7b;
_7d=0;
}else{
_80.innerHTML=_7b;
}
break;
case "bb_data":
var _81=_7c.split("*");
if(parseInt(_81[0])!=0){
bb_lid=parseInt(_81[0]);
bb_size=parseInt(_81[1]);
bb_left=parseInt(_81[2]);
bb_top=parseInt(_81[3]);
}else{
bb_lid=0;
bb_size=0;
bb_left=0;
bb_top=0;
}
break;
}
}
}
}
}
function repop_boxes(_82,_83){
var _84="";
var _85="";
var _86=0;
_85=_83.split("*");
_84=document.getElementById("loc_"+_82);
_84.disabled="";
_84.style.display="block";
_84.options.length=1;
for(j in _85){
if(j%2==0){
_86=_85[j];
}else{
_84.options[_84.options.length]=new Option(_85[j],_86);
if(_86==selected_region){
_84.options.selectedIndex=_84.options.length-1;
selected_region="";
}
}
}
}
function repop_map(o){
var _88=o.responseText;
_88=valid_request(_88);
if(_88==null){
return false;
}
var _89=_88.split("|");
document.getElementById("highlights").innerHTML=_89[0];
var _8a=document.getElementById(cm_name).parentNode;
_8a.removeChild(document.getElementById(cm_name));
var _8b=document.createElement("map");
cm_name="clickmap"+request_id;
_8b.setAttribute("id",cm_name);
_8b.setAttribute("name",cm_name);
_8a.appendChild(_8b);
document.getElementById(cm_name).innerHTML=_89[1];
document.getElementById("too").useMap="#"+cm_name;
}
function store_history(_8c,_8d){
var _8e=window.location.href.split("#");
window.location.href=_8e[0]+"#loc_"+_8c+"="+_8d;
}

