// JavaScript Document
function abreParent(url) {	
	if (window.opener){
		window.opener.document.location = url;
		window.opener.focus();
		//return true;
	}else{
		//return false;
	}
}
/**
Funcion para abrir los pop up de la galerķa
**/
var nuevaVentana = null;
function pop_(swf, ancho, alto, con_scroll) {
	var dia = new Date();
	var id = dia.getTime();
	var name = "popGaleria"+id;             //Set window name 
	var opciones = "";                          //Set distance from bottom
	var url = swf;
	var left = 0;
	var top = 0;
	var w = ancho;
	var h = alto;
	var NS = (navigator.appName=="Netscape")?true:false;
	
	/** Centrar popup **/
	left = (screen.width - ancho) / 2;
    top = (screen.height - alto) / 2;
	if (nuevaVentana != null && !nuevaVentana.closed){
		nuevaVentana.close();
	}

	/** Abrir el popup **/
	aOpciones = new Array();
	aOpciones.push("fullscreen=no");
	aOpciones.push("toolbar=no");
	aOpciones.push("status=no");
	aOpciones.push("menubar=no");
	//alert(con_scroll);
	if (con_scroll == true){
		aOpciones.push("scrollbars=yes");
	}else{
		aOpciones.push("scrollbars=no");
	}
	aOpciones.push("resizable=no");
	aOpciones.push("directories=no");
	aOpciones.push("location=no");
	opciones = aOpciones.join(",", aOpciones);
	//opciones = "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no";
	
	opciones += ", width=" + w + ", height=" + h+ ", left=" + left + ", top=" + top;
//alert (url + "?newwin=true", name , opciones);
	nuevaVentana = window.open(url + "?newwin=true", name , opciones);
	nuevaVentana.focus();
}
/**
Funcion para escalar la ventana dependiendo de las dimensiones de la imagen
**/
function escalarVentana() {
	var NS = null;
	NS = (navigator.appName=="Netscape")?true:false;
	var iWidth = (NS)?window.innerWidth:document.body.clientWidth;
	var iHeight = (NS)?window.innerHeight:document.body.clientHeight;
	
	if(! document.images[0]){
		//alert("no hay imagen");
	} else{
		iWidth = document.images[0].width - iWidth;
		iHeight = document.images[0].height - iHeight;
		window.resizeBy(iWidth, iHeight);
		self.focus();
	}
	return;
}
