// JavaScript Document

//Retornar un objeto de tipo HttpRequest:
function obtenerXMLHTTPObject()

{
            var _xmlhttp;
            /*@cc_on @*//*@if (@_jscript_version >= 5)
            var idAX = ["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];

            for(var i=0; !_xmlhttp && i<idAX.length; i++)
            {
                        try
                        { 
                                   _xmlhttp = new ActiveXObject(idAX[i]);
                        }
                        catch(ex) 
                        { 
                                   _xmlhttp = false; 
                        }
            }@end @*/

            if (!_xmlhttp && typeof XMLHttpRequest!='undefined') 
            {           
               _xmlhttp = new XMLHttpRequest();
            } 
			
            return _xmlhttp;
}

 
//Funcion que parsea un codigo de error de HTTP
function parseErrorCode(theCode) {
	switch(theCode) {
    	case 404:
			return "Error Code 404 - File not found";
			break;
		case 403:
			return "Error Code 403 - Access Denied";                    
			break;
		case 500:
			return "Error Code 500 - Internal Server Error";
			break;
		default:
			return "Error Code "+theCode+" - Unknown error code";               
			break;
	}
}
 
//Función que arma un url a partir de una forma
function armarURL(form) {
	var retorno = form.action+"?";     
	var lista = form.getElementsByTagName("input");
		for(i=0;i<lista.length;i++) {
			if(lista[i].type != "submit" && lista[i].type != "image") {
				retorno+=lista[i].name+"="+escape(lista[i].value);
				if(i<lista.length-2) {
					retorno+="&";
				}
			}
		}
		lista = form.getElementsByTagName("select");
		for(i=0;i<lista.length;i++) {
				var combo = lista[i]
				if(combo.value != -1){
					retorno+=combo.name+"="+escape(combo[combo.selectedIndex].value);
					retorno+="&";
				}
				
		}
		
	return retorno;
}
