function SaveSearchControl() { } SaveSearchControl.prototype = new GControl(); SaveSearchControl.prototype.initialize = function(map) { var container = document.createElement("div"); var zoomInDiv = document.createElement("div"); this.setButtonStyle_(zoomInDiv); container.appendChild(zoomInDiv); zoomInDiv.appendChild(document.createTextNode("Save Search")); GEvent.addDomListener(zoomInDiv, "click", function() { saveSearch(); }); map.getContainer().appendChild(container); return container; } SaveSearchControl.prototype.getDefaultPosition = function() { return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(271, 7)); } // Sets the proper CSS for the given button element. SaveSearchControl.prototype.setButtonStyle_ = function(button) { //button.style.textDecoration = "underline"; button.style.color = "#000000"; button.style.backgroundColor = "white"; button.style.font = "small Arial"; //button.style.fontWeight = "bold"; button.style.border = "1px solid black"; button.style.padding = "0px"; button.style.marginBottom = "3px"; button.style.textAlign = "center"; button.style.width = "8em"; button.style.height = "16px"; button.style.cursor = "pointer"; } function saveSearch() { var queryString = ""; var bounds = map.getBounds(); var southWest = bounds.getSouthWest(); var northEast = bounds.getNorthEast(); //queryString += "&property_category=1"; queryString += "&radarea=0"; queryString += "&searchtype=atlas"; queryString += "&sort=1"; queryString += "&searchtypesent=1"; queryString += "&SRRecordCount="+totalListings; queryString += "&SRPageCount=10"; queryString += "&TLat="+northEast.lat(); queryString += "&LLon="+southWest.lng(); queryString += "&BLat="+southWest.lat(); queryString += "&RLon="+northEast.lng(); queryString += "&T="+northEast.lat(); queryString += "&L="+southWest.lng(); queryString += "&B="+southWest.lat(); queryString += "&R="+northEast.lng(); if($('pn').value != "") queryString += "&pricemin=" + $('pn').value; else queryString += "&pricemin=0"; if($('px').value != "") queryString += "&pricemax=" + $('px').value; else queryString += "&pricemax=999999999"; if($('bd').value != "") queryString += "&beds=" + $('bd').value; if($('bt').value != "") queryString += "&bath=" + $('bt').value; if($('sn').value != "") queryString += "&sn=" + $('sn').value; if($('sx').value != "") queryString += "&sx=" + $('sx').value; if($('oh').checked) queryString += "&ohouse=" + $('oh').value; if($('rs').checked) queryString += "&single=" + $('rs').value; if($('tn').checked) queryString += "&townhouse=" + $('tn').value; if($('mb').checked) queryString += "&mobile=" + $('mb').value; if($('fm').checked) queryString += "&farm=" + $('fm').value; if($('cm').checked) queryString += "&commercial=" + $('cm').value; window.parent.location.href = "/myaccount/get.php?aid="+aid+"&oid="+oid+"&action=addsearch"+queryString; }