var site = function() {
	this.navLi = jQuery('#nav li').children('ul').hide().end();
	this.init();
};

site.prototype = {
 	
 	init : function() {
 		this.setMenu();
 	},
 	
 	// Enables the slidedown menu, and adds support for IE6
 	
 	setMenu : function() {
 	
 	jQuery.each(this.navLi, function() {
 		if ( jQuery(this).children('ul')[0] ) {
 			jQuery(this)
 				.append('<span />')
 				.children('span')
 					.addClass('hasChildren')
 		}
 	});
 	
 		this.navLi.hover(function() {
 			// mouseover
			jQuery(this).find('> ul').stop(true, true).slideDown('slow', 'easeOutBounce');
 		}, function() {
 			// mouseout
 			jQuery(this).find('> ul').stop(true, true).hide(); 		
		});
 		
 	}
 
}

new site();

jQuery(document).ready(function() { 

/* Quicksand */

// Load

//$('ul#productList').quicksand( $( 'ul#' + active_quicksand + '> li'), {
//      duration: 500,
//      attribute: 'data-id',
//      easing: 'easeInOutQuad'
//    });

// Click

jQuery(function() {

  jQuery('#filterBrand a').click(function(e) {
									 
	var brand = jQuery(this).attr('title');													 
										 
    jQuery('ul#productList').quicksand( jQuery( '#brand' + brand + ' > li'), {
      duration: 500,
      easing: 'easeInOutQuad',
	  attribute: "data-id"
    });
    e.preventDefault();

  });
});

/* End Quicksand */

jQuery( ".accordion" ).accordion();

});

jQuery('.btn-addtobasket').click(function(event) {

event.preventDefault();

var total_items = 0;

jQuery('input.qty').each(function(index,Element) { 

if (jQuery(this).val() != 0) { total_items += jQuery(this).val(); jQuery('#product_addtocart_form').submit(); }

if ( (index == (jQuery('input.qty').length - 1)) && (total_items == 0) ) { alert("Please enter a quantity for at least one item and then click the 'Add items to basket' button again"); } 

});

});

