');
$(".panel").hide();
$(".search_address").val('');
$(".search_station").val('');
if($('#class_panel').length){
var height = $("#class_panel").height();
$(".type_div").css("height", height)
}
$("#class_form").click(function()
{
var off = $('#class_form').offset();
$("#class_panel").css("top",off.top+24);
$("#class_panel").css("left",off.left);
$("#class_panel").show();
$("#underLayer").show();
});
$("#line_form").click(function()
{
var off = $('#line_form').offset();
$("#line_panel").css("top",off.top+24);
$("#line_panel").css("left",off.left);
$("#line_panel").show();
$("#underLayer").show();
});
$("#price_form").click(function()
{
var off = $('#price_form').offset();
$("#price_panel").css("top",off.top+24);
$("#price_panel").css("left",off.left);
$("#price_panel").show();
$("#underLayer").show();
});
$("#area_form").click(function()
{
var off = $('#area_form').offset();
$("#area_panel").css("top",off.top+24);
$("#area_panel").css("left",off.left);
$("#tsuboarea_panel").css("top",off.top+24);
$("#tsuboarea_panel").css("left",off.left + 90);
$("#area_panel").show();
$("#tsuboarea_panel").show();
$("#underLayer").show();
});
var priceTypeElem = $("#price_form");
$("#class_panel li").click(function()
{
var mainType = $(this).parent().prev().attr("id");
var detailType = $(this).attr("class");
var tnVal = $("#tN").val();
var adVal = $(".search_address").val();
var stnVal = $(".search_station").val();
var classDisplay = $(this).children("span.pretended").text();
var classValue = $(this).children("span.pretended").attr("id");
if (classValue === "c4" || classValue === "b3" || classValue === "t8") {
$(".search_m").attr("name", "tcF");
} else {
$(".search_m").attr("name", "aF");
}
if (mainType === "c") {
if (detailType === "2" || detailType === "3" || detailType === "5") {
$("#price_panel_b").hide();
$(".business").show();
$(".residential").hide();
priceTypeElem.text("賃料");
} else {
$("#price_panel_b").hide();
$(".business").hide();
$(".residential").show();
priceTypeElem.text("賃料");
}
} else {
$("#price_panel_b").show();
$(".business").hide();
$(".residential").hide();
priceTypeElem.text("価格");
}
if(classValue == "c5" || classValue == "b6"){
$("#class_form").find(".must_cover").css({
"font-size":"10px"
});
}else{
$("#class_form").find(".must_cover").css({
"font-size":"11px"
});
}
$("#class_form .must_cover").text(classDisplay);
$("#class_form .must_cover").css('background-color','transparent');
$("#class_panel").css('background-color','#FFF');
$(".search_class").val(classValue);
$("#underLayer").hide();
$(".panel").hide();
if ((empty(tnVal) == false) || (empty(adVal) == false || empty(stnVal) == false)) {
getBknCnt();
} else {
$(".free_search_cnt").text('-');
}
});
$(".line_val").click(function()
{
var lineDisplay = $(this).text();
var lineValue = $(this).attr("id").substring(1);
var areaValue = '';
$("#line_form .must_cover").text(lineDisplay);
$(".search_station").val(lineValue);
$(".search_address").val(areaValue);
if(empty($('#tN').val()) == false || lineDisplay != '指定なし'){
$("#line_form .must_cover").css('background-color','transparent ');
$("#tN").css('background-color','#FFF');
}else{
//$("#line_form .must_cover").css('background-color','rgba(255, 170, 160,0.5)');
//$("#tN").css('background-color','rgba(255, 170, 160,0.5)');
}
$("#underLayer").hide();
$(".panel").hide();
if (empty(lineValue) == false || empty($('#tN').val()) == false ) {
getBknCnt();
} else {
$(".free_search_cnt").text('-');
}
});
$(".area_val").click(function()
{
var areaDisplay = $(this).text();
var areaValue = $(this).attr("id").substring(1);
var lineValue = '';
$("#line_form .must_cover").text(areaDisplay);
$(".search_address").val(areaValue);
$(".search_station").val(lineValue);
if(empty($('#tN').val()) == false || areaDisplay != '指定なし'){
$("#line_form").find('.must_cover').css('background-color','transparent ');
$("#tN").css('background-color','#FFF');
}else{
//$("#line_form").find('.must_cover').css('background-color','rgba(255, 170, 160,0.5)');
//$("#tN").css('background-color','rgba(255, 170, 160,0.5)');
}
$("#underLayer").hide();
$(".panel").hide();
if (empty(areaValue) == false || empty($('#tN').val()) == false) {
getBknCnt();
} else {
$(".free_search_cnt").text('-');
}
});
$(".price_val").click(function()
{
var priceDisplay = $(this).text();
var priceValue = $(this).attr("id").substring(1);
$("#price_form").text(priceDisplay);
$(".search_price").val(priceValue);
$("#underLayer").hide();
$(".panel").hide();
getBknCnt();
});
$(".m_val").click(function()
{
var areaDisplay = $(this).text();
var areaValue = $(this).attr("id").substring(1);
$("#area_form").text(areaDisplay);
$(".search_m").val(areaValue);
$(".search_t").val('');
$("#underLayer").hide();
$(".panel").hide();
getBknCnt();
});
$("#underLayer").click(function()
{
$(this).hide();
$(".panel").hide();
});
$(".free_search_btn").click(function()
{
var tnVal = $("#tN").val();
var adVal = $(".search_address").val();
var stnVal = $(".search_station").val();
var classVal = $(".search_class").val();
// フリーワードが入っている場合
if (empty(tnVal) == false && empty(classVal) == false) {
$("form.free_search").submit();
} else if ((empty(tnVal) == false && empty(classVal) == false && empty(classVal) == false) || (empty(classVal) == false && (empty(adVal) == false || empty(stnVal) == false))) {
$("form.free_search").submit();
} else {
var validateStr = '';
if (empty(classVal)) {
validateStr = "種別を選択してください\n\n";
}
if (empty(adVal) && empty(stnVal)) {
validateStr += "沿線エリアを選択、もしくはフリーワードを入力してください";
}
alert(validateStr);
return false;
}
});
});