var city = { "1":[ {"key": "", "value":"(choose one)"}, {"key":11, "value":"Cebu City"}, {"key":12, "value":"Mandaue City"}, {"key":13, "value":"lapulapu City"}, {"key":14, "value":"Talisay City"}, {"key":15, "value":"liloan City"}, {"key":16, "value":"Cebu North Side"}, {"key":17, "value":"Cebu South Side"}, ], "2":[ {"key": "", "value":"(choose one)"}, {"key":21, "value":"Makati City"}, {"key":22, "value":"Taguig City"}, {"key":23, "value":"Mandaluyong City"}, {"key":24, "value":"Pasay City"}, {"key":25, "value":"Quezon City"}, {"key":26, "value":"Manila City"}, {"key":27, "value":"Pasig City"}, ], } var region = { "11":[ {"key": "", "value":"(choose one)"}, {"key":1101, "value":"Mabolo"}, {"key":1102, "value":"Banawa"}, {"key":1103, "value":"Lahug"}, {"key":1104, "value":"Banilad"}, {"key":1105, "value":"Fente osmena"}, {"key":1106, "value":"Ayala"}, {"key":1107, "value":"Guadalupe"}, {"key":1108, "value":"Tisa"}, {"key":1109, "value":"Busay"}, {"key":1110, "value":"SRP"}, {"key":1111, "value":"Gorord"}, {"key":1112, "value":"N Escario"}, {"key":1113, "value":"Talamban"}, {"key":1114, "value":"Kasambagan"}, {"key":1115, "value":"Apas"}, ], "12":[ {"key": "", "value":"(choose one)"}, {"key":1201, "value":"AS fortuna"}, {"key":1202, "value":"NRP"}, {"key":1203, "value":"Centro"}, {"key":1204, "value":"Cubancalan"}, {"key":1205, "value":"Hi-way"}, {"key":1206, "value":"Bakilid"}, {"key":1207, "value":"Tabok"}, {"key":1208, "value":"Canduman"}, {"key":1209, "value":"Subandaku"}, ], "13":[ {"key": "", "value":"(choose one)"}, {"key":1301, "value":"Mactan"}, {"key":1302, "value":"Lapu Lapu"}, {"key":1303, "value":"Marigondon"}, {"key":1304, "value":"Maribago"}, {"key":1305, "value":"Punta engano"}, {"key":1306, "value":"Pusok"}, {"key":1307, "value":"Cordova"}, {"key":1308, "value":"Buyong"}, {"key":1309, "value":"Basak"}, {"key":1310, "value":"Pajac"}, {"key":1311, "value":"Bankal"}, {"key":1312, "value":"Pajo"}, {"key":1313, "value":"Poblacion"}, ], "14":[ {"key": "", "value":"(choose one)"}, {"key":1401, "value":"Mohon"}, {"key":1402, "value":"Biasong"}, {"key":1403, "value":"Dumlog"}, {"key":1404, "value":"Minganilla"}, {"key":1405, "value":"Lagtang"}, {"key":1406, "value":"bulacao"}, {"key":1407, "value":"Lawaan1"}, {"key":1408, "value":"lawaan2"}, {"key":1409, "value":"lawaan3"}, {"key":1410, "value":"Manipis"}, {"key":1411, "value":"podlacion"}, {"key":1412, "value":"Tabunok"}, ], "15":[ {"key": "", "value":"(choose one)"}, {"key":1501, "value":"Cabadiangan"}, {"key":1502, "value":"Calero"}, {"key":1503, "value":"Catarman"}, {"key":1504, "value":"Cotcot"}, {"key":1505, "value":"Jubay"}, {"key":1506, "value":"Lataban"}, {"key":1507, "value":"Mulao"}, {"key":1508, "value":"Poblacion"}, {"key":1509, "value":"San Roque"}, {"key":1510, "value":"San Vicente"}, {"key":1511, "value":"Santa Cruz"}, {"key":1512, "value":"Tabla"}, {"key":1513, "value":"Tayud"}, {"key":1514, "value":"Yati"}, ], "16":[ {"key": "", "value":"(choose one)"}, {"key":1601, "value":"all"}, ], "17":[ {"key": "", "value":"(choose one)"}, {"key":1701, "value":"all"}, ], "21":[ {"key": "", "value":"(choose one)"}, {"key":2101, "value":"all"}, ], "22":[ {"key": "", "value":"(choose one)"}, {"key":2201, "value":"all"}, ], "23":[ {"key": "", "value":"(choose one)"}, {"key":2301, "value":"all"}, ], "24":[ {"key": "", "value":"(choose one)"}, {"key":2401, "value":"all"}, ], "25":[ {"key": "", "value":"(choose one)"}, {"key":2501, "value":"all"}, ], "26":[ {"key": "", "value":"(choose one)"}, {"key":2601, "value":"all"}, ], "27":[ {"key": "", "value":"(choose one)"}, {"key":2701, "value":"all"}, ], } var typeArray = { "1":[ {"key":1, "value":"for sale"}, {"key":2, "value":"for rent"}, {"key":3, "value":"rent to own"}, ], "2":[ {"key":1, "value":"for sale"}, ], "3":[ {"key":2, "value":"for rent"}, ], "4":[ {"key":2, "value":"for rent"}, ], "5":[ {"key":2, "value":"for rent"}, ], "6":[ {"key":1, "value":"for sale"}, {"key":2, "value":"for rent"}, {"key":3, "value":"rent to own"}, ], } $(function(){ // type category $('#PropertyCategory').change(function(){ $('#Type').empty(); $('#SearchBox').empty(); $('#CategoriesBox').empty(); $('#NearestLandmarkBox').empty(); $('#AmenitiesBox').empty(); if ($(this).val() > 0) { $.each(typeArray[$(this).val()],function(key,value){ //$('#PropertyType').append(""); $('#Type').append('' +value["value"] + ''); }); } }); // type change $('#Type').change(function(){ category = $("select[name='data[category]']").val(); type = $("input:radio[name='data[type]']:checked").val(); changeSearchBox(category, type); }); // 初期化 $('#Type').empty(); $('#PropertyCategory').val(6); // 初期値 if ($('#PropertyCategory').val() > 0) { $.each(typeArray[$('#PropertyCategory').val()],function(key,value){ //$('#PropertyType').append(""); $('#Type').append('' +value["value"] + ''); }); } //$('#Type').attr("checked", true); $("input[name='data[type]']").val([]); category = $("select[name='data[category]']").val(); //alert("選択しているタイプは、" + $("input:radio[name='data[type]']:checked").val()); type = $("input:radio[name='data[type]']:checked").val(); //alert($('#Type:checked').val()); changeSearchBox(category, type); //$('#furnish').val(2); //$('#School').attr("checked", true ); // area $('#PropertyArea1').change(function(){ //alert('change area1'); $('#PropertyArea2').empty(); $('#PropertyArea3').empty(); if ($(this).val() > 0) { $.each(city[$(this).val()],function(key,value){ $('#PropertyArea2').append(""); }); } }); // area3 $('#PropertyArea2').change(function(){ //alert('pr2 change'); $('#PropertyArea3').empty(); if ($(this).val() > 0) { $.each(region[$(this).val()],function(key,value){ $('#PropertyArea3').append(""); }); } }); $('#PropertyArea1').val(); $('#PropertyArea1').val(2); // 初期値 $('#PropertyArea2').empty(); //$('#PropertyArea3').empty(); //alert($('#PropertyArea1').val()); if ($('#PropertyArea1').val() > 0) { $.each(city[$('#PropertyArea1').val()],function(key,value){ $('#PropertyArea2').append(""); }); } $('#PropertyArea2').val(); $('#PropertyArea2').val(); // 初期値 if ($('#PropertyArea2').val() > 0) { $.each(region[$('#PropertyArea2').val()],function(key,value){ $('#PropertyArea3').append(""); }); } $('#PropertyArea3').val(); $('#MaxPrice').val(""); $('#MinPrice').val(""); $('#MaxBedroom').val(""); $('#MinBedroom').val(""); $('#MaxSize').val(""); $('#MinSize').val(""); $('#Status').val(""); $('#StatusCom').val(""); $('#Furnish').val(""); $('#NoOfFloor').val(""); $('#Developer').val(""); $('#Turnover').val(""); $('#YearRange').val(""); // nearest landmark $('#School').val([]); $('#Hospital').val([]); $('#Mall').val([]); $('#MainRoad').val([]); $('#Beach').val([]); $('#NlSubdivision').val([]); $('#Office').val([]); $('#Pool').val([]); $('#Garden').val([]); $('#ExtraLot').val([]); $('#Terrace').val([]); $('#Cctv').val([]); $('#Subdivision').val([]); $('#Townhouse').val([]); $('#Pets').val([]); $('#Gym').val([]); $('#Playground').val([]); $('#CornerUnit').val([]); $('#EastDirection').val([]); $('#Balcony').val([]); $('#ParkingSpace').val([]); // end $("#cebu_area, .cebu").on("click", function () { //alert('aa'); $("#manila").fadeOut() $("#manila").hide(); //$("#cebu").show(); $("#cebu").fadeIn(); $.removeCookie("area"); $.cookie("area", "cebu", { expires: 7 }); $("html, body").animate({scrollTop: 600}, 500); }); $("#manila_area, .manila").on("click", function () { //alert('bb'); $("#cebu").fadeOut() $("#cebu").hide(); //$("#manila").show(); $("#manila").fadeIn(); $.removeCookie("area"); $.cookie("area", "manila", { expires: 7 }); $("html, body").animate({scrollTop: 600}, 500); }); var area = $.cookie("area"); if (area == "manila") { $("#cebu").hide(); $("#manila").show(); } else { $("#manila").hide(); $("#cebu").show(); } $("#cebu_area").hover( function(){ $("#cebu_img").css({'opacity' : 0.7}); }, function(){ $("#cebu_img").css({'opacity' : 1}); } ); $("#manila_area").hover( function(){ $("#manila_img").css({'opacity' : 0.7}); }, function(){ $("#manila_img").css({'opacity' : 1}); } ); // great deals setTimeout(function(){$('img#gd_img1').fadeOut(3000,function(){$(this).fadeIn(2000)});},0); setTimeout(function(){$('img#gd_img2').fadeOut(3000,function(){$(this).fadeIn(2000)});},3000); setTimeout(function(){$('img#gd_img3').fadeOut(3000,function(){$(this).fadeIn(2000)});},6000); setTimeout(function(){$('img#gd_img4').fadeOut(3000,function(){$(this).fadeIn(2000)});},9000); setTimeout(function(){$('img#gd_img5').fadeOut(3000,function(){$(this).fadeIn(2000)});},12000); setTimeout(function(){$('img#gd_img6').fadeOut(3000,function(){$(this).fadeIn(2000)});},15000); setInterval(function(){ setTimeout(function(){$('img#gd_img1').fadeOut(3000,function(){$(this).fadeIn(2000)});},0); setTimeout(function(){$('img#gd_img2').fadeOut(3000,function(){$(this).fadeIn(2000)});},3000); setTimeout(function(){$('img#gd_img3').fadeOut(3000,function(){$(this).fadeIn(2000)});},6000); setTimeout(function(){$('img#gd_img4').fadeOut(3000,function(){$(this).fadeIn(2000)});},9000); setTimeout(function(){$('img#gd_img5').fadeOut(3000,function(){$(this).fadeIn(2000)});},12000); setTimeout(function(){$('img#gd_img6').fadeOut(3000,function(){$(this).fadeIn(2000)});},15000); },18000); }); function changeSearchBox(category, type) { $('#SearchBox').empty(); $('#CategoriesBox').empty(); $('#NearestLandmarkBox').empty(); $('#AmenitiesBox').empty(); //alert(category + ":" + type); if (type == 1) { // for sale if (category == 1) { // house //priceRange(); bedroomRange(); //areaBySqm(); status(); furnish(); noOfFloor(); nearestLandMark(); } else if (category == 2) { // lot //priceRange(); //areaBySqm(); } else if (category == 6) { // condo //priceRange(); bedroomRange(); //areaBySqm(); status(); furnish(); noOfFloor(); nearestLandMark(); developer(); turnover(); } } else if (type == 2) { // for rent if (category == 1) { // house //priceRange(); bedroomRange(); //areaBySqm(); furnish(); noOfFloor(); nearestLandMark(); amenitiesHouse(); } else if (category == 3) { // commercial //priceRange(); //areaBySqm(); nearestLandMark(); statusCom(); } else if (category == 4) { // office //priceRange(); //areaBySqm(); nearestLandMark(); } else if (category == 5) { // apartment //rentalRange(); bedroomRange(); //areaBySqm(); furnish(); noOfFloor(); nearestLandMark(); amenitiesApartment(); } else if (category == 6) { // condo //rentalRange(); bedroomRange(); //areaBySqm(); furnish(); noOfFloor(); nearestLandMark(); amenitiesCondo(); } } else if (type == 3) { // rent to own if (category == 1) { // house //priceRange(); bedroomRange(); //areaBySqm(); furnish(); noOfFloor(); nearestLandMark(); amenitiesHouse(); yearRange(); } else if (category == 6) { // condo //rentalRange(); bedroomRange(); //areaBySqm(); furnish(); noOfFloor(); nearestLandMark(); amenitiesCondo(); yearRange(); } } } function priceRange() { $('#SearchBox').append('Price Range Max'); $('#SearchBox').append(' Min'); } function rentalRange() { $('#SearchBox').append('Rental Range Max'); $('#SearchBox').append(' Min'); } function bedroomRange() { var bedroom_text = ''; bedroom_text += 'Bed Room/s'; bedroom_text += ''; bedroom_text += ''; $('#CategoriesBox').append(bedroom_text); } function areaBySqm() { var size_text = ''; size_text += 'Area By SQM'; size_text += ''; size_text += ''; $('#CategoriesBox').append(size_text); } function status() { var status_text = ''; status_text += 'Status'; status_com_text += ''; $('#CategoriesBox').append(status_com_text); //追加するとき $('#StatusCom').append($('