/********************************************/
/*				funciones.js	     		*/
/*  		Autor: Alex cáceres 			*/
/********************************************/


function showTip(str){
	document.getElementById('tooltip').innerHTML=str;
	document.getElementById('tooltip').style.display="block";
	
}
function hideTip(str){
	document.getElementById('tooltip').innerHTML=str;
	document.getElementById('tooltip').style.display="none";
}
function showCalendar(){
	document.getElementById('calendario').style.display="block";
	document.getElementById('calendarioon').style.display="none";
	document.getElementById('calendariooff').style.display="block";
}
function hideCalendar(){
	document.getElementById('calendario').style.display="none";
	document.getElementById('calendariooff').style.display="none";
	document.getElementById('calendarioon').style.display="block";
}

function cerrar(){
	if(window.opener && !window.opener.closed){
		window.opener.location.href="http://www.alternatura.es";
		window.close();
	}else
		window.location.href="http://www.alternatura.es";
}


//Alex fullpopup 2.0 compatible mozilla

function popUp(url,w,h){
	x=(screen.width-w)/2;
	y=(screen.height-h)/2;
	ventana=window.open(url,'popup','width='+w+',height='+h+',left='+x+',top='+y+',location=no,scrollbars=no,resize=no,status=no');
	//la doy foco
	ventana.focus();
}
function legal(){
	w=1020;
	h=500;
	url="../textolegal/index.php";
	x=(screen.width-w)/2;
	y=(screen.height-h)/2;
	ventana=window.open(url,'popup','width='+w+',height='+h+',left='+x+',top='+y+',location=no,scrollbars=yes,resize=no,status=no');
	//la doy foco
	ventana.focus();
}
function comollegar(){
	w=724;
	h=634;
	url="comollegar.php";
	x=(screen.width-w)/2;
	y=(screen.height-h)/2;
	ventana=window.open(url,'comollegar','width='+w+',height='+h+',left='+x+',top='+y+',location=no,scrollbars=no,resize=no,status=no');
	//la doy foco
	ventana.focus();
}
function pago(){
	w=1020;
	h=500;
	url="../formasdepago/index.php";
	x=(screen.width-w)/2;
	y=(screen.height-h)/2;
	ventana=window.open(url,'popup','width='+w+',height='+h+',left='+x+',top='+y+',location=no,scrollbars=yes,resize=no,status=no');
	//la doy foco
	ventana.focus();
}
function niveles(id){
	w=1020;
	h=500;
	url="../niveles/nivel.php?id="+id;
	x=(screen.width-w)/2;
	y=(screen.height-h)/2;
	ventana=window.open(url,'niveles','width='+w+',height='+h+',left='+x+',top='+y+',location=no,scrollbars=yes,resize=no,status=no');
	//la doy foco
	ventana.focus();
}
function nivel(id,idf,idt){
	w=1020;
	h=500;
	url="../niveles/nivel.php?id="+id+"&idf="+idf+"&idt="+idt;
	x=(screen.width-w)/2;
	y=(screen.height-h)/2;
	ventana=window.open(url,'niveles','width='+w+',height='+h+',left='+x+',top='+y+',location=no,scrollbars=yes,resize=no,status=no');
	//la doy foco
	ventana.focus();
}
function redim(w,h){
		proporcion=w/h;
		
		ini=w/100;
		for(i=ini;i<w;i+=10){
		  if(i>ini)
		  	window.focus();
		  j=i/proporcion;
		  moveTo((screen.width-i)/2,(screen.height-j)/2);
		  
		  idInt=setInterval(vacio,1000);
		  resizeTo(i,j);
		}
		//finalizo
		resizeTo(w+12,h+63);
		clearInterval(idInt);
	}
	
function zoom(id){
		
		w=700;
		h=450;
		x=(screen.width-w)/2;
		y=(screen.height-h)/2;
		popup=window.open('zoom.php?id='+id,'zoom','width='+w+',height='+h+',top='+y+',left='+x+',scrollbars=0,resizable=0,toolbar=0,location=0, status=0');
		popup.focus();
}

function mapa(){
		
		w=780;
		h=550;
		x=(screen.width-w)/2;
		y=(screen.height-h)/2;
		popup=window.open('mapa.php','map','width='+w+',height='+h+',top='+y+',left='+x+',scrollbars=0,resizable=0,toolbar=0,location=0, status=0');
		popup.focus();
}

function zoomAux(id){
		
		w=700;
		h=450;
		x=(screen.width-w)/2;
		y=(screen.height-h)/2;
		popup=window.open('../galerias/zoom.php?id='+id,'zoom','width='+w+',height='+h+',top='+y+',left='+x+',scrollbars=0,resizable=0,toolbar=0,location=0, status=0');
		popup.focus();
}


function enviarAmigo(){
		
		w=500;
		h=400;
		x=(screen.width-w)/2;
		y=(screen.height-h)/2;
		popup=window.open('../enviaraunamigo/index.php','zoom','width='+w+',height='+h+',top='+y+',left='+x+',scrollbars=0,resizable=0,toolbar=0,location=0, status=0');
		popup.focus();
}

function fotozoom(id){
		
		w=502;
		h=402;
		x=(screen.availWidth-w)/2;
		y=(screen.availHeight-h)/2;
		popup=window.open('fotozoom.php?id='+id,'fotozoom','width='+w+',height='+h+',top='+y+',left='+x+',scrollbars=0,resizable=0,toolbar=0,location=0, status=0');
		popup.focus();
}

function inm(){
		
		w=703;
		h=510;
		x=(screen.width-w)/2;
		y=(screen.height-h)/2;
		popup=window.open('http://www.inm.es/cgi-bin/locali.cgi?ig=19159','inm','width='+w+',height='+h+',top='+y+',left='+x+',scrollbars=0,resizable=0,toolbar=0,location=0, status=0');
		popup.focus();
}


//Alex rollOver 2.0
function over(id){
	on=document.getElementById(id).src;
	document.getElementById(id).src=on.replace("off.gif","over.gif");
}

//Alex rollOut 2.0
function out(id){
	off=document.getElementById(id).src;
	document.getElementById(id).src=off.replace("over.gif","off.gif");
}

//Alex div rollOver 1.1
function divover(id){
	if(id.lastIndexOf('submenu')!=-1)
		document.getElementById(id).style.backgroundImage="url(../img/comun/bgbotonover.gif)";
}

//Alex div rollOut 1.1
function divoff(id){
	if(id.lastIndexOf('submenu')!=-1)
		document.getElementById(id).style.backgroundImage="url(../img/comun/bgbotonoff.gif)";
}

function divbotover(id){
	if(id.lastIndexOf('boton')!=-1)
		document.getElementById(id).style.backgroundImage="url(../img/comun/bgbotonover.gif)";
}

//Alex div rollOut 1.1
function divbotoff(id){
	if(id.lastIndexOf('boton')!=-1)
		document.getElementById(id).style.backgroundImage="url(../img/comun/bgbotonoff.gif)";
}

function divbotthover(id){
	if(id.lastIndexOf('botth')!=-1)
		document.getElementById(id).style.backgroundImage="url(../img/comun/bgbotthover.gif)";
}

//Alex div rollOut 1.1
function divbotthoff(id){
	if(id.lastIndexOf('botth')!=-1)
		document.getElementById(id).style.backgroundImage="url(../img/comun/bgbotthoff.gif)";
}

var t;
function show(id){
		document.getElementById(id).style.display="block";
		clearTimeout(t);
}
function hide(id){
		var str="document.getElementById('"+id+"').style.display='none'";
		t=setTimeout(str,100);
}

function vacio(){
	//para hacer pausa	
}
