/*Zoom Imagenes*/
function zoomImages(zoomUrl,ancho,alto) {
	
	//URL al php con variables
	//zoomUrl = zoomUrl + "?zoomImg=" + eval(currentZoom + "[0]") + "&imgWidth=" + ancho +  "&imgHeight=" + alto;
	//alert ("zooming = " + zoomUrl);
	
	properties = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + ancho + ",height=" + alto + ",left=0,top=0";
	mywin = window.open(zoomUrl,"win",properties);
	mywin.self.focus();
}


function ventana (pagina) {
var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=508, height=365, top=85, left=140";
window.open(pagina,"",opciones);
}





///////////////////////////////////////////////////
//MENU FICHA EN EXPLORER ("Efecto Folder")
///////////////////////////////////////////////////

//Se aņade una clase a los LI para que el efecto en CSS funcione
startList = function() {
	if (document.all&&document.getElementById && document.getElementById("mainMenu") != null) {
		navRoot = document.getElementById("mainMenu");
		//alert (document.getElementById("mainMenu"));
		for (var i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
				//alert (i);
			}
		}
	}
}

///////////////////////////////////////////////////
//RECOLOCO LOS SUBMENUS A LA IZQUIERDA DEL TODO
///////////////////////////////////////////////////

var topMenuItems = new Array();

startSubMenus = function() {
	var mainMenu = document.getElementById("mainMenu");
	var totalTags = mainMenu.childNodes;
	var leftOffset = 0;
		
	for (var i = 0; i<totalTags.length; i++) {
		if(totalTags[i].tagName == "LI") {
			topMenuItems.push(totalTags[i]);
			//alert("topMenuItems = " + topMenuItems.length);
			//store width from the previous menu Items
			topMenuItems[topMenuItems.length - 1].leftOffset = leftOffset;
			leftOffset += totalTags[i].offsetWidth;
			//alert("leftOffset = " + leftOffset);
		}
	}
	//varMenuItems = liTags[0];
	//alert(totalTags.length);;
	//alert(topMenuItems);
	//alert(topMenuItems[0].id);
	//alert("LO = " +  topMenuItems[1].leftOffset);
	
	//Relocate SubMenus, only if it is NOT the firSt MENU item
	for (var i = 1; i<topMenuItems.length; i++) {
		var totalTags = topMenuItems[i].getElementsByTagName("UL");
		var subMenu = totalTags[0];
		//alert ("subMenu = " + subMenu.id);
		var TMPaddingLeft = getStyle(topMenuItems[i],'left');
		//alert("TMPaddingLeft = " + TMPaddingLeft.indexOf('px'));
		//alert("TMPaddingLeft.indexOf('-') = " + TMPaddingLeft.indexOf('-'));
		var offsetMenu = topMenuItems[i].leftOffset;
		
		
		//obtain Number from style string
		if (TMPaddingLeft.indexOf('-') == -1) {
			TMPaddingLeft = TMPaddingLeft.slice(0,TMPaddingLeft.indexOf('px'));
		}
		else {
			TMPaddingLeft = TMPaddingLeft.slice(1,TMPaddingLeft.indexOf('px'));
		}
		//alert("TMPaddingLeft = " +  TMPaddingLeft);
		var offsetMenu = topMenuItems[i].leftOffset - TMPaddingLeft;
		//alert("leftOffset =" + topMenuItems[i].leftOffset + " || TMPaddingLeft = " + TMPaddingLeft + "|| offsetMenu = " + offsetMenu);
		
		//Apply the Styles
		subMenu.style.left = "-" + offsetMenu + "px";
		
		//Make visible (onli Current Menu)
		//alert(topMenuItems[i].className);
		
		if(topMenuItems[i].className == "current") {
			subMenu.style.width = "550px";
			subMenu.style.height = "27px";
			subMenu.style.overflow = "visible";
			subMenu.style.visibility = "visible";
		}
	}
} 

