$(function() {
	$('.detalle .texto').append($('.segundo>div'));
	$('.segundo').parent().remove();

	var div = $('<div id="tercerMenu"></div>');
	var ul = $('<ul></ul>');
	div.append(ul);
	$('.detalle h4').each(function(i) {
		var li = $('<li><div><a href="javascript:void(0)">' + $(this).text() + '</a></div></li>');
		ul.append(li);

		var padre = $(this).parent();
		padre.id = 'pestana' + i;

		li.click(function() {
			$('.texto div:has(h4)').hide();
			padre.show();
		});

		if(i != 0) {
			padre.hide();
		}
	});

	if(ul.children().length > 0) {
		$('#secundaria').html(div);
	}

	$('#funciones li, #aplicaciones li').hover(
		function() {
			$(this).find('.descripcion').fadeIn();
		},
		function() {
			$(this).find('.descripcion').fadeOut();
		}
	);
});