var $j = jQuery.noConflict();
$j(document).ready(function()
{
	var childrens = $j("#products-list").children().length;
	childrens = childrens * 245;
	
	$j("#products-list").width(childrens);
	
	/*******************/
/*	$j("#principal > li > a").hover(function()
	{

	$j('#principal ul').stop(true,true).fadeOut();
	
	if(false == $j(this).next().is(':visible')) {
		$j('#principal ul').slideUp(300);
	}
	$j(this).next().slideToggle(1000);
	});
	
	$j('#principal ul:eq(0)').show();*/
	
	$j('#principal').hoverAccordion({ 
      //keepHeight: true, 
      activateItem: 2, 
      speed: 'normal' 
   }); 
   menu_padre();
	/*******************/
	
	$j('.scroll-pane').jScrollPane({
		showArrows: true
	}),
	//jQuery("#principal").Accordion(),

	$j('#Header').cycle({
		fx: 'fade',
		timeout: 3000, 
		pager:  '#flechas' 
	}),
	
	$j('#mycarousel').jcarousel({
		visible: 6
	});
});

function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}


function menu_padre() {
	var cates = getUrlVars()["cat"];
	
	if((cates != null) && (cates !== undefined))
	{
		var cats = cates.split("%20");
		
			var item = $j("#principal li #"+cats[0]);
			item.removeClass('closed').addClass('opened');
			item.next().show();
			item.next().children().each(function(){  $(this).show();});		
	}
}

