var $j = jQuery.noConflict(); 

$j(document).ready(function(){

	// collapsible menus
	$j("#nav .level0").each(function(){
		if ( $j(this).find(">li:gt(1)").length > 0 ) {
			// hide all but but 2 list items
			$j(">li:gt(1)",this).hide();
			
			// add control link
			$j(this).after('<a class="toggle more" href="#">view more&hellip;</a>');
		}
	});		
	
	// add click event to control link
	$j("#nav .toggle").click(function(){
		if ( $j(this).hasClass("more") ) {
			$j(this).removeClass("more").addClass("less").html('view less&hellip;');
			$j(this).parent().find(">ul>li").show();
		} else {
			$j(this).removeClass("less").addClass("more").html('view more&hellip;');
			$j(this).parent().find(">ul>li:gt(1)").hide();
		}
		return false;
	});
	
	$j("#nav li:has(.active)").find(".toggle").click();
	
	// search setups
	$j("#search select").each(function(){
		var $label = $(this).parents("li").find("label");
		$label.hide();
		$j("option[value='']",this).html($label.html());
	});
	
	// roundy round
	DD_roundies.addRule('.sidebar .mini-basket, #product .back, .primary h1, #featured h2, .breadcrumbs, .std h1, .product-view .product-shop .add-to-links li a, .product-view .product-shop .product-centre a', '7px');
	DD_roundies.addRule('button.button span, input.submit, .more a, .next a, .prev a', '10px');
	DD_roundies.addRule('.block-title, .block-cart .block-title', '13px 13px 0 0');
	DD_roundies.addRule('.top-bar, .footer, .top-bar h3, .product-essential h3', '13px');
	
});