//GET CURRENT STYLE
function getStyle(tagElement,styleProperty) {
	//alert(tagElement);
	if (tagElement.currentStyle)
		var prop = tagElement.currentStyle[styleProperty];
	else if (window.getComputedStyle)
		var prop = document.defaultView.getComputedStyle(tagElement,null).getPropertyValue(styleProperty);
	return prop;
}


///////////////////////////////////////////////////
//EXPANDABLE MENU
///////////////////////////////////////////////////

//Init Vars
var activeSmenus = new Array();
var expandSpeed = 3.1;
var removeActiveSmenu = new Boolean(false);
var animating = new Boolean (true);

//Encuentro los menus Secundarios y obtengo su altura inicial
startIzqMenus =  function (izqMenu) {
	
	if (document.getElementById(izqMenu) != null) {
		
		var izqMenu = document.getElementById(izqMenu);
		var divTags = izqMenu.getElementsByTagName("div");
		
		//alert(divTags.length);
		
		//Busco los DIV con clase "izqSubM"
		for (var i = 0; i<divTags.length; i++) {
			
			if(divTags[i].className == "izqSubM") {
				
				//coloco Estilos CSS y hago visibles los submenus (Ocultados por defecto)
				divTags[i].style.height = "auto";
				divTags[i].style.width = "auto";
				divTags[i].style.visibility = "visible";
				
				//Doy propiedades a los objetos
				divTags[i].id = "subM" + i;
				divTags[i].expanded = false;
				divTags[i].currentSize = 0; //estan contraidos siempre al principio			
				divTags[i].targetSize = divTags[i].offsetHeight;
				divTags[i].contractedSize = divTags[i].currentSize;
				divTags[i].expandedSize = divTags[i].targetSize;
				divTags[i].moving = false;
   	
				
				/*
				alert("subM.Id = " + divTags[i].id);
				alert("subM.currentSize = " + divTags[i].currentSize);
				alert("subM.targetSize = " + divTags[i].targetSize);
				alert("subM.expandedSize = " + divTags[i].expandedSize);
				*/
				
				//oculto todos los submenus
				divTags[i].style.height = "0px";
				
				//divTags[i].style.display = "none";	
				
			}	
		}
		
		//alert(subMenus[2][0]);
	}
	
	//recoloco footer en EXPLORER
	if (navigator.appName.indexOf("Explorer") > 0) {
		tagReloc("footer");
	}
	
	//Permito animacion
	animating = false;
	
}

//Animacion del subMenu
animateSubmenus = function(selectedAnchor) {
	
	//alert(animating);
	
	if(animating == false) {//Si no se esta animando(Espero a que termine para animar de nuevo)
		
		animating = true;
		
		//Si existia un sMenu que se ha contraido lo borro del array activeSmenus
		if(removeActiveSmenu == true) {
			activeSmenus.shift();
			//alert("removing ActiveSmenu");
		}
		
		stoppingCount = 0;
		
		//Encuentro el submenu "div class = subM" correpondiente al anchor seleccionado
		var liParentChilds = selectedAnchor.parentNode.childNodes;
		//alert(liParentChilds.length);
		
		for (var i = 0; i<liParentChilds.length; i++) {
			if(liParentChilds[i].tagName == "DIV") {
				sMenu = liParentChilds[i];
				sMenuId = liParentChilds[i].id;
				
				//alert("sMenu = " + sMenuId + ":: sMenu currentSize = " + sMenu.currentSize);
				
				//Aņado sMenus al array activeSmenus solo si se va a expandir
				if(sMenu.targetSize != 0) {
					activeSmenus.push(sMenu);
				}
   	
   	
				if(activeSmenus.length > 1){//Si la longitud del activeSmenus es mayor a 1 se debe remover un valor del mismo
					removeActiveSmenu = true;
					//alert("Dos items");
				}
				else if (activeSmenus.length == 1 && sMenu.targetSize == 0) {//Si hay solo 1 valor pero es el mismo SMenu contrayendose se remueve tambien 
					removeActiveSmenu = true;
					//alert("1 items y se va a cerrar");
				}
				else {//Ni es el mismo contrayendose
					//alert("1 items y se va a abrir");
					removeActiveSmenu = false;
					
				}
   	
				//alert("activeSmenus.length = " + activeSmenus.length + " ::: removing = " + removeActiveSmenu);
				
				for (var j=0; j<activeSmenus.length; j++) {
					//alert("activeSmenus = " + activeSmenus[j].id + " || targetSize = " + activeSmenus[j].targetSize);
					activeSmenus[j].moving = true;
					activeSmenus[j].resizing = new sizeIncrement(activeSmenus[j].currentSize, activeSmenus[j].targetSize);
				}
   	
				
			}
		}
		
		sizeInterval = setInterval( function() { updateSize(); }, 50 );
	}
		
}

