﻿function maximizeMap()
{var viewportwidth;var viewportheight;if(typeof window.innerWidth!='undefined')
{viewportwidth=window.innerWidth,viewportheight=window.innerHeight}
else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0)
{viewportwidth=document.documentElement.clientWidth,viewportheight=document.documentElement.clientHeight}
else
{viewportwidth=document.getElementsByTagName('body')[0].clientWidth,viewportheight=document.getElementsByTagName('body')[0].clientHeight}
document.getElementById('hotel-detail-map-box').style.position='absolute';document.getElementById('hotel-detail-map-box').style.width=viewportwidth-30+'px';document.getElementById('hotel-detail-map-box').style.height=viewportheight+'px';document.getElementById('hotel-detail-map-box').style.left='0px';document.getElementById('hotel-detail-map-box').style.top='0px';document.getElementById('map').style.height=viewportheight-40+'px';document.getElementById('map').style.width=viewportwidth-50+'px';document.getElementById('linkMinimize').style.display='block';document.getElementById('linkMaximize').style.display='none';LoadMap(_lat,_lng);}
function minimizeMap()
{document.getElementById('hotel-detail-map-box').style.position='static';document.getElementById('hotel-detail-map-box').style.width='460px';document.getElementById('hotel-detail-map-box').style.height='410px';document.getElementById('map').style.height='390px';document.getElementById('map').style.width='450px';document.getElementById('linkMinimize').style.display='none';document.getElementById('linkMaximize').style.display='block';LoadMap(_lat,_lng);}
function OnLookupComplete(data,responseCode)
{var result=data;if(result!='Error')
{var ResultArr=result.split('|');if(ResultArr[0]!='NA')
{document.getElementById('hotel_information').innerHTML='<div>'+ResultArr[0]+'</div>';}
if(ResultArr[1]!='NA')
{document.getElementById('room_information').innerHTML='<div class="HotelContentHeading">Room Information</div><div>'+ResultArr[1]+'</div>';}
if(ResultArr[2]!='NA')
{document.getElementById('food_beverages').innerHTML='<div class="HotelContentHeading">Food & Beverages</div><div>'+ResultArr[2]+'</div>';}
if(ResultArr[3]!='NA')
{document.getElementById('area_information').innerHTML='<div class="HotelContentHeading">Area Information</div><div>'+ResultArr[3]+'</div>';}
if(ResultArr[4]!='NA')
{document.getElementById('travel_information').innerHTML='<div>'+ResultArr[4]+'</div>';}
if(ResultArr[5]!='NA'&&isContentUnique=='False')
{document.getElementById('quick_description').innerHTML=ResultArr[5];}
if(ResultArr[6]!='NA')
{document.getElementById('important_information').innerHTML='<div class="HotelContentHeading">Important Information</div><div>'+ResultArr[6]+'</div>';}
if(ResultArr[7]!='NA')
{document.getElementById('cancellation_policy').innerHTML='<div class="HotelContentHeading">Cancellation Policy</div><div>'+ResultArr[7]+'</div>';}
if(ResultArr[8]!='NA')
{document.getElementById('children_extra_bed_policy').innerHTML='<div class="HotelContentHeading">Children Extra Bed Policy</div><div>'+ResultArr[8]+'</div>';
}
}}


