//
var listHeight;

//
$(document).ready( init );


// INIT
function init(){
	
	//HEADER BUTTONS
	var headerColor = $("div#presupuesto h2").css('color');
	var headerSize = parseInt( $("div#presupuesto h2").css('fontSize').substr(0, 2) );
	$("div#presupuesto, div#sugerencias").hover(
      function () {
		 $(this).stop();  $(this).find("h2").stop();
		 $(this).find("h2").animate( { color: "#326a95" } );
		 $(this).animate( { backgroundPosition: '0px 0px' }, 450 );
      }, 
      function () {
		  $(this).stop();  $(this).find("h2").stop();
		  $(this).find("h2").animate( { color: headerColor } );
		  $(this).animate( { backgroundPosition: '-234px 0px' } );
      }
    );
	
	
	//SUBMENU
	$("ul.menu li:has(ul.submenu)").each( function(){
		
		var submenu = $(this).find("ul.submenu");
		submenu.data('height', submenu.height() );
		submenu.css("height", 0);
		submenu.hide();
		
		//hover
		$(this).hover(
			function(){
				var submenu = $(this).find("ul.submenu");
				submenu.stop();
				submenu.animate( { height: submenu.data('height') }, 250 );
			},
			function(){
				$(this).find("ul.submenu").stop();
				$(this).find("ul.submenu").animate( { height: 0 }, 200 );
			}
		)
	})
	
	
	//QUIENES SOMOS
	$("div#column-left .fader").css("opacity", 0);
	$("div#column-left .fader").hover(
      function () {
		 $(this).stop();
		 $(this).animate( { opacity: 1 }, 500 )
      }, 
      function () { 
	  	 $(this).stop();
		 $(this).animate( { opacity: 0 }, 700 )
      }
    );
	$("div#column-left .fader").click(
      function () {
		window.location = '/quienes-somos';
      }
    );

	
	//BOTONERA DEL FOOTER
	$("div.footer-block").hover(
		//rollover
		function(){
			var target = $(this).find("h2");
			target.stop();
			target.animate( { color: "#326a95", backgroundPosition: '5px 2px' }, 200 );
		},
		//rollout
		function(){
			var target = $(this).find("h2");
			target.stop();
			target.animate( { color: "#cecece", backgroundPosition: '0px 2px' } );
		}
	);
}


function showPromo(){
	$('#promotest').nyroModalManual({
      bgColor: '#fff'
    });
}

