// JavaScript Document
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function abreVentana(url,ptop,pleft,ancho,alto){
	if (ptop==0 && pleft==0){ //centrarla
		ptop=parseInt((parseInt(screen.height)-alto)/2);
		pleft=parseInt((parseInt(screen.width)-ancho)/2);
	}
	window.open(url,"","top="+ptop+",left="+pleft+",width="+ancho+",height="+alto+",statusBar=no,resize=no,scrollbars=yes");
}

/* funciones para la capa del idioma */
desplaza=5; //desplazamiento en pixels
velocidad=20; //milesegundos, mas tiempo=efecto mas lento
altoInicio=13;
altoActual=13; //el que cambia
altoFin=60; //por los idioma
var pande=1; //suma height
function abre(){
	pande=1;
	reloj=setTimeout('meneo()',velocidad);
}
function cierra(){
	pande=-1;
	reloj=setTimeout('meneo()',velocidad);
}
function meneo(){
	altoActual=altoActual+(desplaza*pande);
	document.getElementById('idioma').style.height=altoActual+"px";
	if (pande==1){ //sube
		if (parseInt(document.getElementById('idioma').style.height)<altoFin)
			reloj=setTimeout('meneo()',velocidad);
		else {//parar
			document.getElementById('idioma').style.height=altoFin+"px";
			altoActual=altoFin;
			clearTimeout(reloj);
		}
	}else{ //baja
		if (parseInt(document.getElementById('idioma').style.height)>altoInicio)
			reloj=setTimeout('meneo()',velocidad);
		else { //parar
			document.getElementById('idioma').style.height=altoInicio+"px";
			altoActual=altoInicio;
			clearTimeout(reloj);
		}
	}
}

/*
// Capa del Idioma
desplaza=5; //desplazamiento en pixels
velocidad=20; //milesegundos, mas tiempo=efecto mas lento
anchoInicio=87;
anchoActual=87; //el que cambia
anchoFin=300; //por los idioma
var pande=1; //suma height
function abre(){
	pande=1;
	reloj=setTimeout('meneo()',velocidad);
}
function cierra(){
	pande=-1;
	reloj=setTimeout('meneo()',velocidad);
}
function meneo(){
	anchoActual=anchoActual+(desplaza*pande);
	document.getElementById('idioma').style.width=anchoActual+"px";
	if (pande==1){ //sube
		if (parseInt(document.getElementById('idioma').style.width)<anchoFin)
			reloj=setTimeout('meneo()',velocidad);
		else {//parar
			document.getElementById('idioma').style.width=anchoFin+"px";
			anchoActual=anchoFin;
			clearTimeout(reloj);
		}
	}else{ //baja
		if (parseInt(document.getElementById('idioma').style.width)>anchoInicio)
			reloj=setTimeout('meneo()',velocidad);
		else { //parar
			document.getElementById('idioma').style.width=anchoInicio+"px";
			anchoActual=anchoInicio;
			clearTimeout(reloj);
		}
	}
}*/

// funciones del menu izquierdo
altoMenu=16;
altoMenuFin=altoMenu;
ultMenu=0;
fondocapa="#E2DAB9";
velocidad2=10; //milesegundos, mas tiempo=efecto mas lento
desplaza2=8; //desplazamiento en pixels
function verSub(ese,cuantos){
	if (ultMenu!=0)
		cierraSub();
	if (ultMenu==ese){
		cierraSub();
		ultMenu=0;
	}else{
		altoMenuFin=(cuantos+1)*altoMenu;
		ultMenu=ese;
		pande=1;
		document.getElementById('capa'+ultMenu).style.height=altoMenu; //inicial
		document.getElementById('capa'+ultMenu).style.backgroundColor=fondocapa; //fondo inicial
		document.getElementById('link'+ultMenu).className="menuMarcado"; //marcado
		reloj=setTimeout('meneoMenu()',velocidad2);
	}
	//document.getElementById('capa'+ese).style.height=((cuantos+1)*altoMenu)+"px";
}
function cierraSub(){
	document.getElementById('capa'+ultMenu).style.height=altoMenu+"px";
	document.getElementById('link'+ultMenu).className="tipoMenu"; //desmarcado
}
function meneoMenu(){
	document.getElementById('capa'+ultMenu).style.height=parseInt(document.getElementById('capa'+ultMenu).style.height)+(desplaza2*pande)+"px";
	if (pande==1){ //sube
		if (parseInt(document.getElementById('capa'+ultMenu).style.height)<altoMenuFin)
			reloj=setTimeout('meneoMenu()',velocidad2);
		else //parar
			document.getElementById('capa'+ultMenu).style.height=altoMenuFin+"px";
	}else{ //baja
		if (parseInt(document.getElementById('capa'+ultMenu).style.height)>altoMenu)
			reloj=setTimeout('meneoMenu()',velocidad2);
		else //parar
			document.getElementById('capa'+ultMenu).style.height=altoMenu+"px";
	}
}

var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);

document.onmousemove = posicRatonXY;
var posicX = 0;
var posicY = 0;
var sigueme=false;
function posicRatonXY(e) {
	if (IE) { 
		posicX = event.clientX + document.documentElement.scrollLeft;
		posicY = event.clientY + document.documentElement.scrollTop;
	}else{
		posicX = e.pageX;
		posicY = e.pageY;
	}
	if (posicX < 0) {posicX = 0};
	if (posicY < 0) {posicY = 0};
	if (sigueme){ //pa mover la capilla
		document.getElementById('capilla').style.top=(posicY+3)+"px";
		document.getElementById('capilla').style.left=(posicX+14)+"px";
	}
}


function ponEti(miTexto){
	document.getElementById('capilla').innerHTML=miTexto;
	document.getElementById('capilla').style.top=(posicY+3)+"px";
	document.getElementById('capilla').style.left=(posicX+14)+"px";
	document.getElementById('capilla').style.visibility='visible';
	sigueme=true;
}
function quitaEti(){
	document.getElementById('capilla').style.visibility='hidden';	
	sigueme=false;
}

function dameTop(obj){
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent)
		{
		curtop += obj.offsetTop;
		obj = obj.offsetParent;
		}
	}else if (obj.y){
		curtop += obj.y;
	}
	return curtop;
}
function dameLeft(obj){
	var curLeft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent)
		{
		curLeft += obj.offsetLeft;
		obj = obj.offsetParent;
		}
	}else if (obj.x){
		curLeft += obj.x;
	}
	return curLeft;
}
