$(document).ready(function(){
	$("a").each(function(){
		base = "http://localhost:8080/doce/"
		if (this.href.indexOf(base + "#")>= 0){
			this.href = document.location + this.href.substr(this.href.indexOf("#"),this.href.length);
		}
	});
	
	var menues = new Array("animacion", "eventos", "parques", "cabalgatas", "magia");
	for (i=0; i<menues.length;i++){
		$("#"+menues[i]).hover(function(){
										posicion = findPos(this);
										
									  	$("#"+this.id+"_menu").get(0).style.top = (posicion[1] + 15) + "px";
										$("#"+this.id+"_menu").get(0).style.left = (posicion[0] + 100) + "px";
									  	$("#"+this.id+"_menu").get(0).style.display = "block";
										$("#"+this.id+"_menu").hover(function(){this.sobre = 1;},function(){this.sobre = 0; this.style.display = "none";});
									  },function(){
										 setTimeout("ocultacapa('#"+this.id+"_menu')",200);
									  });
	}
	
	$("div.flash").each(function(){
		this.style.zIndex = "1";
		this.style.visibility = "visible";
		var so = new SWFObject(this.title, this.id, this.style.width, this.style.height, "8", "#ffffff");
		this.title = "";
	    so.addParam("wmode", "transparent");
		so.addParam("bgcolor", "#FFFFFF");
   		so.write(this.id);
	});
});

function ocultacapa(id){
	if ($(id).get(0).sobre != 1){
		$(id).get(0).style.display = "none";
	}
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}