function getXMLHTTPRequest() {
	var req;
	try {
		req = new XMLHttpRequest();
	} catch(err1) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (err2) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (err3) {
				req = false;
			}}}	return req;}
objhttp=getXMLHTTPRequest();	
	function  get(file,param,capadiv){
		capa = capadiv;
		x =parseInt(Math.random()*9999999999);
		mensaje="";
		archivo = file+"?x="+x+param; 		
		objhttp.open("GET", archivo, true);
		objhttp.send(null);
		objhttp.onreadystatechange=gestionaRespuesta;
	}	
	function gestionaRespuesta(){
		if(objhttp.readyState==4){
			if(objhttp.status==200){
				document.getElementById(capa).innerHTML = objhttp.responseText;
			}
		}else{
			document.getElementById(capa).innerHTML = mensaje;
		}
	}



function valores(f,cual) {
 var todos = new Array();
 var total = f[cual].length
 for (var i = 0; i < total; i++)
   if (f[cual][i].checked) 
   	todos[todos.length]=1;
   	else
   	todos[todos.length]=0;
  return todos.join("");
}
function valGeneral(e) {
    tecla = (document.all) ? e.keyCode : e.which;           
    if (tecla==193 || tecla==201 || tecla==205 || tecla==211 || tecla==218 || tecla==209) return true;
    if (tecla==225 || tecla==233 || tecla==237 || tecla==243 || tecla==250 || tecla==241) return true;
	if (tecla==32 || tecla==36) return true; // espacio	
	if (tecla>=42 && tecla<=47) return true; //  /*-+.
	
    patron =/[A-Za-z0-9]/; // Solo acepta letras
    te = String.fromCharCode(tecla);
    return patron.test(te);
}
function valTexto(e) {
    tecla = (document.all) ? e.keyCode : e.which;
    if (tecla==193 || tecla==201 || tecla==205 || tecla==211 || tecla==218 || tecla==209) return true;
    if (tecla==225 || tecla==233 || tecla==237 || tecla==243 || tecla==250 || tecla==241) return true;
    if (tecla==8) return true; //Tecla de retroceso (para poder borrar)
    if (tecla==32) return true;    
    patron =/[A-Za-z]/; // Solo acepta letras
    te = String.fromCharCode(tecla);
    return patron.test(te);
}
function valTextoSinEspacio(e) {
    tecla = (document.all) ? e.keyCode : e.which;	
    if (tecla==193 || tecla==201 || tecla==205 || tecla==211 || tecla==218 || tecla==209) return true;
    if (tecla==225 || tecla==233 || tecla==237 || tecla==243 || tecla==250 || tecla==241) return true;
    if (tecla==47 || tecla==46 || (tecla>=48 && tecla<=57)) return true;            
    patron =/[A-Za-z]/; // Solo acepta letras
    te = String.fromCharCode(tecla);
    return patron.test(te);
}
function valEntero(e) {
    tecla = (document.all) ? e.keyCode : e.which;
    if (tecla==8) return true; //Tecla de retroceso (para poder borrar)
	 patron = /\d/;
    te = String.fromCharCode(tecla);
    return patron.test(te);
}
function valReal(e) {
    tecla = (document.all) ? e.keyCode : e.which;
    if (tecla==8) return true; //Tecla de retroceso (para poder borrar)
	if (tecla==46) return true; // .
	 patron = /\d/;
    te = String.fromCharCode(tecla);
    return patron.test(te);
}
function click(e) {
	if (document.all) {
		if (event.button==2){
			window.status="www.e-rematan.com";
			return false;
		}
		
	}
	if (document.layers) {
		if (e.which==3){
			window.status="www.e-rematan.com";
			return false;
		}
	}
}
//if (document.layers) {
//document.captureEvents(Event.MOUSEDOWN);
//}
//document.onmousedown=click; 
//proper
function strTrim(str) {
var elem = document.getElementById(str).value;
document.getElementById(str).value = elem.replace(/^\s+|\s+$/g, '');
}
function strProperCase(str) {
var elem = document.getElementById(str).value;
document.getElementById(str).value = elem.toLowerCase().replace(/^(.)|\s(.)/g,function($1){return $1.toUpperCase();});
}
function TurnRow(id) {  
  fila = document.getElementById(id);
  fila.style.display = "";
}
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
function divShow(idDiv) {
div = document.getElementById(idDiv);
div.style.display="";
}
function divHide(idDiv) {
div = document.getElementById(idDiv);
div.style.display="none";
}
