$.fn.changeImages = function(teaserBg, image) {
  $(this).css({
    'background-image': 'url('+teaserBg+')' 
  });
  $(".big_img").attr("src", image);
}

$(document).ready(function(){
  var big_img = $(".big_img").attr("src");
  var ie6 = false;
  if($.browser.msie && $.browser.version.substr(0,1)=="6"){
    ie6 = true;      
  }
  
  $("#selection_wrap_left").hover(
    function(){
      $("#selection_wrap_right").stop(false,true);
      $(this).changeImages(imgDir+'teaser_01_active.jpg', imgDir+'img_big2.jpg');
      $(".triangle").css({
        'margin-left': '60px'
      });
      $(".triangle").fadeIn("fast");
      $("#dialog_for_left").slideDown("slow");
    },
    function(){
      $("#dialog_for_left").stop(true,true);
      $(this).changeImages(imgDir+'teaser_01_default.jpg');
      $(".triangle").hide();
      $("#dialog_for_left").hide();
      $(".big_img").attr("src", big_img);
    }
  );
  
  $("#selection_wrap_right").hover(
    function(){
      $("#selection_wrap_left").stop(false,true);
      $(this).changeImages(imgDir+'teaser_02_active.jpg', imgDir+'img_big3.jpg');
      $(".triangle").css({
        'margin-left': '550px'
      });
      $(".triangle").fadeIn("fast");
      $("#dialog_for_right").slideDown("slow");
    },
    function(){
      $("#dialog_for_right").stop(true,true);
      $(this).changeImages(imgDir+'teaser_02_default.jpg');
      $(".triangle").hide();
      $(".big_img").attr("src", big_img);
      $("#dialog_for_right").hide();
    }
  );
  
  $("#basket").hover(
    function(){
      if(!(ie6)){
        $("#order").stop(false,true);
        $("#basket_img").show();
      }
    },
    function(){
      if(!(ie6)){
        $("#basket_img").stop(true,true);
        $("#basket_img").hide();
      }    
    }
  );
  
  $("#order").hover(
    function(){
      if(!(ie6)){
        $("#basket").stop(false,true);
        $("#order_img").show();
      }    
    },
    function(){
      if(!(ie6)){
        $("#order_img").stop(true,true);
        $("#order_img").hide();
      }
    }
  );
     
    $(".textarea textarea").click(
      function () { 
        if ($(this).val() == userMessage){
          $(this).val('');
        }
      }
    );
});
