// JavaScript Document
$().ready(function(){
	$('.productos ul li a').hover(function() {
	  $(this).addClass('ahover');
	}, function() {
	  $(this).removeClass('ahover');
	});	
	$('.subtitular').hover(function() {
	  $(this).addClass('titahover');
	}, function() {
	  $(this).removeClass('titahover');
	});	

	$(".productos ul li li:has(ul)").addClass("replaced");
	$(".productos ul li li:nth-child(odd)").addClass("odd");
	var rotativo=new Array();
	var resto=new Array();
	var num=$(".replaced").length;
	for(i=0; i < num ; i++){
		
		var subhtml = $(".replaced:eq("+ i +")").html();
			if (navigator.appName.indexOf("Microsoft") != -1) {
				numhtml = subhtml.indexOf("<UL");
			} else {
				numhtml = subhtml.indexOf("<ul");
			}
		
		rotativo[i] = $(".replaced:eq("+ i +")").html().slice(0, numhtml);
		resto[i] = $(".replaced:eq("+ i +")").html().slice(numhtml);
		$(".replaced:eq("+ i +")").before('<li class="subtitular"><a>'+rotativo[i]+'</a>'+ resto[i] + '</li>' );

	}

	$('.productos ul').accordion({
		header: 'a',
		active: '.asel',
		selectedClass: '.asel',
		alwaysOpen: false,
		autoheight: false 		
		});
});