//izqmenu Over
moseOverIzqmenu = function (izqMenuItem) {
	//alert("over");

	//Encuentro el submenu "div class = subM" correpondiente al anchor seleccionado
	var liParentChilds = izqMenuItem.parentNode.childNodes;
	//alert(liParentChilds.length);

	for (var i = 0; i<liParentChilds.length; i++) {
		if(liParentChilds[i].tagName == "DIV") {
			if(liParentChilds[i].currentSize == liParentChilds[i].expandedSize  && liParentChilds[i].expanded == true){
				setBackgroundPos(liParentChilds[i],"-495px 8px");
			}
			else {
				setBackgroundPos(liParentChilds[i],"-165px 8px");
			}
		}
	}

}

//izqmenu Out
moseOutIzqmenu = function (izqMenuItem) {
	//alert("out");

	//Encuentro el submenu "div class = subM" correpondiente al anchor seleccionado
	var liParentChilds = izqMenuItem.parentNode.childNodes;
	//alert(liParentChilds.length);
		
	for (var i = 0; i<liParentChilds.length; i++) {
		if(liParentChilds[i].tagName == "DIV") {
			if(liParentChilds[i].currentSize == liParentChilds[i].contractedSize  && liParentChilds[i].expanded == false){
				setBackgroundPos(liParentChilds[i],"0px 8px");
			}
			else {
				setBackgroundPos(liParentChilds[i],"-330px 8px");
			}
		}
	}

}

//recolocacion del fondo
setBackgroundPos = function (activeSmenu,pos) {

	//Encuentro los hijos del Nodo padre
	//para el link y para el subnenu es el LI contenedor
	var liParentChilds = activeSmenu.parentNode.childNodes;
	//alert(liParentChilds.length);
	
	//si uno de los hijos es "A" busco el hijo "SPAN"
	for (var i = 0; i<liParentChilds.length; i++) {
		if(liParentChilds[i].tagName == "A") {
			var parentSmenu = liParentChilds[i];
			var spansSMenu = parentSmenu.getElementsByTagName("SPAN");
			//alert(spansSMenu.length);
			//alert("found!! " + spansSMenu[0].tagName);
		}
	}
	//alert(activeSmenu.currentSize);
	//pongo el fondo de submenu Expandido en el SPAN
	spansSMenu[0].style.backgroundPosition = pos;

}

//recolocacion del elementos (Explorer)
tagReloc = function(relocItem) {

	itemReloc = document.getElementById(relocItem);
	itemReloc.style.bottom = "-1px";
	itemReloc.style.bottom = "0px";
	//alert("relocating");
}

//Incremento de Movimiento
function sizeIncrement (currentSize,targetSize) {
	
	this.resizeIt = function(){
		
		if(currentSize < targetSize) {//Expando
			currentSize += (targetSize - currentSize) / expandSpeed;
			currentSize = Math.ceil(currentSize);
		}
		else if (targetSize < currentSize) {//Contraigo
			currentSize += (targetSize - currentSize) / expandSpeed;
			currentSize = Math.floor(currentSize);
		}
		
		return [currentSize,targetSize];   
		
	}
	
	
}

