/**
 * @package		GeoDatum
 * Proyecto	:	GeoDatum - Sistema de Información Territorial
 * Archivo 	: ajax.js
 *
 * @link http://www.siigsa.cl
 * @copyright 2007 - Patricio Cifuentes Ithal
 * @author Patricio Cifuentes Ithal <pcifuentes@siigsa.cl>
 * @since 04-06-2008
 * @version 1.0.2
 *
 * Archivo JS del manejo de Ajax
 *
 */

	/**
	 * Creacion del objeto Ajax
	 *
	 * @return object $xmlhttp
	 */
	function ObjAjax(){
		
		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;
			
	}

	
	/**
	 * Recorre formulario para los argumentos de tag del Ajax
	 *
	 * @return string $arg
	 */
	function recorreFormulario(n, _separador){
		
		if (_separador == "" || typeof(_separador)=="undefined") _separador = "&";
		
		var arg="";
		
		for (i=0;i<document.forms[n].length;i++){
			if (arg=="") arg=document.forms[n][i].name+"="+document.forms[n][i].value
			//else arg+="&"+document.forms[n][i].name+"="+document.forms[n][i].value
			else arg += _separador + document.forms[n][i].name+"="+document.forms[n][i].value
		}
		
		return arg;	
	
	}
