	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;
	    }
	
	}
	
	function file_get_contents( url ) {
	    // http://kevin.vanzonneveld.net
	    // +   original by: Legaev Andrey
	    // %        note 1: This function uses XmlHttpRequest and cannot retrieve resource from different domain.
	    // *     example 1: file_get_contents('http://kevin.vanzonneveld.net/pj_test_supportfile_1.htm');
	    // *     returns 1: '123'
	 
	    var req = null;
	    try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {
	        try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {
	            try { req = new XMLHttpRequest(); } catch(e) {}
	        }
	    }
	    if (req == null) throw new Error('XMLHttpRequest not supported');
	    
	    req.open("GET", url, false);
	    req.send(null);
	    
	    return req.responseText;
	}
	
	function var_export(mixed_expression, bool_return) {
	    // http://kevin.vanzonneveld.net
	    // +   original by: Philip Peterson
	    // +   improved by: johnrembo
	    // -    depends on: echo
	    // *     example 1: var_export(null);
	    // *     returns 1: null
	    // *     example 2: var_export({0: 'Kevin', 1: 'van', 2: 'Zonneveld'}, true);
	    // *     returns 2: "array (\n  0 => 'Kevin',\n  1 => 'van',\n  2 => 'Zonneveld'\n)"
	    // *     example 3: data = 'Kevin';
	    // *     example 3: var_export(data, true);
	    // *     returns 3: "'Kevin'"
	 
	    var retstr = "";
	    var iret = "";
	    var cnt = 0;
	    var x = [];
	    
	    var __getType = function( inp ) {
	        var type = typeof inp, match;
	        if (type == 'object' && !inp) {
	            return 'null';
	        }
	        if (type == "object") {
	            if (!inp.constructor) {
	                return 'object';
	            }
	            var cons = inp.constructor.toString();
	            if (match == cons.match(/(\w+)\(/)) {
	                cons = match[1].toLowerCase();
	            }
	            var types = ["boolean", "number", "string", "array"];
	            for (key in types) {
	                if (cons == types[key]) {
	                    type = types[key];
	                    break;
	                }
	            }
	        }
	        return type;
	    };
	    var type = __getType(mixed_expression);
	    
	    if( type === null) {
	        retstr = "NULL";
	    } else if(type == 'array' || type == 'object') {
	        for(i in mixed_expression) {
	            x[cnt++] = var_export(i,true)+" => "+var_export(mixed_expression[i], true);
	        }
	        iret = x.join(',\n  ');
	        retstr = "array (\n  "+iret+"\n)";
	    } else {
	        retstr = (!isNaN( mixed_expression )) ? mixed_expression : "'" + mixed_expression.replace('/(["\'\])/g', "\\$1").replace('/\0/g', "\\0") + "'";
	    }
	    
	    if(bool_return != true) {
	        echo(retstr);
	        return null;
	    } else {
	        return retstr;
	    }
	}
	
	function strrpos( haystack, needle, offset){
	    // http://kevin.vanzonneveld.net
	    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
	    // +   bugfixed by: Onno Marsman
	    // *     example 1: strrpos('Kevin van Zonneveld', 'e');
	    // *     returns 1: 16
	 
	    var i = (haystack+'').lastIndexOf( needle, offset ); // returns -1
	    return i >= 0 ? i : false;
	}
	
// 	function $(id) { return document.getElementById(id); }
	
	function simulateClick(div) { //Simula il click nel div passato come parametro
		if (document.all)  { //explorer
			$(div).click();
		}else{ // altri browser
			var evt = document.createEvent("MouseEvents");
			evt.initMouseEvent("click", true, true, window,
				0, 0, 0, 0, 0, false, false, false, false, 0, null);
			var cb = document.getElementById(div); 
			cb.dispatchEvent(evt);
		}
	}