//Actualizacion de tamaņo del subMenu
function updateSize(){
	
	for (var i=0; i<activeSmenus.length; i++) {
		activeSmenus[i].currentSize = activeSmenus[i].resizing.resizeIt()[0];
		activeSmenus[i].style.height = activeSmenus[i].currentSize + "px";
		
		//Si completo la expansion o la contraccion del subMenu
		if (activeSmenus[i].currentSize == activeSmenus[i].targetSize && activeSmenus[i].moving == true) {
			//alert(sMenu.id + " -> finished!!");
			stoppingCount += 1;
			
			//alert("stoppingCount = " + stoppingCount);
			//alert("activeSmenus.length = " + activeSmenus.length);
			
			if(activeSmenus[i].targetSize == activeSmenus[i].expandedSize) {//Se estaba expandiendo
				activeSmenus[i].targetSize = activeSmenus[i].contractedSize;
				activeSmenus[i].moving = false;
				setBackgroundPos(activeSmenus[i],"-330px 8px");
				activeSmenus[i].expanded = true;
				//alert(activeSmenus[i].id + " targetSize = " +  activeSmenus[i].targetSize);
			}
			else {//Se estaba contrayendo
				activeSmenus[i].targetSize = activeSmenus[i].expandedSize;
				activeSmenus[i].moving = false; 
				setBackgroundPos(activeSmenus[i],"0px 8px");
				activeSmenus[i].expanded = false;
				//alert(activeSmenus[i].parentNode.className);
				//alert(activeSmenus[i].id + " targetSize = " +  activeSmenus[i].targetSize);
				//alert("contracting:" + activeSmenus[i].id);
			}
			
			//testVars
			//testVars(activeSmenus[0].id,activeSmenus[0].currentSize,activeSmenus[0].targetSize);
			
			if (stoppingCount == activeSmenus.length) {
				//alert("full STOP!!");
				animating = false;
				clearInterval(sizeInterval);
			}
			
		}
		
		
	}
	
	//recoloco footer en EXPLORER
	if (navigator.appName.indexOf("Explorer") > 0) {
		tagReloc("footer");
	}

}



///////////////////////////////////////////////////
//CAROUSEL
///////////////////////////////////////////////////