var map;var route;function LoadMap(latitude,longitude)
{if(GBrowserIsCompatible())
{var docElements=document.getElementById("docElements");while(docElements.hasChildNodes())
{docElements.removeChild(docElements.lastChild);}
map=new GMap2(document.getElementById("map"));map.addControl(new GSmallMapControl());map.addControl(new GMapTypeControl());map.setCenter(new GLatLng(parseFloat(latitude),parseFloat(longitude)),14);var baseIcon=new GIcon();baseIcon.image="http://www.ukhotels4u.com/images/UKICONS.gif";baseIcon.iconSize=new GSize(29,44);baseIcon.shadowSize=new GSize(22,20);baseIcon.iconAnchor=new GPoint(9,34);baseIcon.infoWindowAnchor=new GPoint(9,2);var point=new GLatLng(parseFloat(latitude),parseFloat(longitude));map.addOverlay(new GMarker(point,baseIcon));var xmlfilepath=_siteUrl+"/xml/GetNearestAirports.aspx?HotelID="+_hID;GDownloadUrl(xmlfilepath,function(data,responseCode)
{var xml=GXml.parse(data);var rows=xml.documentElement.getElementsByTagName("Airports");for(var i=0;i<rows.length;i++)
{AddMarker(rows[i].getElementsByTagName("latitude")[0].firstChild.data,rows[i].getElementsByTagName("longitude")[0].firstChild.data,'airport',rows[i].getElementsByTagName("distance")[0].firstChild.data,rows[i].getElementsByTagName("name")[0].firstChild.data);}});var xmlfilepath=_siteUrl+"/xml/GetNearestRailwayStations.aspx?HotelID="+_hID;GDownloadUrl(xmlfilepath,function(data,responseCode)
{var xml=GXml.parse(data);var rows=xml.documentElement.getElementsByTagName("RailwayStations");for(var i=0;i<rows.length;i++)
{AddMarker(rows[i].getElementsByTagName("latitude")[0].firstChild.data,rows[i].getElementsByTagName("longitude")[0].firstChild.data,'rail',rows[i].getElementsByTagName("distance")[0].firstChild.data,rows[i].getElementsByTagName("name")[0].firstChild.data+' Railway Station');}});var xmlfilepath=_siteUrl+"/xml/GetNearestTubeStation.aspx?HotelID="+_hID;GDownloadUrl(xmlfilepath,function(data,responseCode)
{var xml=GXml.parse(data);var rows=xml.documentElement.getElementsByTagName("TubeStations");for(var i=0;i<rows.length;i++)
{AddMarker(rows[i].getElementsByTagName("latitude")[0].firstChild.data,rows[i].getElementsByTagName("longitude")[0].firstChild.data,'tube',rows[i].getElementsByTagName("distance")[0].firstChild.data,rows[i].getElementsByTagName("name")[0].firstChild.data+' TubeStation');}});var xmlfilepath=_siteUrl+"/xml/GetNearestAttractions.aspx?HotelID="+_hID;GDownloadUrl(xmlfilepath,function(data,responseCode)
{var xml=GXml.parse(data);var rows=xml.documentElement.getElementsByTagName("Attractions");for(var i=0;i<rows.length;i++)
{AddMarker(rows[i].getElementsByTagName("latitude")[0].firstChild.data,rows[i].getElementsByTagName("longitude")[0].firstChild.data,'attraction',rows[i].getElementsByTagName("distance")[0].firstChild.data,rows[i].getElementsByTagName("attraction_name")[0].firstChild.data);}
map.checkResize();map.setCenter(new GLatLng(parseFloat(latitude),parseFloat(longitude)),14);});}
}
function AddMarker(alat,alng,type,distance,name)
{var docElements=document.getElementById("docElements");var newdiv=document.createElement('div');if(type=='attraction'){newdiv.className='near-attraction';}
if(type=='airport')
{newdiv.className='near-airport';}
if(type=='rail')
{newdiv.className='near-railway-station';}
if(type=='tube')
{newdiv.className='near-tube-station';}
var newA=document.createElement('a');newA.innerHTML=name+' ('+distance+' km)';newA.onclick=function()
{map.setCenter(new GLatLng(parseFloat(alat),parseFloat(alng)),14)}
newdiv.appendChild(newA);docElements.appendChild(newdiv);var Icon=new GIcon();Icon.image="http://www.ukhotels4u.com/mapImageIcon.aspx?type="+type+"&distance="+distance+"&txt="+name;Icon.iconSize=new GSize(100,67);Icon.shadowSize=new GSize(22,20);Icon.iconAnchor=new GPoint(9,34);Icon.infoWindowAnchor=new GPoint(9,2);var point=new GLatLng(parseFloat(alat),parseFloat(alng));var marker=new GMarker(point,Icon);map.addOverlay(marker);GEvent.addListener(marker,"click",function()
{if(route!=null)
{map.removeOverlay(route);}
var mLatlang=marker.getLatLng();var query='from:('+mLatlang.lat()+','+mLatlang.lng()+') to:('+_lat+','+_lng+')';
var directions=new GDirections();directions.load(query,{getPolyline:true,getSteps:true});google.maps.Event.addListener(directions,"load",function()
{route=directions.getPolyline();map.addOverlay(route);var dresult='<div class="mapDirection">Direction from <b>'+name+'</b> to <b>'+_hName+'</b> '+directions.getSummaryHtml()+'<ul>';var dcount=directions.getNumRoutes();if(dcount>0)
{var droute=directions.getRoute(0);var stepcount=droute.getNumSteps();for(var i=0;i<stepcount;i++)
{var stepRoute=droute.getStep(i);dresult+='<li>'+stepRoute.getDescriptionHtml()+'('+stepRoute.getDistance().html+' '+stepRoute.getDuration().html+')</li>';}
dresult+='</ul></div>';marker.openInfoWindowHtml(dresult);}});});}
