
	// Abre una popup centrada en la pantalla
	// parametros : 
	// -----------> URL_Ventana : url pagina 
	// -----------> OpcionesVentana : width, heigh, scroll etc (ver window.open())
	// -----------> Centrada : true or false
	// -----------> PosX, PosY : si centrada=false especifican las coordenadas de la ventana
	// --------------------------------------------------------------------------------------//
	function AbreVentana(URL_Ventana, OpcionesVentana, Ancho, Alto, Centrada, PosX, PosY) {

	if (Centrada) {
		PosX = (screen.availWidth)? ((screen.availWidth - Ancho)/2):20;
		PosY = (screen.availHeight)? ((screen.availHeight - Alto)/2):20;
		}
		
	if (OpcionesVentana == '')
		OpcionesVentana = 'width=' + Ancho;
	else
		OpcionesVentana += ',width=' + Ancho;

	OpcionesVentana += ',height=' + Alto + ',left=' + PosX
		+ ',top=' + PosY;
		
	return window.open(URL_Ventana, "", OpcionesVentana);
	
	}
	
	
	// cambia el tamaņo de una image (respetando proporciones)
	// parametros : 
	// -----------> Image : ref a la imagen que se quiere modificar 
	// -----------> max_ancho : ancho maximum
	// -----------> max_alto : alto maximum (si = 0 la image coje la anchura especificada y el alto se deduce)
	// ---------------------------------------------------------------------------------------------------------//
	function Cambia(image,max_ancho,max_alto)
	{
	
		//alert (image.width+" , "+image.height);
		
		if (image)
		{
			w=image.width;
			h=image.height;
			
			
			
			if (w > max_ancho) {
					ratio = w / max_ancho;
					w = max_ancho;
					h = h/ratio;
				}
				
			if (max_alto > 0) {
			
				if (h > max_alto) {
						ratio = h / max_alto;
						h = max_alto;
						w = w/ratio;

				}
				
			}else{
			
				if (w < max_ancho) {
					ratio = w / max_ancho;
					w = max_ancho;
					h = h/ratio;
				}	
					
			}
			
			if ((w == 0) || (h == 0) || (w == "") || (h == "")){
			    //alert ("settimeout");
				setTimeout("Cambia(" + image + "," + max_ancho + "," + max_alto + ")",2000);
			}else{
				image.width=w;
				image.height=h;
			}
			return false;
				
		}else{
			//alert ("miColeLib.js");
		}
	}