jQuery( function($) {

 
          

  


  if ($('#featured_home').length>0){ 
$('#fea_car').carouFredSel({
width:960,
scroll : {
	        duration        : 1000
    },
auto : false,
	    prev : "#fea_prev",
	    next : "#fea_next"
	        }); 
	        
          $("#latest_car").carouFredSel({
width:960,
height:300,scroll    : {
	        duration        : 1000
    },
	auto 		: false,
	    prev : "#nov_prev",
	    next : "#nov_next"
});

				}			
        							
	jQuery.validator.setDefaults({
			errorElement: "p",
			errorClass: "s_error_msg",
			errorPlacement: function(error, element) {
					error.insertAfter(element);
			},
			highlight: function(element, errorClass, validClass) {
					$(element).addClass("error_element").removeClass(validClass);
					$(element).parent("div").addClass("s_error_row");
			},
			unhighlight: function(element, errorClass, validClass) {
					$(element).removeClass("error_element").addClass(validClass);
					$(element).parent("div").removeClass("s_error_row");
			}
	});
	$("#contact_form").validate({
		rules: {
			enquiry: {
					required: true,
					minlength: 10
			}
		}
	});
	

  var site_options = {
    'main_color'      : '#333333',
    'secondary_color' : '#d50022'            //'#d50022'      
  }

  // Hover effect for the header menu
  $("#categories > ul > li").not("#menu_home").hover(
    function() {
      $(this).find("a:first").stop().animate({
          color: '#ffffff',
          backgroundColor: site_options.secondary_color
        },300
      );
    }
    ,
    function() {
      $(this).find("a:first").stop().animate({
          color: site_options.main_color,
          backgroundColor: '#ffffff'
        },300
      );
    }
  );

  if (!$.browser.msie || parseInt($.browser.version, 10) > 8) {
      var onMouseOutOpacity = 1;
      $('#featured_home div.s_listing > div.s_item, #links .elenco_cnt').css('opacity', onMouseOutOpacity)
        .hover(
      
           
          function () {
            console.time(1);    
            $(this).prevAll('div.s_item').stop().fadeTo('slow', 0.60);
            $(this).nextAll('div.s_item').stop().fadeTo('slow', 0.60);
            console.timeEnd(1);
          },
          function () {
            $(this).prevAll('div.s_item').stop().fadeTo('slow', onMouseOutOpacity);
            $(this).nextAll('div.s_item').stop().fadeTo('slow', onMouseOutOpacity);
          } 
      ); 
  }

  // Hover effect for the shoppica cart
  $("#cart_menu").hover(
    function() {
      $(this).find(".s_grand_total").stop().animate({
          color: '#ffffff',
          backgroundColor: site_options.main_color
        },300
      );
    }
    ,
    function() {
      $(this).find(".s_grand_total").stop().animate({
          color: site_options.main_color,
          backgroundColor: '#ffffff'
        },300
      );
    }
  );

  // Animation for the languages and currency dropdown
  $('.s_switcher').hover(function() {
    $(this).find('.s_options').stop(true, true).slideDown('fast');
  },function() {
    $(this).find('.s_options').stop(true, true).slideUp('fast');
  });
});
