$(document).ready(function(){var a=false;$("input#search_box").autocomplete({source:function(b,d){$.ajax({url:"/searches/autocomplete/",data:{term:b.term},dataType:"json",success:function(e){d($.map(e,function(c){c.html='<span class="type-'+c.type+'">'+c.label+"</span>";return{label:c.html,id:c.id,value:c.label,url:c.url}}))}})},minLength:2,delay:100,open:function(){$("ul.ui-autocomplete li .type-venue").parent().parent().addClass("venue");$("ul.ui-autocomplete li .type-city").parent().parent().addClass("city");
$("ul.ui-autocomplete li .type-product").parent().parent().addClass("product")},select:function(b,d){a=true;window.location=d.item.url}});$("input#search_box").bind("keypress",function(b){if(b.keyCode==13&&a==false)window.location="/searches/text:"+$("#search_box").val()})});var latlng,map,myOptions,marker;$(document).ready(function(){var a="day_"+(new Date).getDay();$("#venue_hours tr#"+a+" td").css({"font-weight":"bold",color:"black","background-color":"white"})});
$(document).ready(function(){$("#link_recommend").click(function(){$("#comment-dialog").dialog("destroy");$("#comment-dialog").load("/comments/add/venue:"+$("#VenueVenueId").text(),function(){$("#comment-dialog").dialog({width:"400px",modal:true})})})});$(document).ready(function(){$("#link_error").click(function(){$("#error-dialog").dialog("destroy");$("#error-dialog").load("/comments/add_error_report/venue:"+$("#VenueVenueId").text(),function(){$("#error-dialog").dialog({width:"400px",modal:true})})})});
$(document).ready(function(){$(".fg-button:not(.ui-state-disabled)").hover(function(){$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover")}).mousedown(function(){$(this).parents(".fg-buttonset-single:first").find(".fg-button.ui-state-active").removeClass("ui-state-active");$(this).is(".ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active")?$(this).removeClass("ui-state-active"):$(this).addClass("ui-state-active")}).mouseup(function(){$(this).is(".fg-button-toggleable, .fg-buttonset-single .fg-button,  .fg-buttonset-multi .fg-button")||
$(this).removeClass("ui-state-active")})});function venue_map_initialize(){$("body").unload("GUnload");latlng=new google.maps.LatLng($("#venueLat").attr("content"),$("#venueLng").attr("content"));myOptions={zoom:16,center:latlng,mapTypeId:google.maps.MapTypeId.ROADMAP};map=new google.maps.Map(document.getElementById("gmap"),myOptions);marker=new google.maps.Marker({position:latlng,map:map,title:"Current position",draggable:false,clickable:true})}
$(document).ready(function(){$("#rat").children().not("select, #rating_title").hide();var a=$('<div id="caption"/>');$("#rat").stars({inputType:"select",oneVoteOnly:true,captionEl:a,callback:function(b,d,e){$("#messages").text("Saving...").fadeIn(30);$.post("/venue_ratings/ajax_vote",{rate:e,venue:$("#VenueVenueId").text()},function(c){$("#rating_title").text("Average rating");b.select(Math.round(c.avg));a.text(c.votes+" votes");$("#messages").text("Rating saved ("+e+"). Thanks!").stop().css("opacity",
1).fadeIn(30);setTimeout(function(){$("#messages").fadeOut(1E3)},2E3)},"json")}});a.appendTo("#rat");$('<div id="messages"/>').appendTo("#rat")});
function search_map_initialize(){$("body").unload("GUnload");latlng=new google.maps.LatLng(venueCords[0].geo_lat,venueCords[0].geo_lng);myOptions={zoom:14,center:latlng,mapTypeId:google.maps.MapTypeId.ROADMAP};map=new google.maps.Map(document.getElementById("gmap"),myOptions);mapSize=new google.maps.LatLngBounds(latlng,latlng);for(var a=0;a<venueCords.length;a++){var b=new google.maps.LatLng(venueCords[a].geo_lat,venueCords[a].geo_lng);marker=new google.maps.Marker({position:b,map:map});new InfoBox({latlng:marker.getPosition(),
map:map,marker:marker,label:venueCords[a].name,url:venueCords[a].slug});mapSize.extend(b)}map.fitBounds(mapSize)}
function InfoBox(a){google.maps.OverlayView.call(this);this.latlng_=a.latlng;this.map_=a.map;this.offsetVertical_=-10;this.offsetHorizontal_=10;this.height_=165;this.width_=266;this.label=a.label;this.marker=a.marker;this.url_="/"+a.url;var b=this;google.maps.event.addListener(this.marker,"mouseover",function(){return b.div_.style.display="block"});google.maps.event.addListener(this.marker,"mouseout",function(){return b.div_.style.display="none"});google.maps.event.addListener(this.marker,"click",
function(){window.location=b.url_});this.setMap(this.map_)}InfoBox.prototype=new google.maps.OverlayView;InfoBox.prototype.remove=function(){if(this.div_){this.div_.parentNode.removeChild(this.div_);this.div_=null}};
InfoBox.prototype.draw=function(){this.createElement();if(this.div_){var a=this.getProjection().fromLatLngToDivPixel(this.latlng_);if(a){this.div_.style.left=a.x+this.offsetHorizontal_+"px";this.div_.style.top=a.y+this.offsetVertical_+"px";this.div_.style.display="none";google.maps.event.addListener(this.div_,"mouseover",function(){return this.div_.style.display="block"});google.maps.event.addListener(this.div_,"mouseout",function(){return this.div_.style.display="none"})}}};
InfoBox.prototype.createElement=function(){var a=this.getPanes(),b=this.div_;if(b){if(b.parentNode!=a.floatPane){b.parentNode.removeChild(b);a.floatPane.appendChild(b)}}else{b=this.div_=document.createElement("div");b.style.position="absolute";b.style.whiteSpace="nowrap";b.style.backgroundColor="#fff";b.style.padding="2px 5px";b.style.border="1px solid #000";b.innerHTML=this.label;b.setAttribute("class","tooltip");b.style.display="none";a.floatPane.appendChild(b)}};
