/* 
	JavaScript Document
*/



var altoUtil;
var anchoUtil;

/*--------------------------------------------------------------------------------------
		Abre unha nova ventana (void)
--------------------------------------------------------------------------------------*/

function novaJanela (paxina, nomeJanela, ancho, alto, haiScroll, posicion) {
	
	try{
		if (typeof ventanaPopUp.document == "object")ventanaFoto.close()
	}catch (e){
		
	}
	
	// Calculo dimenisóns da pantalla por si acaso queremos full
	var anchoPantalla = screen.width; altoPantalla = screen.height;
	
	if(ancho == 'full') ancho = anchoPantalla; if(alto == 'full') alto = altoPantalla;
	
	LeftPosition=(screen.width)?(screen.width-ancho)/2:100;
	TopPosition=(screen.height)?(screen.height-alto)/2:100;
		
	settings = 'width=' + ancho + ',height=' + alto + ',top=' + TopPosition +',left=' + LeftPosition + ', scrollbars=' + haiScroll +',location=no ,directories=no ,status=no ,menubar=no ,toolbar=no, resizable=no';

	ventanaPopUp = window.open(paxina,nomeJanela,settings);

} 

/*--------------------------------------------------------------------------------------
	Calcula espacio útil nunha dunha janela	e así podemos redimensionar adecuadamente sin
	problemas de barras de ferramentas e demáis
-----------------------------------------------------------------------------------------*/ 
function calculaInner(){
	
	if (window.innerHeight){
		//navegadores basados en mozilla
	
		altoUtil = window.innerHeight;
		anchoUtil = window.innerWidth;
	
	}else{
	
	//Navegadores basados en IExplorer, es que no tengo innerheight
	
		altoUtil = document.body.clientHeight;
		anchoUtil = document.body.clientWidth;
	
	}
}

/*--------------------------------------------------------------------------------------
	Redimensiona e centra unha janela
	OLLO!!!
	Os parámetros ancho e alto refirense á area de visualización, excluindo as barras de
	ferramentas demáis ostias
-----------------------------------------------------------------------------------------*/ 
function centrarJanela(ancho, alto){
	
	LeftPosition = (screen.width) ?(screen.width - ancho) / 2:100;
	TopPosition = (screen.height) ?(screen.height - alto)/ 2:100;	
	
	resizeTo(ancho,alto);
	moveTo(LeftPosition,TopPosition);
	
}
