// JavaScript Document
var numbers = '0123456789';
var numericKeys = '0123456789.';
var numericInteger='0123456789-';
var numericFloat='0123456789-.';
var smallDate='0123456789/';
var hourKeys='0123456789:';
var dateKeys = '0123456789./-';
var phoneKeys = '0123456789.+-()';
var emailKeys = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-@';
var er_email = /^(.+\@.+\..+)$/

function openWin(W,H,Page){
  window.open(Page,'_win' ,'width='+W+',height='+H+',top=10,left=250,scrollbars=yes,resizable=yes,toolbars=no,status=no');
}
function openWinName(W,H,Page,name){
  window.open(Page,name ,'width='+W+',height='+H+',top=10,left=250,scrollbars=yes,resizable=yes,toolbars=no,status=no');
}


/*funcion utilizada para cambiar las imagenes del menu a la que esta seleccionada.*/
var imgAnterior="";
var idAnterior="";
function cambiarImg(pId,pImgAnt,pImg){
	if(!idAnterior==""){
	   document.getElementById(idAnterior).src="../images/botones/"+imgAnterior;
    }
    document.getElementById(pId).src="../images/botones/"+pImg;
    imgAnterior=pImgAnt;
    idAnterior=pId;
}

/*funcion que se utiliza para limitar el maximo de caracteres de un textarea*/
  function textAreaLength(obj,num){
    if (obj.value.length >= num){
      obj.value = obj.value.substring(0,num);
    }
  }
/*funcion que valida que el caracter digitado se encuentre en una cadena determinada, si lo encuentra 
  se podra digitar dicho caracter, si no pues no se podra digitar.*/
  function validateKey(evt, validKeys){
	var charCode;
	if(evt.charCode){
		charCode=evt.charCode;
		if(!(validKeys.indexOf(String.fromCharCode(charCode)) >= 0)){
		    evt.preventDefault();
	    }
	}else{
		charCode=event.keyCode;
		evt.returnValue=validKeys.indexOf(String.fromCharCode(charCode)) >= 0;
	}
	//var charCode = (evt.charCode ) ? evt.charCode : event.keyCode
  }
  
function cambiar(pID,pValue){
 document.getElementById(pID).innerHTML=pValue;
}
function cambiar2(pID,pValue){
 pID.innerHTML=pValue;
}	
function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
//Funcion que limpia la lista en un detalle
function limpiaDetalle(){
  cambiar2(window.parent.document.getElementById('respu'),'');
  document.forma.action='about:blank';
  document.forma.target='myIframeDetail';
  document.forma.submit();
}
//funcion que hace un submit controlando la url y el target;
function filtra(pLink,pTarget){
  document.forma.action=pLink;
  document.forma.target=pTarget;
  document.forma.submit();
}

function concatenaHttp(pVar){
  if(pVar.value != ""){
    if(pVar.value.substring(0,7) != "http://"){
	  pVar.value="http://"+pVar.value;
	}
  }
}  