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 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; }, // 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; }, utf2win : function (str) { var trans = []; for (var i = 0x410; i <= 0x44F; i++) trans[i] = i - 0x350; trans[0x401] = 0xA8; trans[0x451] = 0xB8; var ret = []; for (var i = 0; i < str.length; i++) { var n = str.charCodeAt(i); if (typeof trans[n] != 'undefined') n = trans[n]; if (n <= 0xFF) ret.push(n); } return escape(String.fromCharCode.apply(null, ret)); }, urldecode : function(str) { var trans=[]; var snart=[]; for(var i=0x410;i<=0x44F;i++) { trans[i]=i-0x350; snart[i-0x350] = i; } trans[0x401]= 0xA8; trans[0x451]= 0xB8; snart[0xA8] = 0x401; snart[0xB8] = 0x451; var ret=[]; str = unescape(str); for(var i=0;i 0) cur_depth++; var base_pad = repeat_char(pad_val*cur_depth, pad_char); var thick_pad = repeat_char(pad_val*(cur_depth+1), pad_char); var str = ""; if(obj instanceof Array) { str += "Array\n" + base_pad + "(\n"; for(var key in obj) { if(obj[key] instanceof Array) { str += thick_pad + "["+key+"] => "+formatArray(obj[key], cur_depth+1, pad_val, pad_char); } else { str += thick_pad + "["+key+"] => " + obj[key] + "\n"; } } str += base_pad + ")\n"; } else { str = obj.toString(); // They didn't pass in an array.... why? -- Do the best we can to output this object. }; return str; }; var repeat_char = function (len, char) { var str = ""; for(var i=0; i < len; i++) { str += char; }; return str; }; output = formatArray(array, 0, pad_val, pad_char); if(return_val !== true) { document.write("
" + output + "
"); return true; } else { return output; } }, implode : function (sep, arr) { return arr.join(sep); }, explode : function(delim, str) { // Split a string by separator return str.toString().split ( delim.toString() ); }, trim : function (str) { return str.replace(/(^ *)|( *$)/gi, ""); }, strip_tags : function(html) { html = html.replace(/[\n\r]+/gi, " "); // strip script and style tags html = html.replace(/]*?>.*?<\/s\1>/gi, ""); // strip comment tags html = html.replace(//gi, ""); // strip other tags html = html.replace(/<\/?[^>]+>/gi, " "); // strip entities html = html.replace(/&[\w]+;/gi, " "); // strip signs html = html.replace(/\.|,|:|!|\?|;| - |--|[\d]+|\/|\(|\)|'|"|_/gi, " "); // replace all english words html = html.replace(/[a-zA-Z-_]+/gi, " "); // trim document html = html.replace(/[ \s\t\f]+/gi, " "); return html; } } var Coockie = { getExpDate : function (days, hours, minutes) { var expDate = new Date(); if (typeof days == "number" && typeof hours == "number" && typeof hours == "number") { expDate.setDate(expDate.getDate() + parseInt(days)); expDate.setHours(expDate.getHours() + parseInt(hours)); expDate.setMinutes(expDate.getMinutes() + parseInt(minutes)); return expDate.toGMTString(); } }, getCookieVal : function (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) { endstr = document.cookie.length; } return unescape(document.cookie.substring(offset, endstr)); }, getCookie: function (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) { return this.getCookieVal(j); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; }, setCookie : function (name, value, expires, path, domain, secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); }, deleteCookie : function (name,path,domain) { if (this.getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } } var LIB2 = { addelem : function(name, attr) { var tag = document.createElement(name); for(var key in attr) { tag.setAttribute(key, attr[key]); } document.getElementsByTagName('head')[0].appendChild(tag); }, sleep : function ( numberMillis ) { var dialogScript = "window.setTimeout( function () { window.close(); }, " + numberMillis + ");"; var result = window.showModalDialog("javascript:document.writeln(\"