function reportlisting(C){var B=new ajax_connect(ROOT_PATH+"ajax/ajax_module_classifieds.php","POST");B.setVars("func=flag_internet_ad");B.setVars("webad_id",C);var A=$$(".report_"+C);A.each(function(E){var D=E.getFirst().innerHTML;try{E.getFirst().getFirst().getTag()}catch(F){D=_lang("classifieds","reported_listing")}E.setHTML(D)});B.onComplete(function(D){});B.sendData()}var map=null;var all_markers=[];var mgr=null;var wayPoints=[];function initClassifiedsMap(C,A,B){if(GBrowserIsCompatible()){if((B==null)||(B.toInt()<0)||(B.toInt()>17)){B=13}map=new GMap2($("listing_map"),{draggableCursor:"auto",draggingCursor:"move"});A=strToGLatLng(A);map.setCenter(A,B);mgr=new MarkerManager(map);all_markers=C;C.each(function(E,D){addMarker(E.point,E.text,D+1);wayPoints[wayPoints.length]={point:strToGLatLng(E.point),id:E.id,text:E.text}});GEvent.addListener(map,"click",function(E,D){updateStartLocation(D)});map.addControl(new GLargeMapControl());map.disableDoubleClickZoom();map.enableScrollWheelZoom();map.setCenter(A,B);window.addEvent("domready",function(){try{var D=document.getElement("#listing_start a[rel=update_start_location]");D.removeProperty("href");D.addEvent("click",manualStartPoint)}catch(E){}})}}function updateStartLocation(C,B){if(C==null){return }if(B==null){B=true}if(($type(C)=="string")&&(C.search(/^-?[0-9,\.]+\,-?[0-9,\.]+$/)!=-1)){C=strToGLatLng(C)}if(polylines.length>0){polylines.each(function(I){I.hide()});polylines.empty()}var F=$A(wayPoints);F.splice(0,0,{point:C,id:"-1"});F=drawDirections(F);F.splice(0,1);var H=new Element("div",{id:"listing_box"});var E=$("listing_box");var G=$("listing_start");G.getElement(".text").set("html","<strong>1</strong>.  My start location");G.getElement(".actions").set("html",'<a title="Update Start Location" rel="update_start_location">Update Start Location</a> | <a title="Locate" href="javascript:goToPoint(\''+GLatLngToStr(C)+"');\">Locate</a>");G.getElement("a[rel=update_start_location]").addEvent("click",manualStartPoint);G.inject(H,"bottom");F.each(function(K,J){var I=E.getElement("#listing_"+K.id);I.getElement("strong").set("html",J+2);I.inject(H,"bottom")});H.replaces(E);if(B){var D=false;var A=new GReverseGeocoder(map);GEvent.addListener(A,"load",function(I){document.getElement("#listing_start input").value=I.address.replace(/\, Canada/,"")});GEvent.addListener(A,"error",function(){if(!D){A.setExperimentalHouseNumber(false);A.reverseGeocode(C);D=true}});A.setExperimentalHouseNumber(true);A.reverseGeocode(C)}}function manualStartPoint(){var A=document.getElement("#listing_start input[type=text]").value;if(A.length>0){geocodeLatLng(A,function(B){if(B!=null){updateStartLocation(B,false)}})}}var clusterIcon=null;var customIcon=null;var lockUpdate=false;function initRentalsMap(A,B){if(GBrowserIsCompatible()){if((B==null)||(B.toInt()<0)||(B.toInt()>17)){B=13}else{B=B.toInt()}map=new GMap2($("listing_map"),{draggableCursor:"auto",draggingCursor:"move"});clusterIcon=new GIcon(G_DEFAULT_ICON,"images/markers/cluster.gif");clusterIcon.iconSize=new GSize(26,25);clusterIcon.shadow="images/markers/cluster_shadow.gif";clusterIcon.shadowSize=new GSize(22,20);clusterIcon.printImage="images/markers/cluster.gif";clusterIcon.mozPrintImage="images/markers/cluster.gif";clusterIcon.shadowSize=new GSize(0,0);customIcon=new GIcon(G_DEFAULT_ICON,"images/markers/single.gif");customIcon.iconSize=new GSize(12,20);customIcon.shadow="images/markers/single_shadow.gif";customIcon.shadowSize=new GSize(22,20);customIcon.printImage="images/markers/single.gif";customIcon.mozPrintImage="images/markers/single.gif";customIcon.shadowSize=new GSize(0,0);A=strToGLatLng(A);map.setCenter(A,B);map.addControl(new GLargeMapControl());map.enableScrollWheelZoom();map.disableDoubleClickZoom();GEvent.addListener(map,"moveend",function(){if(!lockUpdate){updateRentalsMap()}});GEvent.addListener(map,"infowindowopen",function(){lockUpdate=true});GEvent.addListener(map,"infowindowclose",function(){lockUpdate=false;updateRentalsMap()});updateRentalsMap()}}function rentalPaginate(C){var A=document.getElements(".ewindow .ewindow_box");var B=-1;A.each(function(E,D){if(E.getStyle("display")!="none"){B=D;E.setStyle("display","none")}});if(((C!="prev")&&(C!="next"))||(B==-1)){return }if(C=="prev"){if(B==0){B=A.length-1}else{B--}}else{if(C=="next"){if(B==(A.length-1)){B=0}else{B++}}}A[B].setStyle("display","block")}function updateRentalsMap(){if(map!=null){var D=new ajax_connect(ROOT_PATH+"ajax/ajax_maps_common.php","POST");D.setVars("func=cluster_points");var C=map.getBounds();var B=C.getSouthWest();var A=C.getNorthEast();D.setVars("ne",A.toUrlValue());D.setVars("sw",B.toUrlValue());D.onComplete(function(H){map.clearOverlays();if(H.type=="xml"){for(i=0;i<H.data.getElementsByTagName("row").length;i++){var G=_xmlfetch(H.data,"type",i);if(G=="m"){var E=_xmlfetch(H.data,"geocode",i);var I=_xmlfetch(H.data,"description",i);var F=createMarker(E,{text:I,icon:customIcon,type:"m"});map.addOverlay(F)}else{if(G=="c"){var E=_xmlfetch(H.data,"geocode",i);var F=createMarker(E,{icon:clusterIcon,type:"c"});map.addOverlay(F)}}}}});D.sendData()}}var image_page=new Hash();function initImagePaginator(C,B){var D=C.getElement(".imgpagin");if(D!=null){image_page.set(B,1);D.getElement(".previous").setStyle("cursor","pointer");D.getElement(".next").setStyle("cursor","pointer");var A=C.getElements(".photo_result");D.getElement(".previous").addEvent("click",function(){if(image_page.get(B)!=1){A.each(function(E){E.setStyle("display","none")});image_page.set(B,image_page.get(B)-1);A[image_page.get(B)-1].setStyle("display","block");C.getElement(".current strong").setHTML(image_page.get(B))}});D.getElement(".next").addEvent("click",function(){if(image_page.get(B)!=A.length){A.each(function(E){E.setStyle("display","none")});image_page.set(B,image_page.get(B)+1);A[image_page.get(B)-1].setStyle("display","block");C.getElement(".current strong").setHTML(image_page.get(B))}})}};