map_search_close=false; search_map=false; var max_height=0; function close_search_box(){ if(!map_search_close){ $("#transfer").click(); } } function update_check_pro_type(){ if($('#property_type').val()==1){ $(".check_box_wz").removeAttr("checked"); $("#terrace").attr("checked","checked"); }else if($('#property_type').val()==2){ $(".check_box_wz").removeAttr("checked"); $("#semid").attr("checked","checked"); }else if($('#property_type').val()==3){ $(".check_box_wz").removeAttr("checked"); $("#bungalow").attr("checked","checked"); }else if($('#property_type').val()==4){ $(".check_box_wz").removeAttr("checked"); $("#condo").attr("checked","checked"); }else{ $(".check_box_wz").attr("checked","checked"); } check_property_type(); } $(document).ready(function() { $("#transfer").tooltip(); $("#showcase").awShowcase(awDefOption); $("#showcase1").awShowcase(awDefOption); $('.showcase').show(); $( "#check_selection" ).buttonset(); $("#new_complete >label").hover(function() { $(this).css("text-decoration","underline"); },function() { $(this).css("text-decoration","none"); }); $("#new_complete >label").click(function() { current_id="#"+$(this).attr("rel"); if($(current_id).attr("checked")=="checked"){ $(this).css("background","url('images/n_uncheck.jpg') no-repeat scroll 4px 0 #2d8994"); }else{ $(this).css("background","url('images/n_checked.jpg') no-repeat scroll 4px 0 #2d8994"); } }); $("#check_selection >label").hover(function() { $(this).css("text-decoration","underline"); },function() { $(this).css("text-decoration","none"); }); $(".check_img").show(); $("#close_property_loc").click(function(){ $("#property_loc_man").hide(); $("#dk_container_property_loc>.dk_options>ul>li>a").first().click(); $("#property_loc_div").show(); }); $("#close_min_max").click(function(){ $("#budget_min_max").hide(); $("#dk_container_property_bud>.dk_options>ul>li>a").first().click(); $("#budget_from_to").show(); }); $("#transfer").click(function(){ if(map_search_close){ $( "#box_img").fadeIn(500); box_left=$("#search_box").css("left").replace("px",""); box_left*=1; box_left-=(218-63); $( "#search_box").css({ "left":box_left+"px", "width":"218px", "height":"379px" }); setTimeout(function() { $( "#search_btn_img" ).effect( "transfer", { to: "#box_img", className: "ui-effects-transfer" }, 300); }, 200 ); map_search_close=false; }else{ $( "#box_img" ).effect( "transfer", { to: "#search_btn_img", className: "ui-effects-transfer" }, 300); setTimeout(function() { $( "#box_img").fadeOut(500); setTimeout(function() { $( "#search_box").css({ "height":"63px" }); setTimeout(function() { box_left=$("#search_box").css("left").replace("px",""); box_left*=1; box_left+=(218-63); $( "#search_box").css({ "left":box_left+"px", "width":"63px" }); }, 400 ); }, 300 ); }, 200 ); map_search_close=true; } }); $("#queryInput").focus(function(){ if($(this).val()=='Search Keyword'){ $(this).val(''); $(this).css("font-style","normal"); $(this).css("color","#333333"); console.log(111); } }); $("#queryInput").blur(function(){ if($(this).val()==''){ $(this).val("Search Keyword"); $(this).css("font-style","italic"); $(this).css("color","grey"); } }); $("#queryInput").val("Search Keyword"); $("#queryInput").css("font-style","italic"); $("#queryInput").css("color","grey"); $(".check_box_wz").add(".check_new_pro").change(function() { var zoomLvl = 11; if(window.location.href.indexOf("klang") > -1) { var lat = 3.131694; var lng = 101.637525; zoomLvl = 12; } else if (window.location.href.indexOf("penang") > -1) { var lat = 5.3773; var lng = 100.4001; } else { var lat = 1.505344; var lng = 103.736488; } var map = new google.maps.Map(document.getElementById("map_canvas"), { center: new google.maps.LatLng(lat, lng), zoom: zoomLvl, mapTypeId: 'roadmap' }); var infoWindow = new google.maps.InfoWindow; var query = document.getElementById("queryInput").value; close_search_box(); downloadUrl("phpsqlajax_genxml3.php?", function(data) { get_xml(data, map, infoWindow); }); }); $('#property_type').dropkick({ change: function (value, label) { if(value=='2'){ $("#dk_container_property_type > .dk_toggle").css("background-image","url(/images/search_smd.jpg)"); $("#gated_div").show(); }else if(value=='3'){ $("#dk_container_property_type > .dk_toggle").css("background-image","url(/images/search_vla.jpg)"); $("#gated_div").show(); }else if(value=='4'){ $("#dk_container_property_type > .dk_toggle").css("background-image","url(/images/search_cdm.jpg)"); $("#gated_div").hide(); }else { if(value=='1'){ $("#gated_div").show(); }else{ $("#gated_div").hide(); } $("#dk_container_property_type > .dk_toggle").css("background-image","url(/images/search_pro.jpg)"); } update_check_pro_type(); } }); $('#property_loc').dropkick(); $('#property_bud').dropkick({ change: function (value, label) { if(value==-1){ $("#budget_min_max").show(); $("#budget_from_to").hide(); } } }); $('#property_bud_min').dropkick(); $('#property_bud_max').dropkick(); $('#property_holding').dropkick(); $( "#search_box" ).draggable({ cursor: "move", containment: "#map_canvas",handle: "#box_img"}); $('#box_img').fadeIn(); $(".check_it_box").click(function(){ current_id="#"+$(this).attr("rel"); if($(current_id).attr("checked")=="checked"){ $(current_id).removeAttr("checked"); $(this).css("background","url('images/uncheck.png') no-repeat scroll 14px 0 transparent"); }else{ $(current_id).attr("checked","checked"); $(this).css("background","url('images/checked.png') no-repeat scroll 14px 0 transparent"); } }); $("#gated_img").css("background","url('images/uncheck.png') no-repeat scroll 14px 0 transparent"); $(".check_it_box").hover(function(){ $(this).css("text-decoration","underline"); },function(){ $(this).css("text-decoration","none"); }); $(".ui-widget").css("font-family","'Signika',Arial,sans-serif"); }); var customIcons = { n_HighRise: { icon: 'images/pin2/condo_n.png' }, n_Terrace: { icon: 'images/pin2/terrace_n.png' }, n_SemiD: { icon: 'images/pin2/house_n.png' }, n_Bungalow: { icon: 'images/pin2/house_n.png' }, s_HighRise: { icon: 'images/pin2/condo_s.png' }, s_Terrace: { icon: 'images/pin2/terrace_s.png' }, s_SemiD: { icon: 'images/pin2/semid_s.png' }, s_Bungalow: { icon: 'images/pin2/house_s.png' }, HighRise: { icon: 'images/pin2/condo.png' }, Terrace: { icon: 'images/pin2/terrace.png' }, SemiD: { icon: 'images/pin2/semid.png' }, Bungalow: { icon: 'images/pin2/house.png' } }; function check_property_type(){ if($("#condo").attr("checked")=="checked"){ $("#condo").next().css("background","url('images/checked.jpg') no-repeat scroll 0 1px #1ABC9C"); }else{ $("#condo").next().css("background","url('images/uncheck.jpg') no-repeat scroll 0 1px #1ABC9C"); } if($("#terrace").attr("checked")=="checked"){ $("#terrace").next().css("background","url('images/checked.jpg') no-repeat scroll 0 1px #1ABC9C"); }else{ $("#terrace").next().css("background","url('images/uncheck.jpg') no-repeat scroll 0 1px #1ABC9C"); } if($("#semid").attr("checked")=="checked"){ $("#semid").next().css("background","url('images/checked.jpg') no-repeat scroll 0 1px #1ABC9C"); }else{ $("#semid").next().css("background","url('images/uncheck.jpg') no-repeat scroll 0 1px #1ABC9C"); } if($("#bungalow").attr("checked")=="checked"){ $("#bungalow").next().css("background","url('images/checked.jpg') no-repeat scroll 0 1px #1ABC9C"); }else{ $("#bungalow").next().css("background","url('images/uncheck.jpg') no-repeat scroll 0 1px #1ABC9C"); } } function get_xml(data, map, infoWindow){ check_property_type(); $("#result_status").hide(); var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName("marker"); // console.log(markers.length); if(markers.length != 0){ for (var i = 0; i < markers.length; i++) { var id = markers[i].getAttribute("id"); var name = markers[i].getAttribute("name"); // var address = markers[i].getAttribute("address"); var link = new String(markers[i].getAttribute("link")); var featured = markers[i].getAttribute("featured"); var main_type = markers[i].getAttribute("main_type"); var dev = markers[i].getAttribute("dev"); var sub = markers[i].getAttribute("sub"); var tenure = markers[i].getAttribute("tenure"); var block = markers[i].getAttribute("block"); var unit = markers[i].getAttribute("unit"); var fee = markers[i].getAttribute("fee"); var car_park = markers[i].getAttribute("car_park"); var complete = markers[i].getAttribute("complete"); var min = markers[i].getAttribute("min"); var max = markers[i].getAttribute("max"); var tel = markers[i].getAttribute("tel"); var fax = markers[i].getAttribute("fax"); var web = markers[i].getAttribute("web"); var z_Index = google.maps.Marker.MAX_ZINDEX + parseInt(markers[i].getAttribute("priority")); var point = new google.maps.LatLng( parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var html = ""; html += ""; if (dev != ""){ html += ""; } if (sub != ""){ html += ""; } if (tenure != ""){ html += ""; } if (block != "0"){ html += ""; } if (unit != "0"){ html += ""; } if (fee != "0.00"){ html += ""; } if (car_park != "0"){ html += ""; } if (complete != ""){ html += ""; } if (min != "0"){ html += ""; } if (max != "0"){ html += ""; } if (tel != ""){ html += ""; } if (fax != ""){ html += ""; } if (web != ""){ html += ""; } html += "
" + name + " (View Detail)

Developer : "+ dev +"
Developer Subsidiary : "+ sub +"
Land Tenure : "+ tenure +"
Total Block : "+ block +"
Total Unit : "+ unit +"
Maintenance Fee (RM) : "+ fee +"/sqft
Total Car Park : "+ car_park +"
Expected Completion : "+ complete +"
Min. Price (RM) : "+ min +"
Max. Price (RM) : "+ max +"
Telephone : "+ tel +"
Fax : "+ fax +"
Website : "+ web +"
"; var icon = customIcons[main_type] || {}; var marker = new google.maps.Marker({ map: map, position: point, icon: icon.icon, zIndex: z_Index, dzIndex: z_Index // shadow: icon.shadow }); bindInfoWindow(marker, map, infoWindow, html); } }else{ //alert("nothing is found!"); //initialize(); function fadeOut(){ //$("#result_status").fadeTo(2000,0, function() {$(this).hide()}); } $("#result_status").css("color","red"); $("#result_status").html("No Result Found!"); $("#result_status").show().fadeTo(1000,0.75, fadeOut); } search_map=false; } function initialize(lat, lng, state) { var zoomLvl = 11; if(state == "Klang Valley") { zoomLvl = 12; } var map = new google.maps.Map(document.getElementById("map_canvas"), { center: new google.maps.LatLng(lat, lng), zoom: zoomLvl, mapTypeId: 'roadmap' }); var infoWindow = new google.maps.InfoWindow; $("#result_status").hide(); // Change this depending on the name of your PHP file downloadUrl("phpsqlajax_genxml3.php?project_state=" + state, function(data) { get_xml(data, map, infoWindow); }); } function convert( desc_html ){ return desc_html.replace("&", /&/g).replace(">", />/g).replace("<", /