function resize_content(){
	var highSize = new Array();
	var selectHeight;
	var getHeight;
	var changeHeight = 0;
	highSize[0] = parseFloat($("#content").css('height'))+parseFloat($("#content").css('margin-top'))+parseFloat($("#content").css('padding-top'))+parseFloat($("#content").css('padding-bottom'));
	highSize[1] = parseFloat($("#extras").css('height'))+parseFloat($("#extras").css('margin-top'))+parseFloat($("#extras").css('padding-top'))+parseFloat($("#extras").css('padding-bottom'));
	
	if(highSize[1]){
		if(highSize[0]>highSize[1]){
			selectHeight = highSize[0];
		}else{
			selectHeight = highSize[1];
			changeHeight = highSize[1];
		}
	}else{
		selectHeight = highSize[0];
	}
	getHeight = selectHeight + 95;

	/*if(getHeight < 477){
		$("#js_content").css('height', "477px");
	}else */
	if(getHeight){
		if(getHeight<477){
			$("#js_content").css({ 'height':'477px' });
			$("#content").css({ 'height':'385px' });
		}else{
			$("#js_content").css('height', getHeight);
			if(changeHeight != 0){ $("#content").css({ 'height':changeHeight }); }
		}		
	}else{
		$("#js_content").css({ 'height':'477px' });
	}
}

