text: ﻿function LoadVipType(n){n=n!=null?n:0;$(".hplVipType").removeClass("hplVipType-active");$("#hpVip"+n).addClass("hplVipType-active");$("#viptype-title").html("<b>"+$("#hpVip"+n).text()+" :<\/b>");$(".preview").find(".row-right").hide();$("#vip-desc"+n).show();switch(n){case"0":$("#vip-preview-title").attr("class","vipdb");$("#txtUnitPrice").text("50.000 VND/ 1 ngày");break;case"1":$("#vip-preview-title").attr("class","vip1");$("#txtUnitPrice").text("25.000 VND/ 1 ngày");break;case"2":$("#vip-preview-title").attr("class","vip2");$("#txtUnitPrice").text("12.000 VND/ 1 ngày");break;case"5":$("#vip-preview-title").attr("class","");$("#txtUnitPrice").text("Miễn phí")}GetAbsCost()}function GetTextCombo(n){var t="";switch(n){case"cbopTypeP":t="-- Chọn Loại tin rao --";break;case"cboCateP":t="-- Chọn Loại bất động sản --";break;case"cboCityP":t="-- Chọn Tỉnh/Thành Phố --";break;case"cboDistP":t="-- Chọn Quận/Huyện --";break;case"cboWardP":t="-- Chọn Phường/Xã --";break;case"cboStreetP":t="-- Chọn Đường/Phố --";break;case"cboProjectP":t="-- Chọn Dự án --";break;case"cboPriceP":t="-- Chọn Mức giá --";break;case"cboAreaP":t="-- Chọn Diện tích --";break;case"cboRoomP":t="-- Chọn Số phòng ngủ --";break;case"cboDirectionP":t="-- Chọn Hướng nhà --"}return t}function GetFistItemCombo(n){var t="";switch(n){case"cboCateP":t=' <li rel="-1">Chọn loại bất động sản<\/li>';break;case"cboCityP":t=' <li rel="-1">Chọn Tỉnh/Thành phố<\/li>';break;case"cboDistP":t=' <li rel="-1">Chọn Quận/Huyện<\/li>';break;case"cboWardP":t=' <li rel="-1">Chọn Phường/Xã<\/li>';break;case"cboStreetP":t=' <li rel="-1">Chọn Đường/Phố<\/li>';break;case"cboProjectP":t=' <li rel="-1">Chọn Dự án<\/li>';break;case"cboPriceP":t=' <li rel="-1">Chọn Mức giá<\/li>';break;case"cboAreaP":t=' <li rel="-1">Chọn Diện tích<\/li>';break;case"cboRoomP":t=' <li rel="-1">Chọn Số phòng ngủ<\/li>';break;case"cboDirectionP":t=' <li rel="-1">Chọn Hướng nhà<\/li>'}return t}function loadDate(n){var t=new Date;n==38?$("#txtDenngay").datepicker("setDate",$("#hdDenNgayBan").val()):$("#txtDenngay").datepicker("setDate",$("#hdDenNgayThue").val())}function GetLoainhadat(n,t){var i="",r;i+="[";n==38&&(i+='{"Id":324,"Text":"- Bán căn hộ chung cư"},',i+='{"Id":41,"Text":"- Bán nhà riêng"},',i+='{"Id":325,"Text":"- Bán nhà biệt thự, liền kề"},',i+='{"Id":163,"Text":"- Bán nhà mặt phố"},',i+='{"Id":40,"Text":"- Bán đất nền dự án"},',i+='{"Id":283,"Text":"- Bán đất"},',i+='{"Id":44,"Text":"- Bán trang trại, khu nghỉ dưỡng"},',i+='{"Id":45,"Text":"- Bán kho, nhà xưởng"},',i+='{"Id":48,"Text":"- Bán loại bất động sản khác"}');n==49&&(i+='{"Id":326,"Text":"Cho thuê căn hộ chung cư"},',i+='{"Id":52,"Text":"Cho thuê nhà riêng"},',i+='{"Id":51,"Text":"Cho thuê nhà mặt phố"},',i+='{"Id":57,"Text":"Cho thuê nhà trọ, phòng trọ"},',i+='{"Id":50,"Text":"Cho thuê văn phòng"},',i+='{"Id":55,"Text":"Cho thuê cửa hàng, ki ốt"},',i+='{"Id":53,"Text":"Cho thuê kho, nhà xưởng, đất"},',i+='{"Id":59,"Text":"Cho thuê bất động sản khác"}');i+="]";r=$.parseJSON(i);$("#cboCateP").selectoption(r,t,"229px")}function GetCity(n){var t;$("body").data("BindCity")!=null?(t=$("body").data("BindCity"),$("#ddlCity").html('<option value="-1">-- Chọn Tỉnh/Thành phố --<\/option>'),$.each(t,function(n,t){$("#ddlCity").append($("<option>").text(t.Text).attr("value",t.Id))}),$("#ddlCity").val(n),$("#ddlCity").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()).Trim().toLowerCase(),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}),GetDistrict(n)):$.ajax({type:"POST",cache:!1,url:"/Handler/SearchHandler.ashx?module=GetCity",success:function(n){n.length>0&&(t=$.parseJSON(n),$("body").data("BindCity",t))},timeout:5e3,complete:function(){t!=null&&($("#ddlCity").html('<option value="-1">-- Chọn Tỉnh/Thành phố --<\/option>'),$.each(t,function(n,t){$("#ddlCity").append($("<option>").text(t.Text).attr("value",t.Id))}),$("#ddlCity").val(n),$("#ddlCity").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}),GetDistrict(n))}})}function GetDistrict(n){var i=$("#hddcboDistP").val(),r,t;n!="-1"?$("body").data("GetDistrict_"+n)!=null?(t=$("body").data("GetDistrict_"+n),$("#ddlDistrict").html('<option value="-1">-- Chọn Quận/Huyện --<\/option>'),$.each(t,function(n,t){$("#ddlDistrict").append($("<option>").text(t.Text).attr("value",t.Id))}),$("#ddlDistrict").val(i),$("#ddlDistrict").select2({matcher:function(n,t){if($.trim(n.term)==="")return t;if(t.text.toLowerCase().indexOf(n.term.toLowerCase())==0){var i=$.extend({},t,!0);return i.text,i}return null}}),ChangeDistrict(i)):$.ajax({type:"POST",url:"/Handler/SearchHandler.ashx?module=GetDistrict",data:{cityCode:n},success:function(i){t=$.parseJSON(i);$("body").data("GetDistrict_"+n,t)},timeout:5e3,complete:function(){$("#ddlDistrict").html('<option value="-1">-- Chọn Quận/Huyện --<\/option>');$.each(t,function(n,t){$("#ddlDistrict").append($("<option>").text(t.Text).attr("value",t.Id))});$("#ddlDistrict").val(i);$("#ddlDistrict").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}});ChangeDistrict(i)}}):(r="[]",t=$.parseJSON(r),$("#ddlDistrict").html('<option value="-1">-- Chọn Quận/Huyện --<\/option>'),$.each(t,function(n,t){$("#ddlDistrict").append($("<option>").text(t.Text).attr("value",t.Id))}),$("#hddcboDistP").val(-1),$("#ddlDistrict").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}),ChangeDistrict(-1))}function ChangeDistrict(n){$("#hddcboDistP").val(n);var t=$("#hddcboWardP").val(),i=$("#hddcboStreetP").val(),r=$("#hddcboProjectP").val();GetWard(n,t);GetStreets(n,i);GetProject(n,r);n>0?(GetDiadiem(),$("#hddcboCityP").val()!=-1&&$("#hddcboDistP").val()!=-1&&$("#hddcboCateP").val()!=-1?$("#boxSuggest").fadeIn():$("#boxSuggest").fadeOut(),GetGoiy()):($("#txtDiadiem").val(""),$("#spanGoiytieude").text(""),$("#boxSuggest").fadeOut())}function GetWard(n,t){var r,i;n>=0?$("body").data("GetWard_"+n)!=null?(i=$("body").data("GetWard_"+n),$("#ddlWard").html('<option value="-1">-- Chọn Phường/Xã --<\/option>'),$.each(i,function(n,t){$("#ddlWard").append($("<option>").text(t.Text).attr("value",t.Id).attr("wardprefix",t.WardPrefix))}),$("#ddlWard").val(t),$("#hddWardPrefix").val($("#ddlWard").find("option:selected").attr("wardprefix")),$("#ddlWard").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}})):$.ajax({type:"POST",cache:!1,url:"/Handler/SearchHandler.ashx?module=GetWard",data:{distId:n},success:function(t){t.length>0&&(i=$.parseJSON(t),$("body").data("GetWard_"+n,i))},timeout:5e3,complete:function(){i!=null&&($("#ddlWard").html('<option value="-1">-- Chọn Phường/Xã --<\/option>'),$.each(i,function(n,t){$("#ddlWard").append($("<option>").text(t.Text).attr("value",t.Id).attr("wardprefix",t.WardPrefix))}),$("#ddlWard").val(t),$("#hddWardPrefix").val($("#ddlWard").find("option:selected").attr("wardprefix")),$("#ddlWard").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}))}}):(r="[]",i=$.parseJSON(r),$("#ddlWard").html('<option value="-1">-- Chọn Phường/Xã --<\/option>'),$.each(i,function(n,t){$("#ddlWard").append($("<option>").text(t.Text).attr("value",t.Id).attr("wardprefix",t.WardPrefix))}),$("#hddcboWardP").val(-1),$("#ddlWard").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}))}function GetStreets(n,t){var r,i;n>=0?$("body").data("GetStreets_"+n)!=null?(i=$("body").data("GetStreets_"+n),$("#ddlStreets").html('<option value="-1">-- Chọn Đường/Phố --<\/option>'),$.each(i,function(n,t){$("#ddlStreets").append($("<option>").text(t.Text).attr("value",t.Id).attr("streetprefix",t.StreetPrefix))}),$("#ddlStreets").val(t),$("#hddStreetPrefix").val($("#ddlStreets").find("option:selected").attr("streetprefix")),$("#ddlStreets").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}})):$.ajax({type:"POST",cache:!1,url:"/Handler/SearchHandler.ashx?module=GetStreet",data:{distId:n},success:function(t){t.length>0&&(i=$.parseJSON(t),$("body").data("GetStreets_"+n,i))},timeout:5e3,complete:function(){i!=null&&($("#ddlStreets").html('<option value="0">-- Chọn Đường/Phố --<\/option>'),$.each(i,function(n,t){$("#ddlStreets").append($("<option>").text(t.Text).attr("value",t.Id).attr("streetprefix",t.StreetPrefix))}),$("#ddlStreets").val(t),$("#hddStreetPrefix").val($("#ddlStreets").find("option:selected").attr("streetprefix")),$("#ddlStreets").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}))}}):(r="[]",i=$.parseJSON(r),$("#ddlStreets").html('<option value="0">-- Chọn Đường/Phố --<\/option>'),$.each(i,function(n,t){$("#ddlStreets").append($("<option>").text(t.Text).attr("value",t.Id).attr("streetprefix",t.StreetPrefix))}),$("#hddcboStreetP").val(-1),$("#ddlStreets").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}))}function GetProject(n,t){var r,i;n>=0?$("body").data("GetProject_"+n)!=null?(i=$("body").data("GetProject_"+n),$("#ddlProjects").html('<option value="-1">-- Chọn Dự án --<\/option>'),$.each(i,function(n,t){$("#ddlProjects").append($("<option>").text(t.Text).attr("value",t.Id))}),$("#ddlProjects").val(t),$("#ddlProjects").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}),GetDiadiem(),GetGoiy()):$.ajax({type:"POST",cache:!1,url:"/Handler/SearchHandler.ashx?module=GetProject",data:{distId:n},success:function(t){t.length>0&&(i=$.parseJSON(t),$("body").data("GetProject_"+n,i))},timeout:5e3,complete:function(){i!=null&&($("#ddlProjects").html('<option value="-1">-- Chọn Dự án --<\/option>'),$.each(i,function(n,t){$("#ddlProjects").append($("<option>").text(t.Text).attr("value",t.Id))}),$("#ddlProjects").val(t),$("#ddlProjects").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}),GetDiadiem(),GetGoiy())}}):(r="[]",i=$.parseJSON(r),$("#ddlProjects").html('<option value="-1">-- Chọn Dự án --<\/option>'),$.each(i,function(n,t){$("#ddlProjects").append($("<option>").text(t.Text).attr("value",t.Id))}),$("#ddlProjects").select2({matcher:function(n,t){var r,u,i;return $.trim(n.term)===""?t:(r=UnicodeToKoDau(t.text.toLowerCase()),u=UnicodeToKoDau(n.term.toLowerCase()),r.indexOf(u)==0)?(i=$.extend({},t,!0),i.text,i):null}}),$("#hddcboProjectP").val(0),GetDiadiem(),GetGoiy())}function GetDirection(n){var t;$("body").data("GetDirection")!=null?t=$("body").data("GetDirection"):(htm="[",htm+='{"Id":0,"Text":"Không xác định"},',htm+='{"Id":1,"Text":"Đông"},',htm+='{"Id":2,"Text":"Tây"},',htm+='{"Id":3,"Text":"Nam"},',htm+='{"Id":4,"Text":"Bắc"},',htm+='{"Id":5,"Text":"Đông-Bắc"},',htm+='{"Id":6,"Text":"Tây-Bắc"},',htm+='{"Id":7,"Text":"Tây-Nam"},',htm+='{"Id":8,"Text":"Đông-Nam"}',htm+="]",t=$.parseJSON(htm));$("#cboDirectionP").selectoption(t,n,"229px")}function GetPrice(n,t){if(n>0){var i;n=n-1;n>1&&(n=1);$("body").data("GetPrice_"+n)!=null?i=$("body").data("GetPrice_"+n):(htm="[",n==1?(htm+='{"Id":0,"Text":"Thỏa thuận"},',htm+='{"Id":1,"Text":"Trăm nghìn/tháng"},',htm+='{"Id":2,"Text":"Triệu/tháng"},',htm+='{"Id":3,"Text":"USD/tháng"},',htm+='{"Id":4,"Text":"USD/m²/tháng"},',htm+='{"Id":5,"Text":"Trăm nghìn/m²/tháng"},',htm+='{"Id":6,"Text":"Triệu/m²/tháng"},',htm+='{"Id":7,"Text":"Nghìn/m²/tháng"}'):n==0&&(htm+='{"Id":0,"Text":"Thỏa thuận"},',htm+='{"Id":1,"Text":"Triệu"},',htm+='{"Id":2,"Text":"Tỷ"},',htm+='{"Id":3,"Text":"Cây vàng"},',htm+='{"Id":4,"Text":"USD"},',htm+='{"Id":5,"Text":"USD/m²"},',htm+='{"Id":6,"Text":"Trăm nghìn/m²"},',htm+='{"Id":7,"Text":"Triệu/m²"},',htm+='{"Id":8,"Text":"Chỉ vàng/m2"},',htm+='{"Id":9,"Text":"Cây vàng/m²"}'),htm+="]",i=$.parseJSON(htm),$("body").data("GetPrice_"+n,i));$("#cboPriceP").selectoption(i,t,"158px")}}function loadDate(n){var t=new Date;n==38?$("#txtDenngay").datepicker("setDate",$("#hdDenNgayBan").val()):$("#txtDenngay").datepicker("setDate",$("#hdDenNgayThue").val())}function ChangeLoainhadat(n){$("#hddchoCityP").val()!=-1&&$("#hddcboDistP").val()!=-1&&n!=-1?$("#boxSuggest").fadeIn():$("#boxSuggest").fadeOut();GetGoiy()}function GetDiadiem(){var n="",t,r,i,e,u,f,o;$("#hddcboStreetP").val()!=-1&&$("#hddcboProjectP").val()<=0&&$("#hddcboWardP").val()==-1&&(t=$("#ddlStreets option:selected").text(),t.toLowerCase().indexOf("đường")<0&&t.toLowerCase().indexOf("phố")<0?(r=$("#hddStreetPrefix").val(),n=r.toLowerCase()=="đường"?"Đường "+t+",":"Phố "+t+","):n=t+",");$("#ddlWard").val()!=-1&&$("#hddcboProjectP").val()<=0&&$("#hddcboStreetP").val()==-1&&(i=$("#ddlWard option:selected").text(),i!=null&&i.toLowerCase().indexOf("phường")<0&&i.toLowerCase().indexOf("xã")<0?(e=$("#hddWardPrefix").val(),n=e.toLowerCase()=="phường"?"Phường "+i+",":"Xã "+i+","):n=i!=null?i+",":"");$("#hddcboProjectP").val()>0&&(u=$("#ddlProjects option:selected").text(),n=u!=null?"Dự án "+u+",":"");$("#ddlWard").val()!=-1&&$("#hddcboProjectP").val()<=0&&$("#hddcboStreetP").val()>0&&(t=$("#ddlStreets option:selected").text(),t.toLowerCase().indexOf("đường")<0&&t.toLowerCase().indexOf("phố")<0?(r=$("#hddStreetPrefix").val(),n=r.toLowerCase()=="đường"?"Đường "+t+",":"Phố "+t+","):n=t+",");f="";$("#hddcboDistP").val()!=-1&&(f=$("#ddlDistrict option:selected").text(),n=n+" "+f);o=$("#ddlCity option:selected").text();n+=", "+o+" ";$("#txtDiadiem").val(n);$("#hddDiadiem").val(n);GetAbsCost()}function GetGoiy(){var n="",t=$('#cboCateP .pncontainer li[rel="'+$("#hddcboCateP").val()+'"]').html(),r,u,i,f,e,o,s,h,c,l;t=t!=null?t:"";t=t.split("+").join("");t=t.split("-").join("");t=t.split("&nbsp;").join("");n=t+" tại";$("#hddcboStreetP").val()!=-1&&$("#hddcboProjectP").val()<=0&&(r=$("#ddlStreets option:selected").text(),r.toLowerCase().indexOf("đường")<0&&r.toLowerCase().indexOf("phố")<0?(u=$("#hddStreetPrefix").val(),n=u.toLowerCase()=="đường"?n+" Đường "+r+",":n+" Phố "+r+","):n=n+r+",");$("#ddlWard").val()!=-1&&$("#hddcboProjectP").val()<=0&&(i=$("#ddlWard option:selected").text(),i!=null&&i.toLowerCase().indexOf("phường")<0&&i.toLowerCase().indexOf("xã")<0?(f=$("#hddWardPrefix").val(),n=f.toLowerCase()=="phường"?n+" Phường "+i+",":n+" Xã "+i+","):n=n+" "+i+",");$("#hddcboProjectP").val()>0&&(e=$("#ddlProjects option:selected").text(),n=n+" Dự án "+e+",");$("#hddcboDistP").val!=-1&&(o=$("#ddlDistrict option:selected").text(),n=n+" "+o+",");s=$("#ddlCity option:selected").text();n=n+" "+s+" ";$("#txtDientich").val()!=""&&(h=$("#txtDientich").val(),n=n+"diện tích "+h+"m2 ");$("#txtGia").val()!=""&&$("#hddcboPriceP").val()>0&&(c=$("#txtGia").val(),l=$('#cboPriceP .pncontainer li[rel="'+$("#hddcboPriceP").val()+'"]').html(),n=n+"giá "+c+" "+l);n=$.trim(n);$("#spanGoiytieude").text(n);$("#hddSuggestion").val(n)}function ChangeDientich(n){n!=-1&&GetGoiy()}function ChangeMucgia(n){n!=-1&&GetGoiy()}function SetTitle(){var n=$("#spanGoiytieude").text(),t=$.trim($("#txtTieude").val());$("#txtTieude").replaceAll(t,"");$("#txtTieude").val(n);$("#vip-preview-title").text(n)}function ValidateData(){var n=!0,h,i,s,t,a,v,y,u,r,f,p,w,b,k;if($("#hddcboCateP").val()==-1?($("#spancboCateP").css("display",""),n=!1):$("#spancboCateP").css("display","none"),$("#hddcboCityP").val()==-1?($("#spancboCityP").css("display",""),n=!1):$("#spancboCityP").css("display","none"),$("#hddcboDistP").val()==-1?($("#spancboDistP").css("display",""),n=!1):$("#spancboDistP").css("display","none"),$("#txtDidong").val()==""?($("#spanDidong").css("display",""),n=!1):($("#spanDidong").css("display","none"),h=/^[(]{0,1}[0-9]{3,5}[)]{0,1}[-\s.]{0,1}[0-9]{3}[-\s.]{0,1}[0-9]{3}$/,h.test($("#txtDidong").val().replace(/ /g,""))?$("#spanDidongCheck").css("display","none"):($("#spanDidongCheck").css("display",""),n=!1)),$("#txtHovaten").val()==""?($("#spanHovaten").css("display",""),n=!1):$("#spanHovaten").css("display","none"),$("#hddVipType").val()=="-1"?($("#spanViptype").show(),n=!1):$("#spanViptype").hide(),$("#txtTungay").val()==""||$("#txtDenngay").val()=="")$("#spanThoigian").css("display",""),$("#txtTungay").val()==""&&$("#tarNoidung").val()!=""?n=!1:$("#txtDenngay").val()==""&&$("#tarNoidung").val()!=""&&(n=!1),n=!1;else if($("#txtTungay").val()!=""&&$("#txtDenngay").val()!=""){$("#spanThoigian").css("display","none");var d=$("#txtTungay").val(),g=$("#txtDenngay").val(),e=d.split("/"),o=g.split("/"),c=new Date(e[2],e[1],e[0]).getTime(),u=new Date(o[2],o[1],o[0]).getTime(),l=(u-c)/864e5;c>=u||l<6||l>183?($("#spanThoigianCheck").css("display","block"),n=!1):$("#spanThoigianCheck").css("display","none")}return $("#tarNoidung").val()==""?($("#spanNoidungmota").css("display",""),n=!1):($("#spanNoidungmota").css("display","none"),i=$("#tarNoidung").val(),i=i.replace(/(^\s*)|(\s*$)/gi,""),i=i.replace(/[ ]{2,}/gi," "),i=i.replace(/\n /,"\n"),s=i.length,s<100||s>3e3?($("#spanLimited").css("display",""),n=!1):$("#spanLimited").css("display","none")),$("#txtTieude").val()==""?($("#spanTieude").css("display",""),n=!1):($("#spanTieude").css("display","none"),t=document.getElementById("txtTieude").value,t=t.replace(/(^\s*)|(\s*$)/gi,""),t=t.replace(/[ ]{2,}/gi," "),t=t.replace(/\n /,"\n"),a=t.length,v=t.split(" ").length,v<5?($("#spanLimit").css("display",""),n=!1):$("#spanLimit").css("display","none"),a>99?($("#spanMaxCharacter").css("display",""),n=!1):$("#spanMaxCharacter").css("display","none")),$("#txtDiadiem").val()==""?($("#spanDiadiem").css("display",""),n=!1):$("#spanDiadiem").css("display","none"),$("#txtDienthoai").val()!=""&&(y=/^[(]{0,1}[0-9]{2,3}[)]{0,1}[-\s.]{0,1}[0-9]{3}[-\s.]{0,1}[0-9]{3,5}$/,y.test($("#txtDienthoai").val().replace(/ /g,""))?$("#spanDienthoaiCheck").css("display","none"):($("#spanDienthoaiCheck").css("display",""),n=!1)),$("#txtEmail").val()!=""&&(u=$("#txtEmail").val(),/.+@.+\.[a-zA-Z]{2,4}$/.test(u)?$("#spanEmail").css("display","none"):($("#spanEmail").css("display",""),n=!1)),r=/^[0-9]+((,|.){0,1}[0-9])*$/,$("#txtGia").val()!=""?(f=$("#txtGia").val(),r.test(f)?$("#hddDonVi").val()<1&&f>0?($("#spanGia").css("display","none"),$("#spanDonVi").css("display",""),n=!1):$("#hddDonVi").val()>0&&f==0?($("#spanGia").css("display",""),n=!1):($("#spanGia").css("display","none"),$("#spanDonVi").css("display","none")):(n=!1,$("#spanGia").css("display",""))):$("#hddDonVi").val()>0?($("#spanGia").css("display",""),n=!1):($("#spanGia").css("display","none"),$("#spanDonVi").css("display","none")),$("#txtDientich").val()!=""&&(p=$("#txtDientich").val(),r.test(p)?$("#spanDientich").css("display","none"):(n=!1,$("#spanDientich").css("display",""))),$("#txtMattien").val()!=""&&(w=$("#txtMattien").val(),r.test(w)?$("#spanMattien").css("display","none"):(n=!1,$("#spanMattien").css("display",""))),$("#txtDuongtruocnha").val()!=""&&(b=$("#txtDuongtruocnha").val(),r.test(b)?$("#spanDuongtruocnha").css("display","none"):(n=!1,$("#spanDuongtruocnha").css("display",""),$("#txtDuongtruocnha").focus())),$("#txtSotang").val()!=""&&(k=$("#txtSotang").val(),r.test(k)?$("#spanSotang").css("display","none"):(n=!1,$("#spanSotang").css("display",""))),n?$("#rowError").hide():($("#rowError").show(),$("html, body").animate({scrollTop:$("#rowError").offset().top},1e3)),n}function UnicodeToKoDau(n){var r="",u,i,t;if(n==null)return r;for(i="a",t=0;t<n.length;t++)(i!=" "||n[t]!=" ")&&(i=n[t],u=uniChars.indexOf(i),u>=0&&(r+=KoDauChars[u]));return r}function UnicodeToKoDauUrl(n){var t="",u,f,i,r,e;if(n!=null&&n!=""){for(u=new RegExp("( )+","g"),n=n.replace(u,"-"),n.length>100&&(n=n.substring(0,100)),n=UnicodeToKoDau(n),f=new RegExp("<[^>]*>"),n=n.replace(f,""),i="",r=0;r<n.length;r++)i+=Alphabe.indexOf(n[r])>=0?n[r]:"-";return i=i.replace(u,"-"),t=i,e=new RegExp("-+"),t=t.replace(e,"-"),t.length>100?t.substring(0,100):t}return t}function VNDateTimeToUTCDateTime(n,t){try{var r=n.toString(),i=r.split(t);return new Date(i[2]+"/"+i[1]+"/"+i[0]).toDateString()}catch(f){return new Date}}function UTCDateTimeToVNDateTime(n,t){var i="";try{i=new Date(n)}catch(f){i=new Date}var r=i.getDate()<9?"0"+i.getDate():i.getDate(),u=i.getMonth()<9?"0"+(i.getMonth()+1):i.getMonth()+1;return r+t+u+t+i.getFullYear()}function GetTotalDay(n,t){var i=t-n;return i=i/24,i=i/60,i=i/60,i/1e3}function GetMoneyText(n){return n<=0?"0 VND":(n=Math.round(n*10)/10,n=n.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1."),n==null||n=="NaN")?"0 VND":n+" VND"}function GetAbsCost(){var u,f,r;$("#vip-preview-title").text($("#txtTieude").val());$("#vip-preview-price").text($("#txtGia").val()!=""?$("#txtGia").val():"N/A");$("#vip-preview-area").text($("#txtDientich").val()!=""?$("#txtDientich").val():"N/A ");$("#vip-preview-location").text($("#txtDiadiem").val()!=null&&$("#txtDiadiem").val()!=""?$("#txtDiadiem").val():"N/A ");$("#vip-preview-date").text($("#txtTungay").val());var i=new Date,n=new Date(VNDateTimeToUTCDateTime($("#txtTungay").val(),"/")),t=new Date(VNDateTimeToUTCDateTime($("#txtDenngay").val(),"/"));n.setHours(i.getHours());n.setMinutes(i.getMinutes());n.setSeconds(i.getSeconds());t.setHours(i.getHours());t.setMinutes(i.getMinutes());t.setSeconds(i.getSeconds());n>t&&(u=t,t=n,n=u,$("#txtTungay").val(UTCDateTimeToVNDateTime(t,"/")),$("#txtDenngay").val(UTCDateTimeToVNDateTime(n,"/")));f=parseInt($("#hddVipType").val());r=GetTotalDay(n,t);$("#spTotalDay").html("<b>"+r+" ngày<\/b>");var o=unitPriceList[f],e=0;e=r*o*1e3;$("#txtCost").html(GetMoneyText(e));$("#txtPromoCost").html(GetMoneyText(0))}var unitPriceList,discount;jQuery(document).ready(function(){var t=$("#hddVipType").val(),n;LoadVipType(t);$(".hplVipType").on("click",function(){$("#spanViptype").hide();var n=$(this).attr("viptype");if($(".vip-type").attr("disabled")!=null){alert("Tin rao của bạn đang hiển thị trên Dothi.net. Nếu Quý khách muốn sửa Thời gian và Loại tin, vui lòng liên hệ với chúng tôi để được trợ giúp.");return}$(".hplVipType").removeClass("hplVipType-active");$(this).addClass("hplVipType-active");$("#hddVipType").val(n);$("#viptype-title").html("<b>"+$(this).text()+" :<\/b>");$(".preview").find(".row-right").hide();$("#vip-desc"+n).show();switch(n){case"0":$("#vip-preview-title").attr("class","vipdb");$("#txtUnitPrice").text("50.000 VND/ 1 ngày");break;case"1":$("#vip-preview-title").attr("class","vip1");$("#txtUnitPrice").text("25.000 VND/ 1 ngày");break;case"2":$("#vip-preview-title").attr("class","vip2");$("#txtUnitPrice").text("12.000 VND/ 1 ngày");break;case"5":$("#vip-preview-title").attr("class","");$("#txtUnitPrice").text("Miễn phí")}GetAbsCost()});$("#hplSell").click(function(){$("#hplSell").addClass("hplcate-active");$("#hplRent").removeClass("hplcate-active");GetLoainhadat(38,-1);GetPrice(1,$("#hddcboPriceP").val());$("#hddCanBan").val(38)});$("#hplRent").click(function(){$("#hplRent").addClass("hplcate-active");$("#hplSell").removeClass("hplcate-active");GetLoainhadat(49,-1);GetPrice(2,$("#hddcboPriceP").val());$("#hddCanBan").val(49)});$("#boxSuggest").fadeOut();n=$("#hddCanBan").val();n!=""&&(n==38?($("#hplSell").addClass("hplcate-active"),$("#hplRent").removeClass("hplcate-active"),GetPrice(1,$("#hddcboPriceP").val())):($("#hplRent").addClass("hplcate-active"),$("#hplSell").removeClass("hplcate-active"),GetPrice(2,$("#hddcboPriceP").val())),GetLoainhadat(n,$("#hddcboCateP").val()));$("#txtSophong").keydown(function(n){n.keyCode==46||n.keyCode==8||n.keyCode==9||n.keyCode==27||n.keyCode==13||n.keyCode==65&&n.ctrlKey===!0||n.keyCode>=35&&n.keyCode<=39||(n.shiftKey||(n.keyCode<48||n.keyCode>57)&&(n.keyCode<96||n.keyCode>105))&&n.preventDefault()});$("#txtSotoilet").keydown(function(n){n.keyCode==46||n.keyCode==8||n.keyCode==9||n.keyCode==27||n.keyCode==13||n.keyCode==65&&n.ctrlKey===!0||n.keyCode>=35&&n.keyCode<=39||(n.shiftKey||(n.keyCode<48||n.keyCode>57)&&(n.keyCode<96||n.keyCode>105))&&n.preventDefault()});$("#txtTungay").on("change",function(){GetAbsCost()});$("#txtDenngay").on("change",function(){GetAbsCost()});$("#txtTieude").on("change",function(){GetAbsCost()});$("#txtGia").on("change",function(){GetAbsCost()});$("#txtDientich").on("change",function(){GetAbsCost()});$("#txtDiadiem").on("change",function(){GetAbsCost()});$(".btnPreview").on("click",function(){var n,t;ValidateData()&&(n={},n.Title=$("#txtTieude").val(),n.CateId=$("#hddcboCateP").val(),n.CateName=$("#txtTieude").val(),n.Description=$("#tarNoidung").val(),n.VipType=$("#hddVipType").val(),n.VipOrder=$("#hddVipType").val(),n.StartDate=$("#txtTungay").val(),n.EndDate=$("#txtDenngay").val(),n.Images=$("#BDSGuestUploadNonFlash").val(),n.Price=$("#txtGia").val(),n.UnitPrice=$("#hddcboPriceP").val(),n.Address=$("#hddDiadiem").val(),n.CityCode=$("#hddcboCityP").val(),n.DistrictId=$("#hddcboDistP").val(),n.WardID=$("#hddcboWardP").val(),n.Area=$("#txtDientich").val(),n.Width=$("#txtMattien").val(),n.RoadWidth=$("#txtDuongtruocnha").val(),n.Rooms=$("#txtSophong").val(),n.CatParentID=$("#hddCanBan").val(),n.ContactName=$("#txtHovaten").val(),n.ContactAddress=$("#txtDiachi").val(),n.Phone=$("#txtDienthoai").val(),n.Mobile=$("#txtDidong").val(),n.Email=$("#txtEmail").val(),n.Floors=$("#txtSotang").val(),n.Toilets=$("#txtSotoilet").val(),n.Latitude=$("#txtPositionX").val(),n.Longitude=$("#txtPositionY").val(),t=JSON.stringify(n),$("body").css({overflow:"hidden"}),$.ajax({dataType:"text",url:"/Handler/ProductHandler.ashx?module=getProductPreview",data:{ProductPreview:t},type:"POST",success:function(){$.fancybox({type:"iframe",href:"/xem-truoc.htm",maxWidth:800,maxHeight:800,fitToView:!1,width:"100%",height:"100%",autoSize:!1,closeClick:!1,openEffect:"none",closeEffect:"none",padding:0,helpers:{overlay:{closeClick:!1}},afterClose:function(){$("body").css({overflow:"auto"})},afterLoad:function(){}})}}))});GetCity($("#hddcboCityP").val());GetDirection($("#hddcboDirectionP").val());GetAbsCost()});$.fn.selectData=function(){};$.fn.selectoption=function(n,t,i){function s(n,t){if(n!=null&&n!=""&&$("#"+r+" .v-drop").html(n),t!=null&&t!=""){$("#"+r).change();$("#hdd"+r).val(t);switch(r){case"cboCateP":ChangeLoainhadat();break;case"cboCityP":$("#hddcboDistP").val(-1);GetDistrict(t);$("#hddcboCityP").val()!=-1?($("#hddcboCityP").val()!=-1&&$("#hddcboDistP").val()!=-1&&$("#hddcboCateP").val()!=-1?$("#boxSuggest").fadeIn():$("#boxSuggest").fadeOut(),GetGoiy()):($("#spanGoiytieude").text(""),$("#boxSuggest").fadeOut());ShowLocation();break;case"cboDistP":$("#hddcboStreetP").val(-1);$("#hddcboWardP").val(-1);$("#hddcboProjectP").val(0);ChangeDistrict(t);ShowLocation();break;case"cboWardP":GetGoiy();GetDiadiem();ShowLocation();break;case"cboStreetP":GetGoiy();GetDiadiem();ShowLocation();break;case"cboProjectP":GetGoiy();GetDiadiem();loadProjectMap(t);break;case"cboPriceP":t!=-1&&GetGoiy()}}$("#"+r+" .pncontainer").hide();$("#"+r+" .section").removeClass("sectionactive")}var o="",u="",r=$(this).attr("id"),f=-1,e="";u=GetFistItemCombo(r,t);r=="cboProjectP"?$.each(n,function(n,i){i.Id==t?(u+=' <li class="selected" rel="'+i.Id+'" lat="'+i.Lat+'" lng="'+i.Lng+'">'+i.Text+"<\/li>",f=i.Id,e=i.Text):u+=' <li rel="'+i.Id+'" lat="'+i.Lat+'" lng="'+i.Lng+'">'+i.Text+"<\/li>"}):r=="cboStreetP"?$.each(n,function(n,i){i.Id==t?(u+=' <li class="selected" rel="'+i.Id+'">'+i.Text+"<\/li>",f=i.Id,e=i.Text):u+=' <li rel="'+i.Id+'">'+i.Text+"<\/li>";$("#hddStreetPrefix").val(i.StreetPrefix)}):r=="cboWardP"?$.each(n,function(n,i){i.Id==t?(u+=' <li class="selected" rel="'+i.Id+'">'+i.Text+"<\/li>",f=i.Id,e=i.Text):u+=' <li rel="'+i.Id+'">'+i.Text+"<\/li>";$("#hddWardPrefix").val(i.WardPrefix)}):r=="cboCateP"?$.each(n,function(n,i){i.Id==361||i.Id==362?u+=' <li class="sbDisabled">'+i.Text+"<\/li>":i.Id==t?(u+=' <li class="selected" rel="'+i.Id+'">'+i.Text+"<\/li>",f=i.Id,e=i.Text):u+=' <li rel="'+i.Id+'">'+i.Text+"<\/li>";$("#hddcboCateP").val(i.WardPrefix)}):$.each(n,function(n,i){i.Id==t?(u+=' <li class="selected" rel="'+i.Id+'">'+i.Text+"<\/li>",f=i.Id,e=i.Text):u+=' <li rel="'+i.Id+'">'+i.Text+"<\/li>"});f==-1&&(e=GetTextCombo(r));o+=' <div class="section" style="width:'+i+';" ><span class="v-drop">'+e+'<\/span><span class="segdart"><\/span><\/div>';o+=' <div class="pncontainer" style="min-width:'+i+'; display:none;" > ';o+=' <ul style="min-width:'+i+'"> ';o+=u;o+=" <\/ul> ";$("#"+r).html(o);$("#hdd"+r).val(f);$("#"+r+" .pncontainer li").removeClass("selected");$("#"+r+' .pncontainer li[rel="'+f+'"]').addClass("selected");$("#"+r+" .section").click(function(){$(this).hasClass("sectionactive")?s():($(this).addClass("sectionactive"),$("#"+r+" .pncontainer").show())});$("#"+r+" .pncontainer li:not(.sbDisabled)").click(function(){var n=$(this).html(),t=$(this).attr("rel");$("#"+r+" .pncontainer li").removeClass("selected");$(this).addClass("selected");s(n,t)});$(document).mouseup(function(n){var t=$("#"+r+" .pncontainer"),i=$("#"+r+" .section");t.is(n.target)||t.has(n.target).length!==0||i.is(n.target)||i.has(n.target).length!==0||s()})};$("#cboCityP li").on("click",function(){var n=$(this).text()[0];alert(n);$("#cboCityP li").hide().filter(function(){return $(this).text().toUpperCase()[0]==n}).show()});$(function(){$("#txtTungay").datepicker({dateFormat:"dd/mm/yy",changeMonth:!0,changeYear:!0,yearRange:"c-40:c+30",minDate:new Date})});$(function(){$("#txtDenngay").datepicker({dateFormat:"dd/mm/yy",changeMonth:!0,changeYear:!0,yearRange:"c-40:c+30",minDate:new Date})});var uniChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàáảãạâầấẩẫậăằắẳẵặèéẻẽẹêềếểễệđìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵÀÁẢÃẠÂẦẤẨẪẬĂẰẮẲẴẶÈÉẺẼẸÊỀẾỂỄỆĐÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰỲÝỶỸỴÂĂĐÔƠƯ1234567890~!@#$%^&*()_+=-{}][|\":;'\\/.,<>? \n\r\t",KoDauChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZaaaaaaaaaaaaaaaaaeeeeeeeeeeediiiiiooooooooooooooooouuuuuuuuuuuyyyyyAAAAAAAAAAAAAAAAAEEEEEEEEEEEDIIIOOOOOOOOOOOOOOOOOOOUUUUUUUUUUUYYYYYAADOOU1234567890~!@#$%^&*()_+=-{}][|\":;'\\/.,<>? \n\r\t",Alphabe="qwertyuioplkjhgfdsazxcvbnm0123456789QWERTYUIOPASDFGHJKLZXCVBNM";unitPriceList=[50,25,12,0,0,0];discount=0;
  //# sourceMappingURL=PostNews.min.js.map
  