//Init Vars
var slides = new Array();
var slidesID = new Array();
var initSlides = new Array();
var initPos = 0;
var setPos = initPos;
var incPos = 1;
var slideSep = 6;
var slideSpeed = 8.5;
var distance = 0;
var carousel;
var carouselMoving = false;

		
startCarousel = function() {
	
	if (document.getElementById("carouselContainer") != null) {
	
		carousel = document.getElementById("carouselContainer");
		carouselWidth = carousel.offsetWidth;
		
		carouselVisibleArea = carousel.offsetWidth;
		//alert("carouselVisibleArea = " + carouselVisibleArea);
		
		//Extraigo los tags DIV del carousel ARRAY
		divTags = carousel.getElementsByTagName("div");
		divTagsLength = divTags.length;
		
		//Obtengo DIV con ID Los guardo en un ARRAY "slides"
		for (i=0; i<divTagsLength; i++) {
			//solo aņado los elementos que tienen ID
			if (divTags[i].id != "") {
				slideToPush = document.getElementById(divTags[i].id);
				slides.push(slideToPush);
			}
		}
		slidesLength = slides.length;
		
		//Obtengo el ID de los Slides y Lo guardo en un ARRAY
		for (i=0; i<slidesLength; i++) {
			//slides[i].style.width = slides[i].firstChild.width + "px";
			slidesID.push(slides[i].id);
		}
		
		//defino la distancia a recorrer cada vez que avanza el carrusel
		//sera menor que el ancho del carrusel menos el de un slide menos el separador
		for (i=0; i<slidesLength; i++) {
			if (distance < (carouselWidth - (slides[i].offsetWidth + slideSep))) {
				distance += (slides[i].offsetWidth + slideSep);
			}
		}
		//alert("distance = " + distance);
			
		//Compongo Array Multidimensional
		for (i=0; i<slides.length; i++) {
				initSlides.push(new Array(slidesID[i], slides[i].offsetWidth, slides[i].offsetHeight));
				initSlides[i].moving = false;
				
				//alert("initSlides = " + initSlides);
				
				if (i != slides.length - 1) {//si NO es el ultimo ordeno secuelcialmente
					initSlides[i].position = setPos;
					setPos = setPos + slides[i].offsetWidth + slideSep;
				}
				else {//si SI es el ultimo coloco antes del primero
					initSlides[i].position = initSlides[0].position - initSlides[i][1] - slideSep;
					//alert("initSlides[1].position = " + initSlides[i].position); 
				}
		
		}
		
		//alert(slidesID);
		//alert(initSlides[1]);
		
		//posiciono y defino propiedades para cada SLIDE
		for (i=0; i<slides.length; i++) {
			slides[i].style.position = "absolute";
			slides[i].style.display = "block";
			slides[i].style.bottom = "16px";
			slides[i].style.left = initSlides[i].position + "px";
		}
		
		//alert (firstSlide[1] + "||" + lastSlide[0]);	
			
		//compruevo los valores
		//testVars(initSlides[0].position,"--","--","--","--");
		
		//Defino BOUNDS del carousel
		//alert(initSlides.length - 1);
		rightBound = initSlides[initSlides.length - 2].position + initSlides[initSlides.length - 2][1] + slideSep;
		leftBound = (initPos - initSlides[0][1] - slideSep);
		//alert ("rightBound established = " + rightBound);   
		
	}
}


function updatePos(){
	 
	var stoppingCount = 0;
		
	for (i=0; i<initSlides.length; i++) {
		initSlides[i].position = initSlides[i].startMove.moveIt()[1];
		initSlides[i].target = initSlides[i].startMove.moveIt()[0];
		mSlide = document.getElementById(initSlides[i][0]);
		mSlide.style.left = initSlides[i].position + "px";
		//mSlide.style.top  = -30 + 'px';
		
		if (initSlides[i].position == initSlides[i].target) {
			//alert("target clearInterval HELL= " + initSlides[i].target + " and moving = " + initSlides[i].moving);
			//Borro el Interval
			clearInterval(moveInterval);
			//Establesco que no hay movimiento del carousel
			initSlides[i].moving = false;
			
		}
		
		//Chech if coruosel has fully stopped
		if (initSlides[i].moving == false) {
			stoppingCount += 1;
			if (stoppingCount == initSlides.length) {
				//alert("carousel has stopped");
				carouselMoving = false;
			}
		}
	}

}

    
 function dammitMove (direction) {
	
	carouselMoving = true;
	
	//Si el ultimo elemento del carousel NO se mueve entonces muevo	
	if (initSlides[initSlides.length - 1].moving == false) { 
		
		//alert ("initSlides[initSlides.length - 1].moving = " + initSlides[initSlides.length - 1].moving);
			
		for (i=0; i<initSlides.length; i++) {
			
			//si NO se mueve el carousel lo muevo
			if (direction == "forth") {
				initSlides[i].target = distance + initSlides[i].position;
			}
	  		else {
				initSlides[i].target = (-distance) + initSlides[i].position;
			}
			
			initSlides[i].moving =  true;
		
			initSlides[i].startMove = new itemMovement(initSlides[i].position, initSlides[i].target, slideSpeed, direction);
			//alert(initSlides[i] + " :: moving = " + initSlides[i].moving + " :: position = " + initSlides[i].position + " :: target = " + initSlides[i].target + ":: speed = " + slideSpeed + ":: direction =" + direction);
		}
	
		moveInterval = setInterval( function() { updatePos(); }, 50 );
		
	}
	
}
 

