// JavaScript Document
function abreOferta(ande){
	ancho=670;
	alto=350;
	ptop=parseInt((parseInt(screen.height)-alto)/2);
	pleft=parseInt((parseInt(screen.width)-ancho)/2);
	window.open(ande,"","top="+ptop+",left="+pleft+",width="+ancho+",height="+alto+",statusBar=no,resize=no,scrollbars=yes");
}

function abreRegistro(){
	if (parseInt(document.getElementById('formularioReg').style.height)==1 || isNaN(parseInt(document.getElementById('formularioReg').style.height)))
		document.getElementById('formularioReg').style.height="760px";
	else
		document.getElementById('formularioReg').style.height="1px";
}

function abreFicha(ande){
	ancho=670;
	alto=550;
	ptop=parseInt((parseInt(screen.height)-alto)/2);
	pleft=parseInt((parseInt(screen.width)-ancho)/2);
	window.open(ande,"","top="+ptop+",left="+pleft+",width="+ancho+",height="+alto+",statusBar=no,resize=no,scrollbars=yes");
}

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");
}

// Capa del Idioma
desplaza=5; //desplazamiento en pixels
velocidad=20; //milesegundos, mas tiempo=efecto mas lento
leftInicio=690;
leftActual=690; //el que cambia
leftFin=leftInicio-130; //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(){
	leftActual=leftActual-(desplaza*pande);
	document.getElementById('idioma').style.left=leftActual+"px";
	document.getElementById('idioma').style.width=60+(leftInicio-leftActual)+"px";
	if (pande==1){ //sube
		if (parseInt(document.getElementById('idioma').style.left)>leftFin)
			reloj=setTimeout('meneo()',velocidad);
		else {//parar
			document.getElementById('idioma').style.left=leftFin+"px";
			leftActual=leftFin;
			clearTimeout(reloj);
		}
	}else{ //baja
		if (parseInt(document.getElementById('idioma').style.left)<leftInicio)
			reloj=setTimeout('meneo()',velocidad);
		else { //parar
			document.getElementById('idioma').style.left=leftInicio+"px";
			leftActual=leftInicio;
			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";
	}
}

