	function popWindow(page,browser,h,w) {
		winW = (screen.width - w) / 2
		winH = (screen.height - h) / 2		

		window.open(page,browser, "scrollbars=0,titlebar=0,menubar=0,toolbar=0,location=0,directories=0,statusbar=0,resizable=0,width=" + w + ",height=" + h + ",left=" + winW + ",top=" + winH);

	}

	function popWindow_print(page,browser,h,w) {
		winW = (screen.width - w) / 2
		winH = (screen.height - h) / 2		

		window.open(page,browser, "scrollbars=0,titlebar=1,menubar=0,toolbar=0,location=0,directories=0,statusbar=1,resizable=1,width=" + w + ",height=" + h + ",left=" + winW + ",top=" + winH);

	}

	function popWindow_debug(page,browser,h,w) {
		winW = (screen.width - w) / 2
		winH = (screen.height - h) / 2		

		window.open(page,browser, "scrollbars=1,titlebar=0,menubar=1,toolbar=1,location=0,directories=0,statusbar=1,resizable=1,width=" + w + ",height=" + h + ",left=" + winW + ",top=" + winH);

	}

	function popWindow_scroll(page,browser,h,w) {
		winW = (screen.width - w) / 2
		winH = (screen.height - h) / 2		

		window.open(page,browser, "scrollbars=1,titlebar=0,menubar=0,toolbar=0,location=0,directories=0,statusbar=0,resizable=0,width=" + w + ",height=" + h + ",left=" + winW + ",top=" + winH);

	}

	function ordenarListado(cad) {
		var aux = window.location
		aux = replace(aux,"ORDER=","x=")
		aux = aux + "&ORDER=" + cad	
		window.location = aux
	}

	function toHex(dec) {
		var hexCharacters = "0123456789ABCDEF"
		if (dec < 0)
			return "00"
		if (dec > 255)
			return "FF"
		var i = Math.floor(dec / 16)
		var j = dec % 16
		return hexCharacters.charAt(i) + hexCharacters.charAt(j)
	}

	function setbgColor(red, green, blue) {
		document.bgColor = "#" + toHex(red) + toHex(green) + toHex(blue)
	}

	function fade(sred, sgreen, sblue, ered, egreen, eblue, step) {
		for(var i = 0; i <= step; ++i) {
			var red = Math.floor(sred * ((step - i) / step) + ered * (i / step))
			var green = Math.floor(sgreen * ((step - i) / step) + egreen * (i / step))
			var blue = Math.floor(sblue * ((step - i) / step) + eblue * (i / step))
			setbgColor(red, green, blue)
		}
	}
	
	
	var InternalImg = new Image()
	var InternalImagen, InternalTexto, InternalTitulo

	function ShowBrowser(imagen, texto, titulo) {
	
		InternalImg.src = imagen
		InternalImagen  = imagen
		InternalTexto   = texto
		InternalTitulo  = titulo
		InternalImg.onload=ShowIt
		return true;
	}
	
	function ShowIt() {
		winW = (screen.width - InternalImg.width) / 2
		winH = (screen.height - InternalImg.height) / 2
		
		imgW = InternalImg.width
		imgH = InternalImg.height + 21
		
		if (InternalTexto!="") imgH += 50

//		alert(winW + " " + winH + " " + imgW + " " + imgH)

		window.open("foto.php?imagen=" + InternalImagen + "&titulo=" + InternalTitulo + "&texto=" + InternalTexto, "browser", "scrollbars=0,titlebar=0,menubar=0,toolbar=0,location=0,directories=0,statusbar=0,resizable=0,width=" + imgW + ",height=" + imgH + ",left=" + winW + ",top=" + winH)
		return true;
	}

