var Gravity = {
	init: function(i) {
		 		
		document.getElementById("div").style.display="block";
			
		var rutaAbsoluta = new String(document.location); 
		var posicionUltimaBarra = rutaAbsoluta.lastIndexOf("/"); 
		var nombre = rutaAbsoluta.substring( posicionUltimaBarra + "/".length , rutaAbsoluta.length );    
		
	    if (nombre == "index.html" || nombre == ""){
			  $("#air").animate({ height: "335px"}, { duration: 5000, easing: "easeOutElastic"});
		}else if (nombre == "home.html"){
			  $("#air").animate({ height: "240px"}, { duration: 5000, easing: "easeOutElastic"});				
		}else if (nombre == "nosotros.html" || nombre == "us.html"){
			  $("#air").animate({ height: "740px"}, { duration: 5000, easing: "easeOutElastic"});	
		}else if (nombre == "contactar.php" || nombre == "contact.php"){
			  $("#air").animate({ height: "590px"}, { duration: 5000, easing: "easeOutElastic"});	
		}else if (nombre == "historia.html" || nombre == "history.html"){
			  $("#air").animate({ height: "250px"}, { duration: 5000, easing: "easeOutElastic"});	
		}else if (nombre == "productos.html" || nombre == "products.html"){
			  $("#air").animate({ height: "560px"}, { duration: 5000, easing: "easeOutElastic"});	
		}else if (nombre == "chat.php"){
			  $("#air").animate({ height: "477px"}, { duration: 5000, easing: "easeOutElastic"});	
		}else if (nombre == "produccion.html" || nombre == "production.html" ){
			  $("#air").animate({ height: "1000px"}, { duration: 5000, easing: "easeOutElastic"});	
		}else if (nombre == "enlaces.html" || nombre == "links.html"){
			  $("#air").animate({ height: "260px"}, { duration: 5000, easing: "easeOutElastic"});	
		}
							  
		var block = $("#air").parent().next();
		var fallDist = $("#air").outerHeight() - $(block).outerHeight();
		//let the block fall
		$(block).stop().animate({
				marginTop: fallDist+"px"
		}, {
				duration: 1000,
				easing: "easeOutBounce"
		});

	},
	
	reset: function() {
		$(".handle").stop().animate({
			height: "50px"
		},{
			duration: 1000,
			easing: "easeInElastic"
		});
		
		$(".block").stop().animate({
			marginTop: "0px"
		},{
			duration: 1000,
			easing: "easeInBounce"
		});
	}

}

$(document).ready(function(){
	Gravity.init();
});