var utiles_js = true;	

	function CLocation(uri){
		this.hash= ''; // String containing the portion of the URL following the hash mark (#), if it exists. (IE3+, N2+, MOZ)
		this.host= ''; // String containing the host name and port of the URL (although some implementations do not include the port). (IE3+, N2+, MOZ)
		this.hostname= ''; // String containing the host name (domain name). (IE3+, N2+, MOZ)
		this.href= ''; // String containing the entire URL. (IE3+, N2+, MOZ)
		this.pathname= ''; // String containing the path (directory) portion of the URL. Always at least "/". (IE3+, N2+, MOZ)
		this.port= ''; //puerto si se ha especificado
		this.protocol = ''; //cadena de texto con el protocolo ( incluido el caracter :)
		this.search = ''; //cadena de consulta (incluido el caracter ?)
		
		this.parse = 
		function(uri){
			//var r = new RegExp("^([^\\:]+)//");
			var r = new RegExp("^(([^:]+:)//([^:\\?#/]+)(:([0-9]+))?)?(/?[^\\?#]*)?(\\?[^#]+)?(#.+)?");
			
			try{
				uri.match(r);
			}catch(ex){
				//throw new Error("URI incorrecta");		
				return false;
			}
				
			this.protocol = RegExp.$2;
			this.hostname = RegExp.$3;
			this.port = RegExp.$5;
			this.host = this.hostname+(((this.port=="") || (this.port==undefined))?"":(":"+this.port));
			this.pathname = RegExp.$6;
			this.search = RegExp.$7;
			this.hash = RegExp.$8;
			this.href=this.getURI();

			if (!r.test(uri) || (this.getURI()==''))
				throw new Error("URI incorrecta");			
		}
		
		this.equals = 
		function (loc){
			return (loc.host==this.host) && (this.pathname==loc.pathname);
		}

		this.getURI = 
		function(){
			return ((this.protocol==undefined || this.protocol=="")?"":(this.protocol+"//"))+this.host+this.pathname+this.search+this.hash;
		}
		
		this.parse(uri);
	}
	

	/**
	 * Copia los elementos del formulario origen al formulario destino
	 * @param HtmlFormElement formo
	 * @param HtmlFormElement formd
	 */
	function copyFormElementsIntoForm(formo, formd){
		var v = formo.elements;
		var e;
		for (var i=0; i<v.length; i++){
			e = v[i];
			//si el elemento ya existe en el formulario destino
			if (formd[e.name]){
				formd[e.name].value = e.value;
			}else{
				formd.appendChild(e.cloneNode(true));
			}
		}
	}
	
	/**
	 * Obtiene una adena de consulta a partir de los campos de un formulario
	 * @param HtmlFormElement frm
	 * @return string
	 */
	function formToQueryString(frm){
		var numberElements =  frm.elements.length;
		var querystring="";
		var e = null;
		for(var i = 0; i < numberElements; i++){
			e = frm.elements[i];
			if ((e.name=='') ||
			  ((e.type=="checkbox") && !e.checked))
				continue;
			querystring += (e.name+"="+encodeURIComponent(e.value)+((i<numberElements-1)?"&":""));
		}
		return querystring;
	}

	/**
	 * Añade una cadena de consulta a la URI especificada y devuelve el resultado
	 * @param string uri
	 * @param string querystring
	 * @return string
	 */
	function appendQueryStringToURI(uri, querystring){
		var oLoc = new CLocation(uri);

		var o = queryStringToCollection(oLoc.search+"&"+querystring);
		var i;
		var s="";
		var j = 0;
		for (i in o){
			if (j==0)
				s = "?";
			else
				s+="&";
			s+=(i+"="+o[i]);
			j++;
		}
		//se asigna la querystring al objeto CLocation
		oLoc.search = s;
		//se retorna la URI resultante
		return oLoc.getURI();
	}
	
	function queryStringToCollection(querystring){
		//se separa la querystring en pares de la forma "nombre=valor"
		var v = querystring.split(/[\?&]/);	
		var vAux = null;
		var i, o = new Object();
		//se van metiendo en un objeto u array asociativo (asi se eliminarán los posibles elementos repetidos de la query)
		for (i=0; i<v.length; i++){
			vAux = v[i].split("=");
			o[((vAux[0]==undefined)?"":vAux[0])] = ((vAux[1]==undefined)?"":unescape(new String(vAux[1])));
		}
		var o2 = new Object();
		for (i in o){
			if ((i=="") || (i==undefined) || 
				(o[i]==undefined) || (o[i]==""))
				continue;
			o2[i] = o[i];
		}
		return o2;
	}

	/**
	 * Aade una barra invertida a cada uno de los caracteres 
	 * de la cadena indicada y son caracteres especiales de una expresion regular
	 * @param String s
	 * @return String
	 */
	function escapeRegExpString(s){
		var r = "";
		var caracteres = ".?+*-[]()^$";
		var c = '';
		for (var i=0; i<s.length; i++){
			c = s.charAt(i);
			if (caracteres.indexOf(c)>-1)
				r+="\\"+c;
			else
				r+=c;
		}
		return r;
	}

	/**
	 * @param HTMLElement e
	 * @param string tagName
	 * @return HTMLElement
	 */
	function getParentNodeByTagName(e, tagName){
		e = e.parentNode;
		while (e && (new String(e.tagName).toLowerCase()!=tagName.toLowerCase())){
			e = e.parentNode;
		}
		if (!e)
			return document.documentElement;
		return e;
	}
	
	function addCSSClass(e, className){
		if (!(new RegExp("(^|[ \t])"+className+"([ \t]|$)")).test(e.className))
			e.className	+=" "+className;
	}
	
	function removeCSSClass(e, className){
		e.className = e.className.replace(new RegExp("(^|[ \t])"+className+"([ \t]|$)"), " ");
	}
	
	/**
	 * Obtiene el elemento "hermano" anterior al elemento indicado y
	 * cuya etiqueta HTML coincide con la especificada
	 * @param element Puntero al elemento del que se quiere obtener su hermano
	 * @param sTagName Etiqueta del elemento que se esta buscando
	 * @return HTMLElement Devuelve el elemento encontrado o null si no se encuentra
	 */
	function getPreviousSibling(element, sTagName){
		if (sTagName==undefined){
			return element.previousSibling;
		}else{
			sTagName = sTagName.toLowerCase();
			var eSibling = element.previousSibling;
			do{
				//alert(eSibling.nodeName);
				
				if (eSibling && eSibling.nodeName.toLowerCase()==sTagName)
					return eSibling;
				eSibling = eSibling.previousSibling;
			}while(eSibling!=null);
		}
		return null;
	}	
	
	/**
	 * Obtiene el elemento "hermano" posterior al elemento indicado y
	 * cuya etiqueta HTML coincide con la especificada
	 * @param element Puntero al elemento del que se quiere obtener su hermano
	 * @param sTagName Etiqueta del elemento que se esta buscando
	 * @return HTMLElement Devuelve el elemento encontrado o null si no se encuentra
	 */
	function getNextSibling(element, sTagName){
		if (sTagName==undefined){
			return element.nextSibling;
		}else{
			sTagName = sTagName.toLowerCase();
			var eSibling = element.nextSibling;
			do{
				//alert(eSibling.nodeName);
				
				if (eSibling && eSibling.nodeName.toLowerCase()==sTagName)
					return eSibling;
				eSibling = eSibling.nextSibling;
			}while(eSibling!=null);
		}
		return null;
	}
	
	/**
	 *  Obtiene una serie de elementos que conciden con 
	 * los valores especificadosde de los atributos especificados
	 * @param String sTagName Etiqueta HTML de los elementos a obtener
	 * @param String sTagName,... Pares de parametros de la forma "atributo","valor" (espresion reg)
	 * @return Array Vector con los elementos encontrados
	 */
	function getElementsByAttributes(sTagName){
		var i,j;
		var v = document.getElementsByTagName(sTagName);
		var v2 = new Array(); //vector de resultados
		var s,r = null;

		//recorremos los elementos
		for (i=0; i<v.length; i++){
			for(j=1; j<arguments.length-1; j+=2){
				s = arguments[j];
				r = new RegExp(arguments[j+1]);

				//si el valor del atributo no coincide con la expresion reg
				//se pasa al siguiente elemento
				if (!r.test(v[i][s]))
					break;
				//si se ha cumplido hasta la ultima propiedad
				//agregamos el elemento al vector de resultados
				//y pasamos al siguiente elemento
				if (j==arguments.length-2){
					v2.push(v[i]);
				}
				
			}
		}

		return v2;
	}
	
	/**
	 *
	 */
	function myAlert(x) {
		alert(decodeText(x));
	}
	
	/**
	 * 
	 * @param string mens 
	 * @param string codigo 
	 * @return int
	 */
	function myConfirm(mens, codigo){
		//si no se ha especificado un codigo
		if ((typeof(codigo)=="undefined") || (codigo==null) || (codigo==""))
			return confirm(decodeText(mens));
			
		//se recoge la respuesta del usuario
		var	respuesta = prompt(mens+"\nTeclee '"+codigo+"' (sin las comillas) para confirmar.", "");
		
		//si el usuario cancela o cierra el prompt
		if (respuesta==null)
			return false;

		//si coincide la respuesta del usuario con el codigo
		if (respuesta.toLowerCase()==codigo.toLowerCase())
			return true;
		myAlert('Confirmacin incorrecta.');
		return false;
	}
	
	/**
	 * 
	 */
	function myPrompt(mens, value){
		return prompt(decodeText(mens), value);
	}
	
	function decodeText(x){
		// version 040623
		// Spanish - Espa?ol
		// Portuguese - Portugu?s - Portugu?s
		// Italian - Italiano
		// French - Franc?s - Fran?ais
		// Also accepts and converts single and double quotation marks, square and angle brackets
		// and miscelaneous symbols.
		// Also accepts and converts html entities for all the above.
		//	if (navigator.appVersion.toLowerCase().indexOf("windows") != -1) {return x}
		x = x.replace(/&iexcl;/g,"\xA1");
		x = x.replace(/&iquest;/g,"\xBF");
		x = x.replace(/&Agrave;/g,"\xC0");
		x = x.replace(/&agrave;/g,"\xE0");
		x = x.replace(/&Aacute;/g,"\xC1");
		x = x.replace(/&aacute;/g,"\xE1");
		x = x.replace(/&Acirc;/g,"\xC2");
		x = x.replace(/&acirc;/g,"\xE2");
		x = x.replace(/&Atilde;/g,"\xC3");
		x = x.replace(/&atilde;/g,"\xE3");
		x = x.replace(/&Auml;/g,"\xC4");
		x = x.replace(/&auml;/g,"\xE4");
		x = x.replace(/&Aring;/g,"\xC5");
		x = x.replace(/&aring;/g,"\xE5");
		x = x.replace(/&AElig;/g,"\xC6");
		x = x.replace(/&aelig;/g,"\xE6");
		x = x.replace(/&Ccedil;/g,"\xC7");
		x = x.replace(/&ccedil;/g,"\xE7");
		x = x.replace(/&Egrave;/g,"\xC8");
		x = x.replace(/&egrave;/g,"\xE8");
		x = x.replace(/&Eacute;/g,"\xC9");
		x = x.replace(/&eacute;/g,"\xE9");
		x = x.replace(/&Ecirc;/g,"\xCA");
		x = x.replace(/&ecirc;/g,"\xEA");
		x = x.replace(/&Euml;/g,"\xCB");
		x = x.replace(/&euml;/g,"\xEB");
		x = x.replace(/&Igrave;/g,"\xCC");
		x = x.replace(/&igrave;/g,"\xEC");
		x = x.replace(/&Iacute;/g,"\xCD");
		x = x.replace(/&iacute;/g,"\xED");
		x = x.replace(/&Icirc;/g,"\xCE");
		x = x.replace(/&icirc;/g,"\xEE");
		x = x.replace(/&Iuml;/g,"\xCF");
		x = x.replace(/&iuml;/g,"\xEF");
		x = x.replace(/&Ntilde;/g,"\xD1");
		x = x.replace(/&ntilde;/g,"\xF1");
		x = x.replace(/&Ograve;/g,"\xD2");
		x = x.replace(/&ograve;/g,"\xF2");
		x = x.replace(/&Oacute;/g,"\xD3");
		x = x.replace(/&oacute;/g,"\xF3");
		x = x.replace(/&Ocirc;/g,"\xD4");
		x = x.replace(/&ocirc;/g,"\xF4");
		x = x.replace(/&Otilde;/g,"\xD5");
		x = x.replace(/&otilde;/g,"\xF5");
		x = x.replace(/&Ouml;/g,"\xD6");
		x = x.replace(/&ouml;/g,"\xF6");
		x = x.replace(/&Oslash;/g,"\xD8");
		x = x.replace(/&oslash;/g,"\xF8");
		x = x.replace(/&Ugrave;/g,"\xD9");
		x = x.replace(/&ugrave;/g,"\xF9");
		x = x.replace(/&Uacute;/g,"\xDA");
		x = x.replace(/&uacute;/g,"\xFA");
		x = x.replace(/&Ucirc;/g,"\xDB");
		x = x.replace(/&ucirc;/g,"\xFB");
		x = x.replace(/&Uuml;/g,"\xDC");
		x = x.replace(/&uuml;/g,"\xFC");
		
//		x = x.replace(/\"/g,"\x22"); x = x.replace(/&quot;/g,"\x22");
//		x = x.replace(/\'/g,"\x27");
		x = x.replace(/\</g,"\x3C");
		x = x.replace(/\>/g,"\x3E");
		x = x.replace(/\[/g,"\x5B");
		x = x.replace(/\]/g,"\x5D");
	
		x = x.replace(/&cent;/g,"\xA2"); 
		x = x.replace(/&pound;/g,"\xA3");
		x = x.replace(/&euro;/g,"\u20AC"); 
		x = x.replace(/&copy;/g,"\xA9"); 
		x = x.replace(/&reg;/g,"\xAE"); 
		x = x.replace(/&ordf;/g,"\xAA"); 
		x = x.replace(/&ordm;/g,"\xBA");
		x = x.replace(/&deg;/g,"\xB0");
		x = x.replace(/&plusmn;/g,"\xB1");
		x = x.replace(/&times;/g,"\xD7");
		
		return x;
	}
	
	/**
	 * Marca los checkboxes del vector pasado con el valor de bChecked
	 * @param Array v Vector con referencias a los checkboxes a marcar
	 * @param bool bChecked Valor a marcar
	 */
	function markCheckboxes(v,bChecked){
		for(i=0; i<v.length; i++){
			v[i].checked = bChecked;
		}
	}  	
	
	/**
	 * @param string nombre Nombre de los campos checkbox a cambiar de valor (marcar o desmarcar)
	 * @param bool checked
	 * @return int Devuelve el numero de checkboxes que han cambiado de valor
	 */
	function marcarTodos(nombre, checked){
		var i=0, j=0;
		var v = document.getElementsByName(nombre);
		for (var i=0; i<v.length; i++){
			if (!v[i] || (v[i].type!="checkbox"))
				continue;

			if (v[i].checked!= checked){
				v[i].checked = checked;
				j++;				
			}
		}
		return j;
	}
	
	/**
	 * @param string nombre Nombre de los campos checkbox a cambiar de valor (marcar o desmarcar)
	 * @param bool checked
	 * @return int Devuelve el numero de checkboxes que han cambiado de valor
	 */
	function marcarTodosClase(clase, checked){
		var i=0, j=0;
		var v = getElementsByAttributes("input", "className", clase);
		for (var i=0; i<v.length; i++){
			if (!v[i] || (v[i].type!="checkbox"))
				continue;
			
			if (v[i].checked!= checked){
				v[i].checked = checked;
				j++;				
			}
		}
		return j;
	}	
	
	/**
	 *
	 */	
	function lanzarAccion(formu, accion, pregunta){
		if (pregunta!=undefined && pregunta!=null && !confirm(pregunta))
			return false;
		document.getElementById('accion').value=accion; 
		formu.submit();
	}
	
	/**
	 *
	 */
	function lanzarAccionMarcados(formu, nombre, accion, pregunta_confirmacion){
		var v = document.getElementsByName(nombre);
		var cuantos = 0;
		for (var i=0; i<v.length; i++){
			if (v[i].checked)
				cuantos++;
		}//for i
		if (cuantos==0){
			alert("Debe seleccionar antes algunos elementos");
			return false;
		}
		
		if (pregunta_confirmacion!=undefined && pregunta_confirmacion!=null && !confirm(pregunta_confirmacion))
			return false;
		document.getElementById('accion').value=accion; 
		formu.submit();
	}
	
	/**
	 *
	 */
	function printSelect(id, seleccionado, onchange, elementovacio /*, valor1, valor2, valor3*/){
		document.writeln('<select id="'+id+'" name="'+id+'" onchange="'+onchange+'">');
		if (elementovacio)
			document.writeln('<option value="">&lt; Elige &gt;</option>');
		for (var i=4; i<arguments.length; i++){
			document.write('<option value="'+arguments[i]+'" ');
			if (seleccionado==arguments[i])
				document.write(' selected="selected" ');
			document.writeln('>'+arguments[i]+'</option>');
		}//for
		document.writeln('</select>');
	}
	/**
	 *
	 */
	function printSelectRango(id, seleccionado, onchange, desde, hasta){
		if (desde>hasta)
			hasta = desde;
		document.writeln('<select id="'+id+'" name="'+id+'" onchange="'+onchange+'">');
		for (var i=desde; i<=hasta; i++){
			document.write('<option value="'+i+'" ');
			if (seleccionado==i)
				document.write(' selected="selected" ');
			document.writeln('>'+i+'</option>');
		}//for
		document.writeln('</select>');
	}//printSelectRango
	/***********************************/
	//recoge el valor de un elemento
	function getValue(id){
		if (id==undefined)
			return null;
			
		var elemento = document.getElementById(id);
		if (elemento==null){
			elemento = document.getElementsByName(id);
			if (elemento)
				elemento = elemento[0];
		}
		if (elemento==null)
			return null;
		if (elemento.type=="text" || elemento.type=="hidden" || elemento.type=="textarea"){
			return elemento.value;
		}else
		if (elemento.type=="checbox"){
			if (elemento.checked)
				return (element.value);
		}else
		if (elemento.type=="radio"){
			var v = document.getElementsByName(id);
			if (v)
			for(var i=0; i<v.length; i++){
				if (v[i].checked)
					return v[i].value;
			}
		}else{			
			if (elemento.firstChild==null){
				return "";
			}else{
				return elemento.firstChild.nodeValue;
			}
		}
		return null;
	}
	/***********************************/
	//establece el valor de un documento
	function setValue(elemento, valor){
		if (elemento==null || elemento==undefined)
			return false;

		if (elemento.type=="text" || elemento.type=="hidden" || elemento.type=="textarea")
			elemento.value = valor;
		else{
			var t = document.createTextNode(valor);
			if (elemento.firstChild)
				elemento.removeChild(elemento.firstChild);
			elemento.appendChild(t);
		}
	}
	/****************************************/
	//copia el texto en los elementos con el nombre nombre_destino
	function copiarTexto(texto, nombre_destino, pregunta){
		var destinos = document.getElementsByName(nombre_destino);
		
		if (pregunta==undefined)
			var pregunta = "Copiar?";
			
		if (destinos.length==0 || !confirm(pregunta))
			return false;

		for (var i=0; i<destinos.length; i++){
			setValue(destinos[i], texto);
		}//for
		return true;
	}//copiarTexto
	/***********************************/
	//copia el texto del elemento con el id id_origen en los elementos con el nombre nombre_destino
	function copiarValor(id_origen, nombre_destino){
		var origen = document.getElementById(id_origen);
		
		var texto = getValue(id_origen);
	
		return copiarTexto(texto, nombre_destino);
	}

	var timerPrecarga = null;
	var timerPrecarga2 = null;
	
	/** 
	 *  Oculta la capa con el id especificado una vez se haya 
	 * terminado de cargar la pagina (im?genes incluidas) 
	 * @param string idLoadingLayer ID de la capa que muestra un mensaje "cargando..." o similar
 	 */
	function esperarCargaPagina(idLoadingLayer){
		if (new Image().complete==undefined) //si no exciste la propieda complete en las imagenes
			return false;
		timerPrecarga2 = setTimeout("if (timerPrecarga){ var e = document.getElementById('"+idLoadingLayer+"');"
			+"if (e) e.style.display='none'; clearInterval(timerPrecarga);} ", 10000);
		
		timerPrecarga = setInterval(
			"var todasCargadas = true;"
			+"for(var i=0; i<document.images; i++)"
			+"	if (!document.images[i].complete) {todasCargadas = false; break;}"
			+"if (todasCargadas) {var e = document.getElementById('"+idLoadingLayer+"');"
			+"if (e) e.style.display='none'; clearInterval(timerPrecarga);}", 500);
			
	}

	/**
	 *	Establece la pagina de inicio del navegador
	 * @param string url URL de la pagina que se va a establecer como pagina de inicio
	 * @param HTMLAElement link Referencia del link desde donde se va a llamar a esta funcion (necesario s?lo para IExplorer)	
	 */
	function setHomePage(url, link){
		if ((window.netscape) && (window.netscape.security)){
			netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesRead');
			var home = navigator.preference('browser.startup.homepage');
			if (home != url){
				netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesWrite');
				navigator.preference('browser.startup.homepage',url);
			}
		}else
		if (link){
			link.style.behavior = 'url(#default#homepage)';
			link.setHomePage(url);
		}
	}	

	/**
	 *	Dado un nodo padre, busca un nodo hijo cuyo calor de su atributo "attribute" coincida con el especificado en "value"
	 * @param node parentNode Nodo padre
	 * @param string attribute Nombre del atributo
	 * @param string value Valor que debe tener el atributo del nodo hijo
	 * @param bool bStrict Indica si el valor del atributo debe coindicir estrictamente o no 
	 *  (si se indica FALSE, value se tomara como una expresion regular)(por defecto TRUE)
	 * @return	nodeElement
	 */
	function buscarNodo(parentNode, attribute, value, bStrict){
		if (parentNode==null)
			return null;
		if (bStrict==undefined)
			bStrict = true;
		var e,v = parentNode.childNodes;
		for(var i = 0; i<v.length; i++){
			if ((bStrict && v[i][attribute]==value) ||
				(!bStrict && new RegExp(value).test(v[i][attribute]))){
				return v[i];
			}else
			if((e = buscarNodo(v[i], attribute, value, bStrict))!=null){
				return e;
			}
		}
		return null;
	}	
	
	/**
	 * Abre una nueva ventana con el documento especificado
	 * @param sURI
	 * @return Object
	 */
	function abrirVentana(sURI, sNombre, width, height, bResizable) { 
		var iTop = 0, iLeft = 0;
		
		if (width==undefined)
			var width = screen.availWidth;
		else
		if (width < screen.availWidth)		
			iLeft = (screen.availWidth - width)/2;
		
		if (height==undefined)
			var height = screen.availHeight;
		else
		if (height < screen.availWidth)
			iTop = (screen.availHeight - height)/2;
		
		var sOptions = "toolbar=no,directories=no,status=no,scrollbars=yes,menubar=no";
		sOptions += ",resizable=";
		if(bResizable == undefined || bResizable == true)
			sOptions +="no";
		else
			sOptions +="yes";
			
		if (iTop>0) sOptions+=",top="+iTop;
		if (iLeft>0) sOptions+=",left="+iLeft;
		if (width && (width>0)) sOptions+=",width="+width;
		if (height && (height>0)) sOptions+=",height="+height;
		
		var w = window.open(sURI, sNombre, sOptions);
		w.focus();
		return w;
	}

	/**
	 * Devuelve un array asociativo con las variables de GET
	 * @return string
	 */
	function parseGETVars(){
		var qs = location.search.substring(1);
		var nv = qs.split('&');
		var url = new Object();
		for(i = 0; i < nv.length; i++) {
			eq = nv[i].indexOf('=');
			url[nv[i].substring(0,eq).toLowerCase()] = unescape(nv[i].substring(eq + 1));
		}

		return url;
	}
	
	/**
	 * Obtiene el precio en el formato correcto
	 * @param double precio
	 * @return string
	 */
	function formatearPrecio(precio){
		var n = new Number(precio).toFixed(2);
		return n.toLocaleString();
	}
	
	/**
	 * Devuelve el primer valor de los argumentos pasados
	 * distinto de null/undefined/''
	 * @return mixed
	 */
	function chooseValue(){
		var v = arguments;
		for(var i=0; i<v.length; i++){
			if ((v[i]!='') && 
				(v[i]!==null) && 
				(v[i]!==undefined))
				return v[i];
		}
		return null;
	}

	/**
	 * Fuerza el refresco de un iframe aadiendo (cambiando)
	 * el parametro "refresco=timestamp"
	 * @param mixed iframe (string con el id del iframe en el documento )
	 * @return bool
	 */
	function refrescarFrame(frame){
		
		if (frame==null || frame==undefined)
			return false;
			
		var s = frame.location.href;
		var sRefresco = "refresco="+(new Date().getTime());
		
		if (s.indexOf("refresco=")>-1){
			s.replace(/refresco=[^&]+/, sRefresco);
		}else{
			if (s.indexOf("?")<0)
				s+="?";
			s+=sRefresco;
		}
		frame.location.href = s;
		return true;
	}

	/**
	 * Obtiene la referencia al iframe especificado
	 * @param mixed iframe
	 * @return HTMLFrameElement 
	 */
	function getIframe(iframe, target){
		if ((typeof(iframe)=="undefined") || (iframe==null))
			return null;
			
		if (typeof(target)=="undefined")
			target = self;
		else
		if (target==null)
			return null;
			
		if (typeof(iframe)=="string"){
			var sIframe = iframe;
			if (navigator.isIExplorer()){
				iframe = target.document.frames[iframe];
			}else
				iframe = target.frames[iframe];
			
			var padre = target.parent;
			if (padre == target)
				return iframe;
				
			if (typeof(padre)=="undefined")
				padre = null;
			//si no se ha encontrado el iframe se busca en el marco padre (si existe)
			if (!iframe && padre)
				iframe = getIframe(sIframe, padre);		
		}
		return iframe;
	}
	
	/**
	 * Obtiene la URL actual en el frame indicado
	 * @param HTMLFrameElement target
	 * @return string
	 */
	function currentURL(target){
		if (typeof(target)=="undefined")
			var target = self;

		return target.location.protocol+"//"+
			target.location.hostname+":"+
			target.location.port+
			target.location.pathname;
	}
	
	/**
	 * Manda imprimir el iframe indicado
	 * @param mixed iframe Nombre del iframe o referencia al mismo
	 * @return bool
	 */
	function imprimirIframe(iframe){
		if (iframe==null || iframe==undefined)
			return false;
		
		iframe.focus();
		iframe.print();
		return true;
	}
	
	/**
	 * 
	 * @return string
	 */
	function URL2URI(sURL, sQueryString){
		if (sURL.indexOf("?")<0)
			sURL+="?";
		sURL+="&"+sQueryString;
		return sURL;
	}
	
	/**
	 * Elimina las marcas HTML de un texto
	 * @param sCodigo
	 * @return String
	 */
	function removeHTMLTags(sCodigo){
		return sCodigo.replace(/<[^>]+>/g, "");
	}
	
	/**
	 * Resetea el valor del elemento de formulario indicado
	 * @param HTMLElement elem
	 * @return string Devuelve el valor por defecto
	 */
	 function resetValue(elem){
	 	if (!elem || !elem.type)
	 		return null;
	 	var i, v;	
	 	switch (elem.type){
	 	case "checkbox":
		 	elem.checked = elem.defaultChecked;
		 	break;
	 	case "radio":
	 		v = document.getElementsByName(elem.name);
	 		for (i=0; i<v.length; i++){
		 		v[i].checked = v[i].defaultChecked;	 		 			
	 		}
	 		break;
	 	case "select-one":
	 	case "select-multiple":
	 		v = elem.options;
			for(i=0; i<v.length; i++){
				v[i].selected = v[i].defaultSelected;
			}
	 		break;
	 	default:
	 		elem.value = elem.defaultValue;
	 	}
	 	return elem.value;
	 }
	 
	/**
	 * @param object opciones
	 * @param HTMLSelectElement selectElement: elemento SELECT donde cargar las opciones o el id del mismo,
	 * @param String valueAttr: nombre del atributo de donde se obtiene el valor de la opcion (option)
	 * @param String textAttr: nombre del atributo de donde se obtiene el texto de la opcion (option)}
	 * @param String xmlElement: nombre del elemento en el documento xml de donde se obtienen los datos
	 * @static
	 * @public
	 */
	function changeSelectOptions(selectElement, opciones){
		var e = selectElement;
		
		if (typeof(e)=="string"){
			e = document.getElementById(e);		
		}	
		while(e.hasChildNodes()){
			e.removeChild(e.firstChild);		
		}
    	var option = null;
    	for(var i in opciones){
    		option = document.createElement("option");
    		option.value = i;
    		option.text = opciones[i];
			
			if (navigator.isIExplorer())
				e.add(option, e.options.length);
			else
				e.add(option, null);    		
    	}
	}
	
	function scan(o, cont){
		var s = "";
		switch(typeof(o)){
		case "boolean":
		case "number":
		case "string":
			s = o;
			break;
		case "object":
			for (var i in o){
				if (typeof (o[i])=="function")
					continue;
				s+=i+" = {"+scan(o[i], true)+"}\n";
		
		}
		}
		if (!cont)
			alert(s);
		else
			return s;
	}
	
	//pop-up para formulario de contacto con anunciante en resultados.php//
	function ventanaConsultaAnunciante (URL){
	window.open(URL,"ventana_consulta_anunciante","width=767, height=555, scrollbars=no, menubar=no, location=no, resizable=no, top=160, left=170");
	}
	
	//pop-up para formulario de olvido_contrasena.php//
	function ventanaOlvidoContrasena (URL){
	window.open(URL,"ventana_olvido_contrasena","width=250, height=170, scrollbars=no, menubar=no, location=no, resizable=no, top=200, left=500");
	}