function GDOM() {
	var ua, s, i;
	this.$ = function(param1, param2) {
		var idname, domnode;
		if (typeof param1 === "string") {
			idname = param1;
			domnode = document;
		} else {
			domnode = param1;
			idname = param2;
		}
		return domnode.getElementById(idname);
	};
	this.$$ = function(param1, param2, param3) {
		var name, domnode, posicion;
		if (typeof param1 === "string") {
			name = param1;
			posicion = param2;
			domnode = document;
		} else {
			domnode = param1;
			name = param2;
			posicion = param3;
		}
		if (posicion !== undefined) {
			return domnode.getElementsByName(name)[posicion];
		}
		return domnode.getElementsByName(name);
	};
	this.$$$ = function(param1, param2, param3) {
		var tagname, domnode, posicion;
		if (typeof param1 === "string") {
			tagname = param1;
			posicion = param2;
			domnode = document;
		} else {
			domnode = param1;
			tagname = param2;
			posicion = param3;
		}
		if (posicion !== undefined) {
			return domnode.getElementsByTagName(tagname)[posicion];
		}
		return domnode.getElementsByTagName(tagname);
	};
	this.isIE = false;
	this.isNS = false;
	this.isOP = false;
	this.isSA = false;
	this.isCH = false;
	this.version = null;
	ua = navigator.userAgent;
	s = "MSIE";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isIE = true;
		this.version = parseFloat(ua.substr(i + s.length));
	} else {
		s = "Netscape6/";
		if ((i = ua.indexOf(s)) >= 0) {
			this.isNS = true;
			this.version = parseFloat(ua.substr(i + s.length));
		} else {
			s = "Netscape/8";
			if ((i = ua.indexOf(s)) >= 0) {
				this.isNS = true;
				this.version = 8;
			} else {
				s = "Firefox";
				if ((i = ua.indexOf(s)) >= 0) {
					this.isNS = true;
					this.version = parseFloat(ua.substr(i + s.length));
				} else {
					s = "Opera";
					if ((i = ua.indexOf(s)) >= 0) {
						this.isIE = true;
						this.version = parseFloat(ua.substr(i + s.length));
					} else {
						s = "Chrome";
						if ((i = ua.indexOf(s)) >= 0) {
							this.isCH = true;
						} else {
							s = "Safari";
							if ((i = ua.indexOf(s)) >= 0) {
								this.isSA = true;
							} else {
								s = "Gecko";
								if ((i = ua.indexOf(s)) >= 0) {
									this.isNS = true;
								} else {
									this.isIE = true;
								}
							}
						}
					}
				}
			}
		}
	}
	this.hide = function(id, tipo) {
		if (tipo) {
			switch (tipo) {
			case "ID":
				this.$(id).style.display = "none";
				break;
			case "NAME":
				var elementos = this.$$(id);
				for ( var i = 0; i < elementos.length; i++) {
					elementos[i].style.display = "none";
				}
				break;
			case "TAG":
				var elementos = this.$$$(id);
				for ( var i = 0; i < elementos.length; i++) {
					elementos[i].style.display = "none";
				}
				break;
			}
		} else {
			this.$(id).style.display = "none";
		}
	};
	this.show = function(id, modo, tipo) {
		if (!modo) {
			modo = "inline";
		}
		if (tipo) {
			switch (tipo) {
			case "ID":
				this.$(id).style.display = modo;
				break;
			case "NAME":
				var elementos = this.$$(id);
				for ( var i = 0; i < elementos.length; i++) {
					elementos[i].style.display = modo;
				}
				break;
			case "TAG":
				var elementos = this.$$$(id);
				for ( var i = 0; i < elementos.length; i++) {
					elementos[i].style.display = modo;
				}
				break;
			}
		} else {
			this.$(id).style.display = modo;
		}
	};
	this.getposxy = function(event) {
		var x = 0, y = 0;
		if (this.isIE) {
			x = window.event.clientX + document.documentElement.scrollLeft
					+ document.body.scrollLeft;
			y = window.event.clientY + document.documentElement.scrollTop
					+ document.body.scrollTop;
		} else {
			x = event.clientX + window.scrollX;
			y = event.clientY + window.scrollY;
		}
		var mousepos = new Array(2);
		mousepos[0] = x;
		mousepos[1] = y;
		return mousepos;
	};
	this.showTime = function(id, tiempo, modo, tipo) {
		this.show(id, modo, tipo);
		setTimeout("Goaamb.Dom.hide('" + id + "','" + tipo + "')", tiempo);
	};
	this.move = function(id, x, y) {
		this.$(id).style.position = "absolute";
		this.$(id).style.left = x + "px";
		this.$(id).style.top = y + "px";
	};
	this.moveInc = function(id, ix, iy) {
		this.$(id).style.position = "absolute";
		this.$(id).style.left = (parseInt(this.$(id).style.left) + ix) + "px";
		this.$(id).style.top = (parseInt(this.$(id).style.top) + iy) + "px";
	};
	this.create = function(tag) {
		return document.createElement(tag);
	};
	this.createText = function(text) {
		return document.createTextNode(text);
	};
	this.getKey = function(ev) {
		if (this.isIE) {
			return ev.keyCode;
		}
		return ev.which;
	};
	this.getStartEndSelection = function(idcapa) {
		var campotexto = this.$(idcapa);
		if (campotexto) {
			var retorno = new Array(2);
			if (this.isIE) {
				var range = document.selection.createRange();
				var stored_range = range.duplicate();
				if (campotexto.innerHTML !== "") {
					stored_range.moveToElementText(campotexto);
					stored_range.setEndPoint('EndToEnd', range);
				}
				if (campotexto.type === "text") {
					stored_range.moveStart('character',
							-campotexto.value.length);
					stored_range.setEndPoint('EndToStart', range);
				}
				campotexto.selectionStart = stored_range.text.length
						- range.text.length;
				campotexto.selectionEnd = campotexto.selectionStart
						+ range.text.length;
			}
			retorno[0] = campotexto.selectionStart;
			retorno[1] = campotexto.selectionEnd;
			return retorno;
		}
		return null;
	};
	this.showorhide = function(id, modo) {
		var elem = this.$(id);
		if (elem.style.display === "none") {
			this.show(id, modo);
		} else {
			this.hide(id);
		}
	};
	this.setStartEndSelection = function(idcapa, inicio, ultimo) {
		var campotexto = this.$(idcapa);
		if (campotexto) {
			if (this.isIE) {
				var range = document.selection.createRange();
				var stored_range = range.duplicate();
				if (campotexto.innerHTML !== "") {
					stored_range.moveToElementText(campotexto);
					stored_range.setEndPoint('EndToEnd', range);
				}
				if (campotexto.type === "text") {
					stored_range.moveStart('character',
							-campotexto.value.length);
					stored_range.setEndPoint('EndToStart', range);
				}
			} else {
				campotexto.selectionStart = inicio;
				campotexto.selectionEnd = ultimo;
			}
		}
	};
	this.getCookie = function getCookie(c_name) {
		if (document.cookie.length > 0) {
			c_start = document.cookie.indexOf(c_name + "=");
			if (c_start != -1) {
				c_start = c_start + c_name.length + 1;
				c_end = document.cookie.indexOf(";", c_start);
				if (c_end == -1)
					c_end = document.cookie.length;
				return unescape(document.cookie.substring(c_start, c_end));
			}
		}
		return "";
	};
	this.setCookie = function(c_name, value, expiredays) {
		var exdate = new Date();
		exdate.setDate(exdate.getDate() + expiredays);
		document.cookie = c_name
				+ "="
				+ escape(value)
				+ ((expiredays == null) ? "" : ";expires="
						+ exdate.toGMTString());
	};
	this.envanecido = function(capa, porcini, porfin, incremento) {
		if (porcini <= porfin) {
			var elem = this.$(capa);
			if (elem) {
				elem.style.filter = "alpha(opacity=" + porcini + ")";
				elem.style.opacity = porcini / 100;
				setTimeout("Goaamb.Dom.envanecido('" + capa + "',"
						+ (porcini + incremento) + "," + porfin + ","
						+ incremento + ")", 100);
			}
		}
	};
	this.desvanecido = function(capa, porcini, porfin, incremento) {
		if (porcini >= porfin) {
			var elem = this.$(capa);
			if (elem) {
				elem.style.filter = "alpha(opacity=" + porcini + ")";
				elem.style.opacity = porcini / 100;
				if (porcini - incremento > 0) {
					setTimeout("Goaamb.Dom.desvanecido('" + capa + "',"
							+ (porcini - incremento) + "," + porfin + ","
							+ incremento + ")", 100);
				}
			}
		}
	};
	this.acordionCerradura = function(capa, altoini, altofin, incremento,
			tiempo, accionantes, acciondespues) {
		if (altoini >= altofin && altoini >= 0) {
			var elem = this.$(capa);
			if (elem) {
				if (elem.style.overflow !== "hidden") {
					if (accionantes) {
						accionantes();
					}
				}
				elem.style.overflow = "hidden";
				elem.style.height = altoini + "px";
				if (altoini >= 0) {
					setTimeout("Goaamb.Dom.acordionCerradura('" + capa + "',"
							+ (altoini - incremento) + "," + altofin + ","
							+ incremento + "," + tiempo + ")", tiempo);
				} else {
					elem.style.overflow = "inherit";
					elem.style.height = "0px";
					if (acciondespues) {
						acciondespues();
					}
				}
			}
		}
	};
	this.acordionApertura = function(capa, altoini, altofin, incremento,
			tiempo, accionantes, acciondespues) {
		if (altoini <= altofin) {
			var elem = this.$(capa);
			if (elem) {
				if (elem.style.overflow !== "hidden") {
					altofin = elem.clientHeight;
					if (accionantes) {
						accionantes();
					}
				}
				elem.style.overflow = "hidden";
				elem.style.height = altoini + "px";
				setTimeout("Goaamb.Dom.acordionApertura('" + capa + "',"
						+ (altoini + incremento) + "," + altofin + ","
						+ incremento + "," + tiempo + ")", tiempo);
			}
		} else {
			this.$(capa).style.overflow = "auto";
			this.$(capa).style.height = "";
			if (acciondespues) {
				acciondespues();
			}
		}
	};
	this.appendChild = function(elemento, child) {
		if (elemento) {
			if (!child.appendChild) {
				elemento.innerHTML += child;
			} else {
				elemento.appendChild(child);
			}
		}
	};
	this.cargarColumna = function(tabla, elemento, nrofila, nrocolumna) {
		if (tabla) {
			var tbodys = this.$$$(tabla, "tbody");
			if (tbodys.length === 0) {
				tabla.appendChild(this.create("tbody"));
			}
			tbody = this.$$$(tabla, "tbody")[0];
			var filas = this.$$$(tbody, "tr");
			if (nrofila === undefined) {
				nrofila = filas.length;
			}
			if (filas.length <= nrofila) {
				var min = filas.length;
				var max = nrofila;
				for ( var i = min; i <= max; i++) {
					var fila = this.create("tr");
					tbody.appendChild(fila);
				}
				filas = this.$$$(tbody, "tr");
			}
			var columnas = this.$$$(filas[nrofila], "td");
			if (nrocolumna === undefined) {
				nrocolumna = columnas.length;
			}
			if (columnas.length <= nrocolumna) {
				var min = columnas.length;
				var max = nrocolumna;
				for ( var i = min; i <= max; i++) {
					var columna = this.create("td");
					filas[nrofila].appendChild(columna);
				}
				columnas = this.$$$(filas[nrofila], "td");
			}
			this.appendChild(columnas[nrocolumna], elemento);
			return columnas[nrocolumna];
		}
		return false;
	};
	this.cargarSelect = function(select, value, display) {
		if (select) {
			var tagoption = this.create("option");
			if (!value) {
				value = "";
			}
			if (!display) {
				display = value;
			}
			tagoption.innerHTML = display;
			tagoption.setAttribute("value", value);
			this.appendChild(select, tagoption);
			return tagoption;
		}
		return false;
	};
	this.parseObject = function(objeto, destino) {
		for ( var elemento in objeto) {
			destino[elemento] = objeto[elemento];
		}
	};
	this.createInput = function(tipo, id) {
		var elemento = this.create("input");
		if (tipo) {
			elemento.setAttribute("type", tipo);
		}
		if (id) {
			elemento.setAttribute("id", id);
		}
		return elemento;
	};
	this.createButton = function(id, valor) {
		var elemento = this.createInput("button", id);
		if (valor) {
			elemento.setAttribute("value", valor);
		}
		return elemento;
	};
	this.hereda = function(origen, destino) {
		if (typeof destino === "function") {
			destino.prototype = new origen();
			destino.superClass = new origen();
			return destino;
		}
		return false;
	};
}
var Goaamb = {};
Goaamb.aux = {};
Goaamb.Dom = new GDOM();
var gdom = Goaamb.Dom;
