﻿var geo={};var initGeo=false;var lAddr=null;function getBodyScrollTop(){return self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop);}
function getBodyScrollLeft(){return self.pageXOffset||(document.documentElement&&document.documentElement.scrollLeft)||(document.body&&document.body.scrollLeft);}
var geo_country=null,geo_city=null;var do_searchCenter=false;var sP;var requestHotels=false;function setRH(f){requestHotels=f}
function isRH(){return requestHotels}
function searchCenter(s){do_searchCenter=true;geo_country=$v("CnNm");geo_city=$v("CtNm");s=geo_country+", "+geo_city;s=$v("geoAddr");lAddr=s;var iframe=$("frameMap");var cW=getClientWidth(),cH=getClientHeight();var h=0,w=0;var cw=(cW<520)?cW=520:(cW>690?690:cW);var ch=(cH<464)?cH=464:(cH>598?598:cH);if(cH>594)h=(cH-594)/2;if(cW>690)w=(cW-690)/2;var top=getBodyScrollTop()+h;var left=getBodyScrollLeft()+w;var l=left+"px";var t=top+"px";iframe.style.left=l;iframe.style.top=t;iframe.style.visibility='visible';iframe.style.display='block';iframe.style.width=cw+"px";iframe.style.height=ch+"px";if(!initGeo){initGeo=true;var src="/catalog/geo_h21.htm?"+"lang="+$v("Lang")+"&addr="+s+
(geo.loc?"&loc="+geo.loc:"")+
(geo.foc?"&loc="+geo.foc:"")+
(geo.zoom?"&zoom="+geo.zoom:"")+"&frame="+iframe.id;;iframe.style.position='absolute';iframe.src=src;}
else if(geoMap.initGeo){geoMap.initGeo({"country":geo_country,"city":geo_city});}}
function cdPlaceOnChange(e){if(e&&e.checked){var l=geo&&geo.foc?geo.foc:"";if(l==""){searchCenter('centerSearch');}}}
function showGeo(){alert("geo:\n"+JSONstring.make(geo));}
function getClientWidth(){return document.compatMode=='CSS1Compat'&&!window.opera?document.documentElement.clientWidth:document.body.clientWidth}
function getClientHeight(){return document.compatMode=='CSS1Compat'&&!window.opera?document.documentElement.clientHeight:document.body.clientHeight}
function shadowedScreen(show){var s=$("shadowed");if(s&&s.style){s=s.style;if(show){s.display='block';s.position='absolute';s.left='0px';s.top='0px';s.background="#a9a9a9";s.height=calculateOffsetTop($("footer"))+50+"px";s.width=document.body.clientWidth+"px";s.filter="alpha(opacity=50)";s.opacity="0.5"}
else s.display='none';}}
function set_geo_country(c){geo_country=c;setCenterSearch()}
function set_geo_city(c){geo_city=c;setCenterSearch()}
function set_geo_(c,t){geo_country=c;geo_city=t;setCenterSearch()}
function setCenterSearch(){var ed=false;var c=$("centerSearch");if(c)
if(geo_country&&geo_city){c.innerHTML=geo_country+", "+geo_city;ed=true;}
else{c.innerHTML="";}
var e=$("cdPlace");if(e){if(e.checked){e.checked=false;geo={}}
e.disabled=ed?"":"disabled"}}
function getCenterSearch(){var s="",c=$("cdPlace","centerSearch");if(c[0]&&c[0].checked&&c[1])s=c[1].innerHTML;return s}
function clrCenterSearch(){geo={};var c=$("cdPlace");if(c)c.checked="false"}
function setCoord(){SetNewCoord();}
function geo_Exit(){do_searchCenter=false}
function isGeo(){return do_searchCenter}
function SetNewCoord(){$v("geoLatLon",geo.foc);var e=$("centerSearch");e.innerHTML=geo.foc_addr;fSelSel($("cdPlace"));}
