var map=null;var currmaptype=null;var div=null;var tbar=null;var currcoords=null;var currzoom=null;var sz=null;var loader=null;var ro=null;var data_arr=null;var generic_icon=null;var g_szc=null;var ge_zoomend=null;var ge_moveend=null;var currid=null;var markers_arr=[[],[],[],[],[]];var arr=null;function construct(A){if(div==null){div=$("map_canvas")}if(tbar==null){tbar=$("toolbar")}if(loader==null){loader=$("loader")}if(GBrowserIsCompatible()){create_icons();sz=new GSize(div.getWidth(),div.getHeight());map=new GMap2(div,{size:sz});if(currmaptype==null){currmaptype=G_NORMAL_MAP}map.setMapType(currmaptype);if(currcoords==null){currcoords=new GLatLng(37.96902,23.733902)}if(currzoom==null){currzoom=15}map.setCenter(currcoords,currzoom);if(A==1){map.addControl(new GMenuMapTypeControl());map.addControl(new GSmallZoomControl())}else{map.addControl(new GMapTypeControl());map.addControl(new GLargeMapControl())}map.addControl(new GScaleControl());if(ge_zoomend==null){ge_zoomend=GEvent.addListener(map,"zoomend",function(){currzoom=map.getZoom()})}if(ge_moveend==null){ge_moveend=GEvent.addListener(map,"moveend",function(){currcoords=map.getCenter()})}if(currid==null){if($("locid").value!=0){get_sites_in_location($("locid").value)}else{get_sites_in_location(33)}}}}function destroy(){GEvent.removeListener(ge_zoomend);GEvent.removeListener(ge_moveend);ge_zoomend=null;ge_moveend=null;GUnload();map=null}function get_sites_in_location(A){currid=A;show_loader();request_async("/get-gmap-geosites.asp","id="+currid+"&m=1&h=0&r=0",null,"get_sites_in_location_ended()")}function get_sites_in_location_ended(){hide_loader();if(data_arr.charAt(0)=="#"){$("loinfo").innerHTML=data_arr.substring(1,data_arr.length)}else{$("loinfo").innerHTML="";build_markers()}}function build_markers(){arr=eval(data_arr);data_arr=null;map.setCenter(new GLatLng(arr[0][0],arr[0][1]),currzoom);create_markers()}function create_markers(){remove_all_markers();markers_arr=[[],[],[],[],[]];for(var A=0;A<arr[1].length;A++){map.addOverlay(generate_other_marker(arr[1][A]))}for(var A=0;A<arr[2].length;A++){map.addOverlay(generate_hotel_marker(arr[2][A]))}sh_all_markers()}function generate_other_marker(E){var A=new GLatLng(E[5],E[6]);var C;var B=new GMarker(A,{icon:generic_icon});switch(E[0]){case 1:C="/images/gmap/museum_icon.png";break;case 2:C="/images/gmap/landmark_icon.png";break;case 3:C="/images/gmap/square_icon.png";break;case 4:C="/images/gmap/park_icon.png";break;case 5:C="/images/gmap/railway_icon.png";break;case 6:C="/images/gmap/airport_icon.png";break;case 7:C="/images/gmap/sports_icon.png";break}generic_icon.image=C;var B=new GMarker(A,{icon:generic_icon});var D=null;GEvent.addListener(B,"mouseover",function(){D=new ELabel(A,'<div><img src="/images/gmap/landmarks/'+E[7]+'.jpg" /><div><h5 style="line-height: 14px;">'+E[1]+"</h5><p>"+E[4]+"</p><p><b>Address:</b><br />"+E[2]+"</p><p><b>Contacts:</b><br />"+E[3]+"</p></div></div>","gmap-site-style");map.addOverlay(D)});GEvent.addListener(B,"mouseout",function(){D.hide();map.removeOverlay(D)});switch(E[0]){case 1:markers_arr[0].push(B);break;case 2:markers_arr[2].push(B);break;case 3:markers_arr[3].push(B);break;case 4:markers_arr[4].push(B);break}return B}function generate_hotel_marker(C){var D=new GLatLng(C[0],C[1]);var A=new GMarker(D,{icon:generic_icon});generic_icon.image="/images/gmap/nearby_hotel_icon.png";var B=null;GEvent.addListener(A,"mouseover",function(){B=new ELabel(D,"<h5 style=\"font-size:10px;\">"+C[2]+" Hotel <sup>"+C[6]+'</sup></h5><div><img src="'+C[5]+'" align="left" width="60" height="45" /><p>'+C[3]+"</p></div>","current-hotel-style");map.addOverlay(B)});GEvent.addListener(A,"mouseout",function(){B.hide();map.removeOverlay(B)});GEvent.addListener(A,"click",function(){B.hide();window.open(C[4])});markers_arr[1].push(A);return A}function remove_all_markers(){for(var B=0;B<markers_arr.length;B++){for(var A=0;A<markers_arr[B].length;A++){map.removeOverlay(markers_arr[B][A])}}}function sh_markers(B){var C=parseInt(B.value);for(var A=0;A<markers_arr[C].length;A++){if(B.checked){markers_arr[C][A].show()}else{markers_arr[C][A].hide()}}B.blur()}function sh_all_markers(){var A=$$("#dmarkers0","#dmarkers1","#dmarkers2","#dmarkers3","#dmarkers4");for(var C=0;C<markers_arr.length;C++){for(var B=0;B<markers_arr[C].length;B++){if(A[C].checked){markers_arr[C][B].show()}else{markers_arr[C][B].hide()}}}}function create_icons(){if(generic_icon==null){generic_icon=new GIcon();generic_icon.iconSize=new GSize(21,28);generic_icon.shadow="/images/gmap/nearby_hotel_shadow.png";generic_icon.shadowSize=new GSize(38,28);generic_icon.iconAnchor=new GPoint(23,14);generic_icon.infoWindowAnchor=new GPoint(23,14)}}function enter_fullscreen(A){currmaptype=map.getCurrentMapType();destroy();$("ln").style.display="none";tbar.style.position="absolute";tbar.style.top="0";tbar.style.left="0";if(Browser.Engine.trident4||Browser.Engine.trident5){offset=20}else{offset=4}tbar.style.width=(window.getWidth()-offset)+"px";tbar.style.backgroundColor="#2E536B";tbar.style.border="none";tbar.style.borderBottom="1px #000 solid";$("ditems").style.margin="0px 0 0 15px";div.style.border="none";div.style.position="absolute";div.style.top=tbar.getHeight()+"px";div.style.left="0px";div.style.width=tbar.getWidth()+"px";div.style.height=(window.getHeight()-tbar.getHeight())+"px";construct(2);A.onclick=function(){exit_fullscreen(A)};A.blur();window.scroll(0,0);create_markers();$("fs_status").innerHTML="Exit fullscreen"}function exit_fullscreen(A){currmaptype=map.getCurrentMapType();destroy();$("ln").style.display="inline";tbar.style.position="static";tbar.style.width="auto";tbar.style.top="auto";tbar.style.left="auto";tbar.style.border="1px #ccc dashed";tbar.style.backgroundColor="#fff";$("ditems").style.margin="10px 0 0 0";div.style.position="static";div.style.width="650px";div.style.height="500px";div.style.top="auto";div.style.left="auto";div.style.border="1px #000 solid";construct(1);A.onclick=function(){enter_fullscreen(A)};A.blur();create_markers();$("fs_status").innerHTML="Go fullscreen"}function show_loader(){loader.style.left=((window.getWidth()/2)-(240/2))+"px";loader.style.top=(((window.getHeight()/2)-(loader.getHeight()/2)))+"px";loader.style.display="inline"}function hide_loader(){loader.style.display="none"}function request_async(request,post,msg_el,callback){try{if(ro==null){ro=init_ajax();ro.onreadystatechange=function(){if(ro.readyState==4){data_arr=ro.responseText;ro.close;ro=null;if(callback!=null){eval(callback)}}};ro.open("POST",request,true);ro.setRequestHeader("Content-type","application/x-www-form-urlencoded");ro.send(post)}}catch(e){return false}}function init_ajax(){ro=false;if(window.XMLHttpRequest){try{ro=new XMLHttpRequest()}catch(A){ro=false}}else{if(window.ActiveXObject){try{ro=new ActiveXObject("Msxml2.XMLHTTP")}catch(A){try{ro=new ActiveXObject("Microsoft.XMLHTTP")}catch(A){ro=false}}}}return ro};
