// xGetElementById r2, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xGetElementById(e)
{
  if(typeof(e)=='string') {
    if(document.getElementById) e=document.getElementById(e);
    else if(document.all) e=document.all[e];
    else e=null;
  }
  return e;
}

function muestra(capa,estado) {
  var d, e;
  e = xGetElementById(capa);
  if (estado=='on') d = 'block'
  else  d = 'none';
  e.style.display = d;
}

function dimensiona (elemento,margen) {
	var lista
	var altura=document.body.clientHeight;
	lista=document.getElementById(elemento);
	lista.style.height= (altura-margen);
}

///////////////////////////////////////////////////////////////////////
function ValidarTodo (miForm)
{

  var arrElem=miForm.elements;
  var tipo=arrElem[0].type;
  var error=false;
  var i=0;
  var valor="";
  do{
	tipo=arrElem[i].type;
	if ((tipo=="text")||(tipo=="password")||(tipo=="textarea"))
	   { valor=arrElem[i].value;
	     do 
	        {
			  //alert(i+"/"+valor)
			  valor=valor.replace ("'","´")
	         } while (valor.search("'")!=-1);
		 arrElem[i].value=valor;
		}
  	i++; 	
	}
   while (i<arrElem.length);
return(true);
}

/*
function chequeaCheck (miForm,cadena)
{
  var arrElem=miForm.all[cadena];
  var i=0;
  if (isNaN(arrElem.length))
    { if (arrElem.checked) return (true)
     }
  else
    { do{
	if (arrElem[i].checked) return (true)
	i++; 	
	}
      while (i<arrElem.length);
     }
return(false);
}
*/

function preQuery (valor){
	var salida="";
	if (valor!="") {
	var valor1= valor.replace(' ','+');
	var valor2= escape(valor1);
	salida=valor2;
	}
	
	return(salida);
}

function ilumina (objeto,color,id){
	objeto.style.background= color;
}
