function LocationsObject(){this.eatouts=new Array();this.eatouts_arr=new Array();this.filtered=new Array();this.filtered_arr=new Array()}function EatoutsObject(){this.map=new Object();this.mgr=new Object();this.selectedMarker=new Object();this.markerAttached=false;this.markerGroups=new Array();this.type="eatout";this.locations=new LocationsObject();this.first_eatout=0;this.last_eatout=9;this.sorting=eval("({'criteria': '', 'sortby': ''})")}var e;function GoogleMapClick(a,b){$("#id-"+b).addClass("selected_onmap");if(!e.markerAttached){e.mgr.addMarker(e.selectedMarker,11,17);e.markerAttached=true}$("#info_slideup").empty();$("#close-info_slideup").unbind("click");e.type=a;$.get(global.SERVER+"/ajax/eatout/"+b+"/",renderShortInfo)}function CheckFavorites(a){$favitems=$("#favorites #myfavs").children("div");found=false;$.each($favitems,function(b,c){if($(this).find(".other_info").children("div").text()==a){found=true}});return found}var renderShortInfo=function(data){data=eval(data);e.selectedMarker.setLatLng(new GLatLng(parseFloat(data[0].lat)-0.00001,data[0].lng));e.map.setCenter(new GLatLng(data[0].lat,data[0].lng));$("<div><span class='title'>"+data[0].title+"</span><img id='close-info_slideup' src='/static/images/close_button.gif'/></div>").appendTo("#info_slideup");form="<div class='favorite_form' style='display:none;'><form method='post' action='/favorite/add/' id='favoriteform-"+data[0].id+"'><input type='hidden' value='24' name='ctype_id'/><input type='hidden' value='"+data[0].id+"' name='obj_id'/><input type='hidden' value='"+document.location.pathname+"' name='next'/><input type='submit' value='Add To Favorites'/></form></div>";var append_data="";append_data+="<div id='short_desc'>";if(data[0].photo){append_data+="<img src='/"+ParsePhotoURL(data[0].photo,"s")+"' class='photo' />"}else{append_data+="<img src='/static/images/no_image.gif' />"}address=(data[0].address)?(data[0].address):"NOT DEFINED";append_data+="<div><span class='address'> Address: "+address+"</span><span class='cuisines'> <h4>Cuisines: "+get_cuisines(e.locations.filtered["id-"+data[0].id],"links")+"</h4></span></div></div><div>";if(CheckFavorites(data[0].title)){append_data+="<a id='mapid-"+data[0].id+"' href='#' class='addfavorites favorite'>Add to Favorites</a>"}else{append_data+=form+"<a id='mapid-"+data[0].id+"' href='#' class='addfavorites'>Add to Favorites</a>"}append_data+="<a href='/eatout/"+e.locations.filtered["id-"+data[0].id][0].slug+"/' class='readmore'>Read more</a><div>";$("#info_slideup").append(append_data);$("#mapid-"+data[0].id).unbind("click").bind("click",AddFavoriteAjax);$("#info_slideup").animate({bottom:"0px"},"normal");$("#close-info_slideup").hover(function(){$(this).attr("src","/static/images/close_button_red.gif")},function(){$(this).attr("src","/static/images/close_button.gif")});$("#close-info_slideup").click(function(){$("#info_slideup").animate({bottom:"-141px"},"normal")})};$(document).ready(function(){e=new EatoutsObject();$.get(global.SERVER+"/ajax/eatout/",add_eatouts);var b=new GIcon(G_DEFAULT_ICON);b.image="/static/images/gicons/selected_marker.png";b.iconSize=new GSize(27,9);b.shadow="";b.iconAnchor=new GPoint(13,10);var a={icon:b,draggable:false};e.selectedMarker=new GMarker(new GLatLng(100,100),a);e.selectedMarker.can_see=true});function moveMapTo(a){e.map.panTo(new GLatLng(e.locations.filtered[a][0].lat,e.locations.filtered[a][0].lng));GoogleMapClick("eatout",a.split("-")[1])}function PrepareArray(a){for(i=0;i<a.length;i++){if(!e.locations.eatouts["id-"+a[i].id]){e.locations.eatouts_arr.push("id-"+a[i].id);e.locations.eatouts["id-"+a[i].id]=new Array()}e.locations.eatouts["id-"+a[i].id].push(a[i])}e.locations.filtered_arr=e.locations.eatouts_arr;e.locations.filtered=e.locations.eatouts}var add_eatouts=function(data){data=eval(data);PrepareArray(data);if(GBrowserIsCompatible()){e.map=new GMap2(document.getElementById("map"));var topright=new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(10,10));e.map.addControl(new GSmallZoomControl3D(),topright);e.map.setCenter(new GLatLng(15.492889,73.821516),10);var mgrOptions={borderPadding:50,maxZoom:17,trackMarkers:true};e.mgr=new MarkerManager(e.map,mgrOptions);$("<div id='info_slideup'></div>").appendTo("#map")}bindEvents()};
