var hotel={map:null,scroll:false,init:function(){hotel.initializeMap();$("a[rel='gallery']").colorbox();$('.hotelPhotos a').hover(function(){$(this).addClass('highlight');},function(){$(this).removeClass('highlight');});$('.surveyAnswerType').die("click").live("click",function(){$(this).next('div').toggle();});$(".surveysVotingSection span").die("mouseenter mouseleave").live({mouseenter:function(){$(this).addClass('hover');},mouseleave:function(){$(this).removeClass('hover');}});$(".surveysVotingSection span").die("click").live("click",function(){hotel.helpfulness($(this));});$(".pager a").die("click").live("click",function(){hotel.scroll=true;});$.history.init(function(hash){if(hash==""){}else if(hash!==""&&hash.charAt(0)==="!"){hotel.navigateSurveys(hash);}},{unescape:",/=&"});},initializeMap:function(){var myOptions={scaleControl:true,mapTypeControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP,streetViewControl:true};var latlngHotel=new google.maps.LatLng(latitude,longitude);var latlngAirport=new google.maps.LatLng(airportLatitude,airportLongitude);var bounds=new google.maps.LatLngBounds();bounds.extend(latlngHotel);bounds.extend(latlngAirport);hotel.map=new google.maps.Map(document.getElementById("googleMap"),myOptions);hotel.map.fitBounds(bounds);hotel.addMarker(latlngAirport,false,'map_airport.png');hotel.addMarker(latlngHotel,false,'map_hotel.png');},addMarker:function(latlng,content,image){var marker=new google.maps.Marker({position:latlng,map:hotel.map,icon:path+'/reservation/images/misc/'+image});},helpfulness:function($obj){var answer=$obj.data("answer");var id=$obj.parent(".surveysVotingSection").data("id");var surveysHelpfulnessVoting=$obj.closest('.surveysHelpfulnessVoting');var surveysHelpfulnessSection=$obj.closest('.surveysHelpfulnessSection');$.get('/citiesServed.php',{action:'addUtility',type:answer,id:id},function(json){switch(json.status){case'success':surveysHelpfulnessVoting.addClass("voted").html('Thanks for you feedback');break;case'register':if(surveysHelpfulnessSection.children('.registerMessage').length==0){surveysHelpfulnessSection.append('<div class="registerMessage">You must log in to rate this review. Please <a href="'+path+'/user_accounts/" target="_blank">Login</a> or <a href="'+path+'/user_accounts/register.php" target="_blank">Register</a></div>');}
break;}},'json');},navigateSurveys:function(hash){var hotelId=$("input[name=hotelId]").val();var parameters=(hash).substr(1).split('&');var request={};for(var i=0;i<parameters.length;i++){var parameter=parameters[i].split('=');request[parameter[0]]=parameter[1];}
var page;if(typeof(request.page)!="undefined"){page=parseInt(request.page);}
if(typeof(page)=='undefined'){page=1;}
$.get('/citiesServed.php',{hotelId:hotelId,page:page},function(html){if(hotel.scroll){hotel.goToByScroll('reviews');}
$("#reviews").html(html);});},goToByScroll:function(id){$('html,body').animate({scrollTop:$("#"+id).offset().top},'slow');}};$(function(){hotel.init()});
