
jQuery(document).ready(function($) {
    // $() will work as an alias for jQuery() inside of this function
	

	  //Superfish setup
	  $('#menu ul').superfish({ 
          delay:       500,                            // one second delay on mouseout 
          animation:   {height:'show'},  // fade-in and slide-down animation 
          speed:       'fast',                          // faster animation speed 
          autoArrows:  false,                           // disable generation of arrow mark-up 
          dropShadows: true                            // disable drop shadows 
      }); 
	  
	

	  //Submit Seach Form using plain button
	  $('#menu #search button.searchbutton').click(function() {
		  $("#searchform").submit(); 
	  });
	  
	  
});


//Overrides default ajax behaviour
var ShoppCartAjaxHandler = function (cart) {
	(function($) {

		//notify of success!
		$.jGrowl(cart.Item.name+" added to cart", { header: 'Success', life:4000 });
		
		if(cart.Totals.quantity == 0){
			$("#sidecart").html("You have "+cart.Totals.quantity+" item in your cart <a id='checkout_button' title='Checkout Now' href='/catalog/cart/'>checkout</a>");
		}else{
			$("#sidecart").html("You have "+cart.Totals.quantity+" items in your cart <a id='checkout_button' title='Checkout Now' href='/catalog/cart/'>checkout</a>");
		}

	})(jQuery);	
};


