function carAnimation(){
   
}

carAnimation.prototype.init = function(){
        
    carAnimation.prototype.animate_car();  
    carAnimation.prototype.icons = $("#car_icons ul li a");
    carAnimation.prototype.icons.hover( this.icons_hover_on, this.icons_hover_out );
}

carAnimation.prototype.icons_hover_on = function(){
   
   var className  = $(this).attr('class');
   var elementNum = className.replace("car_ico", '');   
   
   carAnimation.prototype.change_message( elementNum );
   carAnimation.prototype.change_element( elementNum );
   carAnimation.prototype.previous_element = elementNum;
   
}

carAnimation.prototype.icons_hover_out = function(){
   // alert( $(this).attr('class') );
}

carAnimation.prototype.change_message = function( curentElement ){
    
    if( carAnimation.prototype.previous_element != curentElement )
    {
      if(carAnimation.prototype.previous_element)
        $("#desk_"+carAnimation.prototype.previous_element).hide();
    
      $("#desk_"+curentElement).show();
    }
}

carAnimation.prototype.change_element = function( curentElement ){

    if( carAnimation.prototype.previous_element != curentElement )
    {
       
      if(carAnimation.prototype.previous_element)
        $("#car_element_"+carAnimation.prototype.previous_element).fadeTo(400,0);

      $("#car_element_"+curentElement).fadeTo(0,0.1);
      $("#car_element_"+curentElement).fadeTo(300,1);
      $("#car_element_"+curentElement).css('display', 'block');     
    }
}


carAnimation.prototype.animate_car = function(  ){


  $("#car_01").fadeTo(1000,0,function(){
      $("#car_01").hide();
      $("#car_02").fadeTo(1000,0,function(){
          $("#car_03").fadeTo(1000,0,function(){
              $("#car_04").fadeTo(1000,0,function(){
                  $("#car_05").fadeTo(2000,0, function(){
                    
                  });
              });
          });
      });
  });

}


$(document).ready( function(){
  //  var carAnim = carAnimation();
    carAnimation.prototype.init();
});

//jQuery("#tool span").hover(function() {
// jQuery(this).css('background-color', 'white');
//}, function() {
//jQuery(this).css('background-color', '#D4D0C8');
//});
