<!--
	// Abre una ventana de confirmacion al pulsar un enlace
	// idenlace: id del enlace que se quiera confirmar
	// msg: mensaje de confirmacion
    function confirmarEnlace (idenlace, msg)
    {
        addFuncionOnLoad (function() {
            var link = getObj(idenlace);
            var uri = link.href;
            link.onclick = function() {
                if (confirm (msg)) {
                    link.href = uri;
                }
            }
            link.href = "#";
        });
    }

	// Auxiliar para la siguiente
	var funciones_onload = (funciones_onload? funciones_onload : new Array());
	function runMultipleOnLoad()
	{
		for(var i=0; i<funciones_onload.length; i++)
			funciones_onload[i]();
			
		 funciones_onload=void 0;
	}
	
	// *** Aņade una funcion para que se ejecute al cargar una pagina
	function addFuncionOnLoad (funcion)
	{
		var old_onload = window.onload;
		if (old_onload == null) {
			window.onload = funcion;
		} else if (old_onload == runMultipleOnLoad) {
			funciones_onload.push (funcion);
		} else {
			window.onload = runMultipleOnLoad;
			funciones_onload.push (old_onload);
			funciones_onload.push (funcion);
		}
	}
	
	// Abre una nueva ventana para mostrar una imagen, sin modificar la ventana principal
	function PopUp(url) {
	  //posLeft = (screen.availWidth / 2) - (600 / 2);
	  //posTop = (screen.availHeight / 2) - (400 / 2);
	  //window.open (url, "Imagen", "width=600,height=400,left="+posLeft+",top="+posTop+",toolbar=1,location=0,resizable=1,scrollbars=1");
	  window.open (url);
	}

	function frameOrPopup (frame, url, urlPopup, width, height) {
		if (!urlPopup)  urlPopup = url;
		if (parent.frames && parent.frames[frame]) {
			parent.frames[frame].location = url;
		} else {
			var config = "location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1";
			if (width) {
			    config = config + ",width=" + width;
			    var sx = (screen.availWidth / 2) - (width / 2);
			    if (screen.availWidth)  config = config + ",left=" + sx + ",screenX=" + sx;
			}
			if (height) {
			    config = config + ",height=" + height;
			    var sy = 10;
//			    var sy = (screen.availHeight / 2) - (height / 2);
			    if (screen.availHeight)  config = config + ",top=" + sy + ",screenY=" + sy;
			}
			window.open (urlPopup, "", config);
		}
	}

	
/**
 *
 *  URL encode / decode
 *  http://www.webtoolkit.info/
 *
 */
var Url = {

    // public method for url encoding
    encode : function (string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }
}


//-->
