var ventana_foto=null;
var central_reservas=null;
var ventana_foto=null;
var array_nombre_recomendados= new Array();
var array_enlaces=new Array();
var indice=0;
var contador=0;
var ultimo_indice=0;
var ventana_tienda=null;

function abrirFoto(ruta,id,ruta_absoluta){		
	//se envía:
		//ruta de la imagen desde el raiz
		//ruta absoluta para llamar al cuadro_foto
		//el id de la imagen
		
			if(ventana_foto !=null){
				ventana_foto.close();
				ventana_foto=null;
			}//la cierro si está abierta
			ventana_foto=window.open("","foto","width=600,height=370");
			ventana_foto.document.location.href=ruta_absoluta+"comunes/inc/cuadro_foto.php?id="+id+"&ruta="+ruta;		
		
}//funcion en la que se abre la foto de la galería de la izquierda para agrandarse	


function limpiar(elemento){
	if (elemento){
		elemento.value = "";
		return false;
	}else{
		return false;
	}
}

function abrirCentralReservas(ruta_absoluta){
	
			if(central_reservas !=null){
				central_reservas.close();
				central_reservas=null;
			}//la cierro si está abierta
			
			central_reservas=window.open("","foto","width=800,height=730,scrollbars=yes,resizable=no,titlebar=no,toolbar=no,");
			central_reservas.document.location.href=ruta_absoluta+"central_reservas/includes/reservas.php";		

}

	function abrirCarrito(id,ruta_absoluta){
		
		if(ventana_tienda !=null){
			ventana_tienda.close();
			ventana_tienda=null;
		}//cierro la ventana si está abierta
		ventana_tienda=window.open("","encuesta","width=670,height=600,scrollbars=1"); //
			
			//alert(ruta_absoluta);
			
			if(id){
				//if(pack){
				//	ventana_tienda.document.location.href=ruta_absoluta+"carrito.php?pack="+ pack +"&id="+ id+"&ruta_absoluta="+ruta_absoluta;					
				//}//si se ha pillao el pack
				//else{
					ventana_tienda.document.location.href=ruta_absoluta+"carrito/carrito.php?id="+ id+"&ruta_absoluta="+ruta_absoluta;					
				//}//si no se ha pillao el pack
			}//SI LE QUIERO AÑADIR ALGO
			else{
				ventana_tienda.document.location.href=ruta_absoluta+"carrito.php?ruta_absoluta="+ruta_absoluta;	
			}//SI SOLO LO QUIERO VER
			
	}//funcion en la que se abre en una nueva ventana la gestion del carrito
	// FUNCIONES PARA PINTAR EL CAMBIO DE IMAGEN ALEATORIO

function cargo_array(indice,valor,enlace){	
		array_nombre_recomendados[indice]=valor;
		array_enlaces[indice]=enlace;
		ultimo_indice=indice;
		
	}//función para cambiar los arrays con los datos


function abrir_ventana(archivo, nombre,ancho,alto,ruta_absoluta){	
	window.open(ruta_absoluta+"/"+archivo,nombre,"width="+ancho+",height="+alto);
	//return false;
}
function temporizador(){
	setTimeout("cambia_foto()",0);
	setInterval("cambia_foto()",5000);
}

function cambia_foto(){
		//alert(array_nombre_recomendados[contador]) ;
		if(ultimo_indice < contador){
			contador=0;
			document.getElementById("banner_inferior").alt="JULIO ALBERTO";
			document.getElementById("banner_inferior").src="http://www.mundopc.es/desarrollo/pbjulioalberto/udecontrol_datos/banners/" +  array_nombre_recomendados[contador] + ".jpg";
			document.getElementById("enlace_banner_inferior").href="http://"+array_enlaces[contador];			
			contador++;
		}
		else{
			document.getElementById("banner_inferior").alt="JULIO ALBERTO";
			document.getElementById("banner_inferior").src="http://www.mundopc.es/desarrollo/pbjulioalberto/udecontrol_datos/banners/" +  array_nombre_recomendados[contador] + ".jpg";
			document.getElementById("enlace_banner_inferior").href="http://"+array_enlaces[contador];
			contador++;
		//si todavia no ha llegado al valor del indice maximo*/
		}
	}	
/*function tamano_body(){
	var altura = document.height;
	var capa= document.getElementById("publi_trofeops");
	//alert(screen.height);
	capa.style.height=altura+"px";
	capa.style.width="100%";
	
}*/