
//Copyright (c), 2001, Innovagency

function NewWindow( sName, sUrl, iWidth, iHeight ) {
	var iLeft;
	var iTop;

	if ( screen.width > iWidth ) {
		iLeft = parseInt( ( screen.width - iWidth ) / 2 );
	} else {
		iLeft = 0
	}

	if ( screen.height > iHeight ) {
		iTop = parseInt( ( screen.height - iHeight ) / 2 );
	} else {
		iTop = 0
	}

	window.open( sUrl, sName, 'width=' + iWidth + ',height=' + iHeight + ',resizable=1,scrollbars=0,left=' + iLeft + ',top=' + iTop );
}

function NewWindowConfig( sName, sUrl, iWidth, iHeight, iResize, iScrollbar ) {
	var iLeft;
	var iTop;

	if ( screen.width > iWidth ) {
		iLeft = parseInt( ( screen.width - iWidth ) / 2 );
	} else {
		iLeft = 0
	}

	if ( screen.height > iHeight ) {
		iTop = parseInt( ( screen.height - iHeight ) / 2 );
	} else {
		iTop = 0
	}

	window.open( sUrl, sName, 'width=' + iWidth + ',height=' + iHeight + ',resizable=' + iResize + ',scrollbars=' + iScrollbar + ',left=' + iLeft + ',top=' + iTop );
}

function FormatWindow( sPathImg_IN, sNameImg_IN ) {
	if( sPathImg_IN == "" ) {
		window.close();
	} else {
		var oIm = document.all( sNameImg_IN );
		var iWidth = oIm.width + 90;
		var iHeight = oIm.height + 120;
		
		if( iWidth > 800 ) {
			iWidth = 800;
			oIm.width = iWidth - 90;
		}

		if( iHeight > 600 ) {
			iHeight = 600;
			oIm.height = iHeight - 120;
		}

		window.resizeTo( iWidth, iHeight );
		window.moveTo( ( ( screen.width - iWidth ) / 2 ), ( ( screen.height - iHeight ) / 2 ) );
	}
}

// ---------------------------------------------->

function obtemCodigoTecla(e)
{
	var cod;
	
	if (document.all){
		cod=e.keyCode;
	}else {
		cod=e.which;
	}

	if (Number(cod)==13){
		
		if (document.all){
			e.keyCode=0;
		}else {
			e.which=0;
		}
	}		

	return cod;
}

function validaNumerico(ev)
{
	var c=String.fromCharCode(obtemCodigoTecla(ev));
	var cAux = obtemCodigoTecla(ev);
	if (Number(cAux)==13){
		return true;
	}else{
		return false;
	}
}

// ---------------------------------------------->
// ---------------------------------------------->