function itemMovement(position, target, slideSpeed, direction){
	
	this.moveIt = function(){
	
		position += (target - position) / slideSpeed;
   	unRoundPosition = position;
   	if (direction == "forth") {
   		position = Math.ceil(position);
   	}
  	 	else if (direction == "back") {
  	 		position = Math.floor(position);
  	 	}
		
		//hacia ADELANTE (si la posicion es mayor que RIGHTBOUND)
		if (position >= rightBound && direction == "forth") {
			//actualizo el target
			target = (target - position) + (position - rightBound) + leftBound;
			//actualizo la posicion
			position = (position - rightBound) + leftBound;
			}
		
		//hacia atras (si la posicion es menor que LEFTBOUND )	
		if (position <= leftBound && direction == "back") {
			//actualizo el target
			target = (target - position) + (position - leftBound) + rightBound;
			//actualizo la posicion
			position = (position - leftBound) + rightBound;
			//alert ("BACKWARD position = " + position);
			}

   	//testVars(position,target,slideSpeed,unRoundPosition);
   	
   	//Check if there's any ToolTip visible
   	if(typeof(currentBook) != "undefined") {
			clearTimeout(showTimer);
			hideToolTip();
   	}
		
		return [target,position];
  }
  
	
}

//TOOLTIP
var hiddingTime = 500;

showToolTip = function(book) {
	
	
	//Check if the carousel is NOT moving
	if (carouselMoving != true) {
		if(typeof(currentBook) == "undefined") {//Si no existe el Libro
			currentBook = book.parentNode.parentNode;
			checkGlobe = findGlobe(currentBook);
			//alert("currentBook = " + parentItem.innerHTML);
			//alert("currentBook = " + currentBook.id);
			
		}
		else { //si existe y es diferente
			if(book.parentNode.parentNode != currentBook) {
				//alert("book before = " + currentBook.id + "\n book after = " + book.parentNode.parentNode);
				previousGlobe = currentGlobe;
				previousBook = currentBook;
				previousGlobe.style.display = "none";
				previousBook.style.zIndex = "0";
				currentBook = book.parentNode.parentNode;
				checkGlobe = findGlobe(currentBook);
			}
		}   
	}
	//alert("OverBook");
	//currentBook.style.background = "#000000";
	
}

findGlobe = function (currentBook) {
	
	parentDivs = currentBook.getElementsByTagName("div");
		
	//Obtengo el DIV que contiene la informacion del libro "GLOBE"
	for (i=0; i<parentDivs.length; i++) {
		//solo aņado los elementos que tienen ID
		if (parentDivs[i].className == "globe" || parentDivs[i].className == "globe globeRight") {
			parentGlobe = parentDivs[i];
		}
	}
		
	currentGlobe = parentGlobe;
	
	//defino la posicion de "Globe"
	
	//Encuentro la posicion de "currentBook"
	bookPosition = currentBook.style.left;
	bookPositionString = bookPosition.indexOf("p");
	bookPosition = bookPosition.substring(0,bookPositionString);
	//alert("bookPosition  = " + bookPosition);
	
	//si la posicion del libro es mayor a la mitad del carousel
	if(bookPosition >= (carouselWidth / 2)) {
		//alert(parentGlobe.style.display);
		parentGlobe.style.left = -140 + "px";
		parentGlobe.className = "globe globeRight";
	}
	else {
		parentGlobe.style.left = "50px";
		parentGlobe.className = "globe";
	}
		
		
	//alert("parentGlobe = " + parentGlobe.innerHTML);
	//parentGlobe.style.background = "#FF09DF";
	parentGlobe.style.display = "block";	
	currentBook.style.zIndex = "10";
		
	showingTip = true;
		
}


