function toggleDropdownMenu($dropdown, mode) {
	try {
		var animationSpeed="fast";
		
		if (mode=="show") {
			$dropdown.stop(true, true).clearQueue();
			$dropdown.slideDown(animationSpeed);
		} else {
			$dropdown.slideUp(animationSpeed);
		}
		
		return $dropdown;
	} catch(e) {
		return $dropdown;
	}
}

function vcardPosition() {
	var $acercade = jQuery("section#acercade");
	var $vcard = $acercade.find("footer.vcard");
	if ($vcard.css("z-index")!="44") {
		var $blog = jQuery("section#blog");
		var vcardHeight = $vcard.outerHeight();
		var blogHeight = $blog.height() - $blog.find("footer").outerHeight() - 12;
		var newHeight = blogHeight-vcardHeight;
		$acercade.height(newHeight);
		$acercade.css("padding-bottom",vcardHeight+"px");
	} else {
		$acercade.css("padding-bottom","0px").css('height','auto');
	}
}


jQuery(document).ready(function(){
	
	/* Mover la vcard para que se alinee con el final de la columna blog */
	vcardPosition();
	jQuery(window).resize(function(){
		vcardPosition();
	});
	
	/* Eventos dropdown menu principal */
	var $dropdown = jQuery("header#mainHeader nav ul.secciones ul").each(function(){
		
		var $this = jQuery(this);
		
		//No mostrar el dropdown si no tiene hasDropdown
		if (!$this.siblings("a").hasClass("hasDropdown")) {
			return;
		}
		
		$this.parent().hover(
			function(event) {
				toggleDropdownMenu($this,"show");
			},
			function(event) {
				toggleDropdownMenu($this,"hide");
			}
		);
	
	});
	
	//alert( jQuery(window).width() + " | " + jQuery(document).width() );
	
});