$(document).ready(function(){
	
        // Animation Main-Navi
        $("#js_navi #main_navi li:nth-child(1)").animate({marginTop: "2px", opacity: "1"});
        $("#js_navi #main_navi li:nth-child(2)").delay(120).animate({marginTop: "2px", opacity: "1"});
        $("#js_navi #main_navi li:nth-child(3)").delay(240).animate({marginTop: "2px", opacity: "1"});
        $("#js_navi #main_navi li:nth-child(4)").delay(360).animate({marginTop: "2px", opacity: "1"});
        $("#js_navi #main_navi li:nth-child(5)").delay(480).animate({marginTop: "2px", opacity: "1"});
        $("#js_navi #main_navi li:nth-child(6)").delay(600).animate({marginTop: "2px", opacity: "1"});
        $("#js_navi #main_navi li:nth-child(7)").delay(720).animate({marginTop: "2px", opacity: "1"});
        // Animation Side-Navi
        $("#js_navi #side_navi li:nth-child(1)").delay(2000).animate({marginTop: "4px", opacity: "1"});
        $("#js_navi #side_navi li:nth-child(2)").delay(2120).animate({marginTop: "4px", opacity: "1"});
        $("#js_navi #side_navi li:nth-child(3)").delay(2240).animate({marginTop: "4px", opacity: "1"});
        $("#js_navi #side_navi li li").animate({marginTop: "0"});
	
        // Animation Image
        $("#rebaiyes_bg").delay(320).animate({opacity: "1"},100)
                         .delay(80).animate({opacity: "0"},750);
        $("#rebaiyes").delay(500).animate({opacity: "1"},750);
        $("#rebaiyes_border").delay(120).animate({opacity: "1"},200)
                             .animate({top: "-52px", left: "-51px"},1200)
                             .animate({opacity: "0"},10);
            
        // Animation Textos
        $("#js_textos_content").delay(120).animate({width:"585px", height:"400px"},3500);
        
	/*$("#navi_home").click(function(){
            
	  $("#subnavi_z").animate({opacity: "0.1", left: "+=400"}, 1200)
	  .animate({opacity: "0.4", top: "+=160", height: "20", width: "20"}, "slow")
	  .animate({opacity: "1", left: "0", height: "100", width: "100"}, "slow")
	  .animate({top: "0"}, "fast")
	  .slideUp()
	  .slideDown("slow")
	  return false;
	});*/
        
        // Submenu home
        $("#navi_home").hover(function(){
            $("#subnavi_home").stop().animate({opacity: 0.5});
            $("#navi_home ul li:nth-child(1)").stop().animate({top: "-2px"});
            $("#navi_home ul li:nth-child(2)").stop().animate({top: "-2px"});
            $("#navi_home ul li:nth-child(3)").stop().animate({top: "-2px"});
	}, function() {
		$("#subnavi_home").stop().animate({opacity: 0}, "fast");
                $("#navi_home ul li:nth-child(1)").stop().animate({top: "-2px"});
                $("#navi_home ul li:nth-child(2)").stop().animate({top: "-22px"});
                $("#navi_home ul li:nth-child(3)").stop().animate({top: "-44px"});
	});
        
        // Submenu tiendas
        $("#navi_tiendas").hover(function(){
            $("#subnavi_tiendas").stop().animate({opacity: 0.5});
            $("#navi_tiendas ul li:nth-child(1)").stop().animate({top: "-2px"});
            $("#navi_tiendas ul li:nth-child(2)").stop().animate({top: "-2px"});
            $("#navi_tiendas ul li:nth-child(3)").stop().animate({top: "-2px"});
	}, function() {
		$("#subnavi_tiendas").stop().animate({opacity: 0}, "fast");
                $("#navi_tiendas ul li:nth-child(1)").stop().animate({top: "-2px"});
                $("#navi_tiendas ul li:nth-child(2)").stop().animate({top: "-22px"});
                $("#navi_tiendas ul li:nth-child(3)").stop().animate({top: "-44px"});
	});
        
        // Submenu profesionales
        $("#navi_profesionales").hover(function(){
            $("#subnavi_profesionales").stop().animate({opacity: 0.5});
            $("#navi_profesionales ul li:nth-child(1)").stop().animate({top: "-2px"});
            $("#navi_profesionales ul li:nth-child(2)").stop().animate({top: "-2px"});
            $("#navi_profesionales ul li:nth-child(3)").stop().animate({top: "-2px"});
	}, function() {
		$("#subnavi_profesionales").stop().animate({opacity: 0}, "fast");
                $("#navi_profesionales ul li:nth-child(1)").stop().animate({top: "-2px"});
                $("#navi_profesionales ul li:nth-child(2)").stop().animate({top: "-22px"});
                $("#navi_profesionales ul li:nth-child(3)").stop().animate({top: "-44px"});
	});
        
        // Submenu Side-Navi Idiomas
        $("#side_navi_idioma").hover(function(){
            $("#side_subnavi_idioma").stop().animate({opacity: 0.5});
            $("#side_navi_idioma ul li:nth-child(1)").stop().animate({top: "0"});
            $("#side_navi_idioma ul li:nth-child(2)").stop().animate({top: "-4px"});
	}, function() {
		$("#side_subnavi_idioma").stop().animate({opacity: 0}, "fast");
                $("#side_navi_idioma ul li:nth-child(1)").stop().animate({top: "0"});
                $("#side_navi_idioma ul li:nth-child(2)").stop().animate({top: "-22px"});
	});
        
        // Submenu profesionales
        /*$("#navi_profesionales").hover(function(){
            $("#subnavi_profesionales").animate({opacity: "0.5"});
            $(".1").animate({top: "0"});
            $(".2").animate({top: "0"});
            $(".3").animate({top: "0"});
	}, function() {
		$("#subnavi_profesionales").animate({opacity: "0"}, "fast");
                $(".1").animate({top: "0"});
                $(".2").animate({top: "-22px"});
                $(".3").animate({top: "-44px"});
	});*/
	
	// Setting Height
	resize_content();
	
	// Animation Footer-Navi
        //$("#js_footer:nth-child(2)").delay(2000).animate({marginTop: "-100px", opacity: "1"});
	// $("#footer_navi li:nth-child(1)").delay(1250).animate({marginTop: "0px", opacity: "1"});
	// $("#footer_navi li:nth-child(2)").delay(1370).animate({marginTop: "0px", opacity: "1"});
	// $("#footer_navi li:nth-child(3)").delay(1490).animate({marginTop: "0px", opacity: "1"});
	// $("#footer_navi li:nth-child(4)").delay(1610).animate({marginTop: "0px", opacity: "1"});
	// $("#footer_navi li:nth-child(5)").delay(1730).animate({marginTop: "0px", opacity: "1"});
	// $("#footer_navi li:nth-child(6)").delay(1850).animate({marginTop: "0px", opacity: "1"});
	// $("#footer_navi li:nth-child(7)").delay(1970).animate({marginTop: "0px", opacity: "1"});
	// $("#footer_navi li:nth-child(8)").delay(2090).animate({marginTop: "0px", opacity: "1"});
        /*$("#js_navi #side_navi li:nth-child(2)").delay(2120).animate({marginTop: "4px", opacity: "1"});
        $("#js_navi #side_navi li:nth-child(3)").delay(2240).animate({marginTop: "4px", opacity: "1"});
        $("#js_navi #side_navi li li").animate({marginTop: "0"});*/
	
	// CAPITAL Letters
	$('#main_navi').find('li').find('a:first').find('span').each(function(){
		var text = $(this).html();
		text = $.trim(text);
		var inicial 	= text.substr(0,1);
		var rest	= text.substr(1);
		$(this).replaceWith('<span class="capital">'+inicial+'</span>'+rest);
	});
});


