$(document).ready(function() {
jQuery('a[@rel*=lightbox]').lightBox();
// $(".check_field span").toggle(
// function () {
// $(this).css("background","url('images/chbox_on.png') no-repeat");
// $(this).addClass("selected");
// $(this).parent().children("input").attr('value', 1);
// },
// function () {
// $(this).css("background","url('images/chbox_off.png') no-repeat");
// $(this).removeClass("selected");
// $(this).parent().children("input").attr('checked', false);
// $(this).parent().children("input").attr('value', 0);
// }
// );
$(".check_field span").click(
function () {
if($(this).hasClass("selected")){
$(this).css("background","url('images/chbox_off.png') no-repeat");
$(this).removeClass("selected");
$(this).parent().children("input").attr('value', 0);
} else {
$(this).css("background","url('images/chbox_on.png') no-repeat");
$(this).addClass("selected");
$(this).parent().children("input").attr('value', 1);
}
}
);
// $(".check_field span#reserve").click(
// function(){
// if($("input#car_reserve").val() == 0){
// $("input#car_reserve").val(1);
// } else {
// $("input#car_reserve").val(0);
// }
// }
// );
$("#form_search select, #form_search div.bars, #form_search .check_field span").bind("click mousedown mouseup", function(e){
$("#live_choice_box").children().remove();
var str = "";
$("select option:selected").each(function () {
if($(this).attr("value") != 0) {
str = '';
str += $(this).text() + '
';
$('#live_choice_box').append(str);
$('span#' + $(this).parent().attr("id") + "_option img").bind("click",function(){
var id = ($(this).parent().attr("id")).replace(/_option/, "");
//alert(id);
$('#form_search #' +id).attr("value",0);
$(this).parent().remove();
if($(this).parent().siblings().html() == "")
$(this).parent().parent().addClass("hidden");
});
}
});
$(".ui-slider").each(function () {
var unit = $(this).find(".unit").attr("value");
if(! $(this).hasClass("no_change")){
str = "";
str += '';
if ($(this).attr("id") == 'reg')
str += unit + " ";
str += $(this).find(".handle_1 .slider-handle").text() + " - " + $(this).find(".handle_2 .slider-handle").text();
if ($(this).attr("id") == 'price' ||
$(this).attr("id") == 'driven' ||
$(this).attr("id") == 'output' )
str += unit;
str += '
';
$('#live_choice_box').append(str);
$('span#' + $(this).attr("id") + "_option img").bind("click",function(){
var id = ($(this).parent().attr("id")).replace(/_option/, "");
//alert(id);
$('#form_search #' +id).addClass("no_change");
$(this).parent().remove();
if($(this).parent().siblings().html() == "")
$(this).parent().parent().addClass("hidden");
});
str = "";
}
});
$(".check_field span").each(function () {
if($(this).hasClass("selected")) {
str = '' + $(this).text() + '
';
$('#live_choice_box').append(str);
$('span#' + $(this).attr("id") + "_option img").bind("click",function(){
var id = ($(this).parent().attr("id")).replace(/_option/, "");
//alert(id);
$('#form_search #' +id).trigger("click");
$(this).parent().remove();
if($(this).parent().siblings().html() == "")
$(this).parent().parent().addClass("hidden");
});
}
});
if($("#live_choice_box").html() == "")
$("#live_choice_box").addClass('hidden');
else
$("#live_choice_box").removeClass("hidden");
});
//.change();
/* OFFERS SHOW hovering */
$("#offers_show .detail_box").hover(
function () {
$(this).css("color","white");
$(this).css("background","url('images/bg_offer_big_hover.png') no-repeat");
$(this).children(".name").css("color","white");
$(this).find(".sk_type").css("color","white");
$(this).find("strong").css("color","white");
},
function () {
$(this).css("color","#333333");
$(this).css("background","url('images/bg_offer_big.png') no-repeat");
$(this).children(".name").css("color","#cc0000");
$(this).find(".sk_type").css("color","#7f7f7f");
$(this).find("strong").css("color","#cc0000");
}
);
/* NEW SEARCH -> search box toggle */
$(".new_search").toggle(
function () {
$("#search").slideDown("slow");
$("#search").removeClass("hidden");
$(this).text($(this).parent().find("input#t_collapse").attr('value'));
},
function () {
$("#search").slideUp("slow");
$("#search").addClass("hidden");
$(this).text($(this).parent().find("input#t_search").attr('value'));
}
);
//$("#search").hasClass("sb_hidden").fadeOut();
/* DETAILS -> GALLERY items onclick change */
$(".gal_item").click(function () {
$("#image_show").fadeOut("fast");
$("#image_show").attr("src", $(this).attr("alt"));
$("#image_show").fadeIn("fast");
});
$("input#search_button").click(function () {
$("form#form_search").submit();
});
$(".back").click(function() {
$("form#form_search").submit();
});
$("#form_search div.bars, #form_search select, #form_search .check_field span").trigger("mousedown");
});