// JavaScript Document
$(document).ready(function(){
  $("#quickLinks li.more div.arrow").toggle(function(){
    $(this).parent("li.more").children("ul").show();
    $(this).removeClass("arrow").addClass("down");
  },function(){
    $(this).parent("li.more").children("ul").hide();
    $(this).removeClass("down").addClass("arrow");
  });
  $("#menu li.current div.arrow").toggle(function(){
    $(this).parent("li.current").children("ul").hide();
    $(this).removeClass("arrow").addClass("down");
  },function(){
    $(this).parent("li.current").children("ul").show();
    $(this).removeClass("down").addClass("arrow");
  });
  $(".carList .item .car").click(function(){
    goTo($(this).find("a").attr("href"));
  });
  $("#topMenu #top ul li").mouseover(function(){
    newSub = "sub_"+$(this).attr("id");
    $(this).parent("ul").find("li").removeClass("current");
    $(this).addClass("current");
    $("#sub").find("ul").hide();
    if ($("#"+newSub).length > 0){
      $("#"+newSub).show();
    }
  });
  $(".tabs .legends .item").click(function(){
    $(".tabs .legends .item").removeClass("current");
    $(this).addClass("current");
    var idItem = $(this).attr("id")+"text";
    $(".tab:not(.hide):not(.no)").addClass("hide");
    $("#"+idItem).removeClass("hide");
  });
  $(".tabs .gallery .item img").click(function(){
    $(".tabs .gallery .item img").removeClass("current");
    $(this).addClass("current");
    var bigImg = $(this).attr("rel");
    $("#pageImage img").attr("src",bigImg);
    $(window).scrollTop("0px");
  });
});

function goTo(href){
  window.location=href;
}

function changePicture(src, obj){     
  var img = document.getElementById(obj);
  img.src = src;
}

function placeHolder(element,value) {
  if($(element).val() == value){
    $(element).val('');
    $(element).addClass('search_text_user').removeClass('search_text_default');
  }
  else if($(element).val() == ''){
    $(element).val(value);
    $(element).addClass('search_text_default').removeClass('search_text_user');
  }
  return true;
}