//Monitoreo si el Mouse esta dentro o fuera del Libro
function trackOverMouse(e){
	var trackEvent = (e)?e:event;
   var targetElement = (trackEvent.srcElement)?trackEvent.srcElement:trackEvent.target;
	//alert("tracking Mouse" + targetElement.parentNode.parentNode.id);
	//alert("targetElement.id" +  targetElement.id);
	
	if(typeof(currentBook) != "undefined") {
		
		//Compruebo el Parent
		var checkParent = findParentBook(currentBook.id,targetElement);
		//alert("matchID after Showing = " + matchID);
		//alert("overChild = " + checkParent.overChild);
		
		//doy un margen de tiempo antes de ocultar el ToolTip
		if (currentBook.id != checkParent.overParent) {
			if (typeof(showTimer) == "undefined") {
				showTimer = setTimeout( function() { hideToolTip(); }, hiddingTime );
			}
			//alert("different");
		}
		else if (typeof(showTimer) != "undefined" && currentBook.id == checkParent.overParent) {
			clearTimeout(showTimer);
			showTimer = undefined;
			//alert("equal");
		}
				
	}
	
}
	

function findParentBook(bookID, childObj) {
	var testObj = childObj;
	var count = 1;
	var matchID = false;
	var hidding = true;
	//alert(testObj.tagName + "||" + testObj.className);
	
	while(testObj.getAttribute('id') != "carousel") {
		//Defino el nivel maximo para buscar el PARENT (HTML)		
		if(testObj.tagName == "HTML") {
			//alert("BODY FOUND!!");
			break;	
		}
		//si el padre coincide
		if(testObj.getAttribute('id') == bookID) {
			matchID = true;
			hidding = false;
			break;
		}
		
		matchID = false;
		testObj = testObj.parentNode;
		count++;	
	}
	
	//Devuelvo variables
	return {bookID : bookID, matchID : matchID, overChild : childObj.id, overParent : testObj.getAttribute('id'), hidding : hidding};
	
}

hideToolTip = function() {
	//alert("hidding toolTip");
	currentGlobe.style.display = "none";
	currentBook.style.zIndex = "0";
	currentBook = undefined;
	showTimer = undefined;
}


document.onmouseover = trackOverMouse;


///////////////////////////////////////////////////
//FUREZO EL RESET EN FORMULARIOS
///////////////////////////////////////////////////

forceReset = function (theForm) {
	for(var i=0;i<theForm.elements.length;i++) {
		
		/*
		var fieldAttributes = theForm.elements[i].attributes;
		for(var j=0;j<fieldAttributes.length;j++) {
			alert(fieldAttributes[j].name);
		}
		*/
		
		//alert("Type = " + theForm.elements[i].type + "\nValue = " + theForm.elements[i].value + "\nLength = " + theForm.elements[i].length);
		
		//text
		if(theForm.elements[i].type == "text") {
			theForm.elements[i].value = "";
		}
		//select
		if(theForm.elements[i].type == "select-one") {
			theForm.elements[i].selectedIndex = 0;
		}
		//checkBox
		if(theForm.elements[i].type == "checkbox") {
			theForm.elements[i].checked = false;
		}
	}
}



//Initial setUp
setUpPage = function() {
	
	//alert ("settingUp!!");
	startList();
	startSubMenus();
	startIzqMenus("izqMenu_1");
	startIzqMenus("izqMenu_2");
	startCarousel();
} 

window.onload = setUpPage;




//Test expandable Menu
function testVars(currentSmenu,currentSize,targetSize) {
	
	var outPutVars = ""
	+ '<strong>EXPANDABLE MENU</strong><br />'
	+ '<strong>'
	+ 'currentSmenu=' + currentSmenu
	+ '<br />'
	+ 'currentSize=' + currentSize
	+ '<br />'
	+ 'targetSize=' + targetSize
	+ '<br />'
	+ '<br /></strong>';
	
	
	document.getElementById("testVars").innerHTML = outPutVars;

}

