
function VerImagen(iIdImagen){

 var windowImagen;
 windowImagen = window.open("popup/popupimagen.asp?idimagen="+iIdImagen,"Imagen","width=100,height=100,top=10,left=10,scrollbars=yes,resizable=yes");

}

// -------------------------------- ESTADISTICAS: RESOLUCION ----------------------------
//--------------Función para obtener la resolución mediante la "carga" (llamada) de una página oculta
// En el GET no hace falta pasar la ruta completa de la página a llamar
function resolucion(iResolucion){
	var xmlHttp
	if (iResolucion == 0) {
		if (window.ActiveXObject){
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
			xmlHttp.open("GET", "resolucion.asp?resolucion="+screen.width+"*"+screen.height, false);
			xmlHttp.send();
		} else {
			xmlHttp = new XMLHttpRequest();
			xmlHttp.open("GET", "resolucion.asp?resolucion="+screen.width+"*"+screen.height, false);
			xmlHttp.send(null);
		}
	}
}

// En caso de que el navegador sea antiguo y no funcione el sistema anterior se usa la siguiente función para
// cambiar todos los enlaces de la página principal y poder obtener la resolución
function obtenerResolucionLinks(iResolucion) {
	if (iResolucion == 0){
		var i;
		var screenW = screen.width;
		var screenH = screen.height;
		var host = location.host;
		for (i=0;i<document.links.length;i++) {
			enlace = document.links[i].href;
			// Eliminar aquellos enlaces externos que, por lo tanto, no nos van a ayudar a obtener la resolución
			// eso lo hacemos mediante "host". Consideramos externo todo aquél enlace que no contenga "host"
			if ((enlace.indexOf("javascript") == -1)&&(enlace.indexOf(host) != -1)) {
				// además que no se añada a los enlaces "falsos" y a los que no tienen otros parámetros
				if ((enlace.indexOf("?") != -1)&&(enlace.indexOf("#") == -1)) {
					document.links[i].href=document.links[i].href+'&r='+screenW+'*'+screenH;
				}
			}
		}
	}
}

function inicio(iResolucion){
	resolucion(iResolucion);
	//window.alert(document.location.href);
	obtenerResolucionLinks(iResolucion);
}


function verImagen(iIdImagen){

 //Declaración de variables
 var sFichero = "";
 var windowImagen;

 //Para decidir si se abre uno u otro popup
 if(location.href.indexOf("alsaplus")!=-1){
  sFichero = "popupimagenap.asp";
 }else{
  sFichero = "popupimagen.asp";
 }

 windowImagen = window.open("../popup/"+sFichero+"?imagen="+iIdImagen+"&lang="+iIdioma,"Imagen","width=100,height=100,top=10,left=10,scrollbars=yes");

}

function abrirDocumento(iIdDocumento){
 //Declaración de variables
 var sFichero = "";
 var windowDocumento;

 //Para decidir si se abre uno u otro popup
 if(location.href.indexOf("alsaplus")!=-1){
  sFichero = "popupdocumentoap.asp";
 }else{
  sFichero = "popupdocumento.asp";
 }

 windowDocumento = window.open("../popup/"+sFichero+"?documento="+iIdDocumento+"&lang="+iIdioma,"Documento","width=800,height=900,top=10,left=10,scrollbars=yes,toolbar=yes,location=no,menubar=yes,resizable=yes");

}

function CargarContenido(iIdContenido){

 if(location.href.indexOf("IDR")!=-1){
  re1 = new RegExp("IDR=[0-9]*","gi");
  sTexto = location.href.replace(re1,"IDR="+iIdContenido);
 }else{
  sTexto = location.href+"&TR=C&IDR="+iIdContenido;
 }

 location.href=sTexto;

}
