function submitFormOld(strNombreForm){
	var o = document.forms;
	for ( var i=0; i < o.length; i++ ) {
		if ( o[i].id == strNombreForm ) {
			o[i].submit();
		}
	}
}

function submitFormOld2(strNombreForm){
	/* Dado un Formulario realiza el Submit del mismo */
	var strNombreCompleto;
	strNombreCompleto = strNombreForm + '.submit();';
	eval(strNombreCompleto);
}

function submitForm(strNombreForm) {
	var oFrm;
	oFrm=findObj2(strNombreForm, document);
	oFrm.submit();
}

function findObj2(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj2(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function VentanaPopup(strUrlPagina, strNombre, intAncho, intAlto, strScroll) {
	/* Abre una ventana centrada en formato PupUp*/	
	var intIzquierda = ((screen.width  - intAncho) / 2);
	var intArriba    = ((screen.height - intAlto ) / 2);
	window.open(strUrlPagina, strNombre, 'width=' + intAncho + ', height=' + intAlto + ', left=' + intIzquierda + ', top=' + intArriba + ', scrollbars=' + strScroll);
}

function cerrarVentana(){
	/* Cierra la Ventana Actual*/
	window.close();
}


function TextBoxSetText(strNombreForm, strNombreTextBox, strTexto){
	/* Esta Funcion setea el Indice de un Combo.
	 	Funciona en IE 6.0, 5.5, 5.0
	 	Funciona en NN 6.x
		Funciona en NN 4.75		
	   Obs: document.all[NombreCombo].selectedIndex = Indice; // anda en IE
	*/
	var strVariable;
	strVariable = 'document.' + strNombreForm + '.' + strNombreTextBox + '.value = \'' + strTexto + '\';';
//	alert(strVariable );
	eval(strVariable);
}

function AbrirVentanaMaximizada(strRuta, strNombre, intResta){
	var intMaxHeight, intMaxWidth;
		
	intMaxHeight	= screen.availHeight;
	intMaxWidth		= screen.availWidth;

	window.open(strRuta, '', 'width=' + intMaxWidth + ', height=' + (intMaxHeight - intResta) + ', toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, top=0, left=0');
}

function MaximizarVentana(){
	top.window.moveTo(0,0);
	if (document.all) {
		top.window.resizeTo(screen.availWidth, screen.availHeight);
	}else{
		if (document.layers||document.getElementById){
			if ((top.window.outerHeight < screen.availHeight) || (top.window.outerWidth < screen.availWidth)){
				top.window.outerHeight = screen.availHeight;
				top.window.outerWidth = screen.availWidth;
			}
		}
	}
}

function DesocultarObjeto(nr) {
	if (document.layers)
	{
		document.layers[nr].display = 'block';
	}
	else if (document.all)
	{
		document.all[nr].style.display = 'block';
	}
	else if (document.getElementById)
	{
		document.getElementById(nr).style.display = 'block';
	}
}

function OcultarObjeto(nr) {
	if (document.layers)
	{
		document.layers[nr].display = 'none';
	}
	else if (document.all)
	{
		document.all[nr].style.display = 'none';
	}
	else if (document.getElementById)
	{
		document.getElementById(nr).style.display = 'none';
	}
}

function RestrictLength(ofield, intLength, strMensajeError) {
	if (ofield.value.length > intLength-1){
		ofield.value = ofield.value.substring(0, intLength-1);
		if (strMensajeError.length>0){
			alert(strMensajeError);
		}
	}
}