--- /dev/null
+function myconsole(ena) {
+ var conbody, condiv;
+
+ this.enable = ena;
+ if (ena) {
+ this.win = window.open("","","scrollbars=yes,height=500,width=400,left=0,top=800");
+ conbody = this.win.document.createElement("body");
+ this.div = condiv = this.win.document.createElement("div");
+
+ conbody.id = "console_body";
+ this.win.document.body.appendChild(condiv);
+ }
+}
+
+myconsole.prototype = {
+ win: null,
+ div: null,
+ enable: false,
+
+ log: function(s) {
+ if (!this.enable) {
+ return;
+ }
+ this.div.innerHTML += s + "<br>";
+ this.win.document.body.scrollTop = 10000000;
+ },
+
+ logger: function(s) {
+ if (!this.enable) {
+ return;
+ }
+ this.div.innerHTML += s + "<br>";
+ this.win.document.body.scrollTop = 10000000;
+ },
+
+ close: function() {
+ if (this.enable) {
+ this.win.close();
+ }
+ }
+}
+
+/*
+ * create and destroy
+ */
+var ismyconsole = false;
+var console_enable = true;
+
+if(typeof(console) == "undefined") {
+ var console;
+
+ console = new myconsole(console_enable);
+
+ ismyconsole = true;
+}
+else {
+ // console.logger = console.log;
+ // console.log = function () { return 0; }
+}
+
+function deconsole() {
+ if (ismyconsole) {
+ console.close();
+ }
+}
+
+function log_walk(curtag)
+{
+ var ind = 0;
+ var ancestor = curtag;
+ do {
+ console.log(spcs("_", "+", ind)+" ["+curtag.tagName+"] nodeType: "+curtag.nodeType+" inner: ["+curtag.innerHTML+"]");
+ if (curtag.firstChild != null && curtag.tagName != "TD") {
+ ind += 2;
+ curtag = curtag.firstChild;
+ }
+ else if (curtag.nextSibling != null) {
+ curtag = curtag.nextSibling;
+ }
+ else if (curtag.parentNode.nextSibling != null) {
+ ind -= 2;
+ curtag = curtag.parentNode.nextSibling;
+ }
+ else
+ curtag = null;
+ } while (curtag != null && curtag != ancestor);
+}
+
+
--- /dev/null
+function get_browser_agent()
+{
+ var ua = navigator.userAgent.toLowerCase();
+ var opera = ((ua.indexOf('opera') != -1) ? true : false);
+ var espial = ((ua.indexOf('escape') != -1) ? true : false);
+ var safari = ((ua.indexOf('safari') != -1) ? true : false);
+ var firefox = ((ua.indexOf('firefox') != -1) ? true : false);
+ var msie = ((ua.indexOf('msie') != -1) ? true : false);
+ var mac = ((ua.indexOf('mac') != -1) ? true : false);
+ var unix = ((ua.indexOf('x11') != -1) ? true : false);
+ var win = ((mac || unix) ? false : true);
+ var version = false;
+ var mozilla = false;
+
+ if (!firefox && !safari && (ua.indexOf('gecko') != -1)) {
+ mozilla = true;
+ var _tmp = ua.split('/');
+ version = _tmp[_tmp.length - 1].split(' ')[0];
+ }
+
+ if (firefox)
+ {
+ var _tmp = ua.split('/');
+ version = _tmp[_tmp.length - 1].split(' ')[0];
+ }
+ if (msie)
+ version = ua.substring((ua.indexOf('msie ') + 5)).split(';')[0];
+
+ if (safari)
+ {
+ /**
+ * Safari doesn't report a string, have to use getBrowserEngine to get it
+ */
+ // version = this.getBrowserEngine().version;
+ version = ua.substring((ua.indexOf('safari/') + 7)).split(' ')[0];
+
+ }
+
+ if (opera)
+ version = ua.substring((ua.indexOf('opera/') + 6)).split(' ')[0];
+
+ /**
+ * Return the Browser Object
+ * @type Object
+ */
+ var browsers = {
+ ua: navigator.userAgent,
+ opera: opera,
+ espial: espial,
+ safari: safari,
+ firefox: firefox,
+ mozilla: mozilla,
+ msie: msie,
+ mac: mac,
+ win: win,
+ unix: unix,
+ version: version
+ }
+ return browsers;
+}