// This object provides some useful debugging tools: function log() { // Would be nice to sort it... function print_debug() { function escapeHTML ( s ) { var MAP = { '&':'&', '<':'<', '>':'>', '"':'"', "'":''' }; var repl = function(c) { return ( MAP[c] ); }; return ( String(s).replace ( /[&<>'"]/g, repl ) ); } function print_debug_var ( variable, value, indent ) { for ( var i = 0; i < indent; i++ ) { document.write ( " " ); } document.write ( escapeHTML ( variable ) + " => " + escapeHTML ( value ) + "\n" ); if ( typeof ( value ) == "object" && indent < 5 ) { try { for ( var key in value ) { print_debug_var ( key, value[key], indent + 1 ); } } catch ( error ) {} } } document.write ( '
' + "\n"
                   + "- DEBUG: ------------------------------------------\n" );

    for ( var i = 0; i < arguments.length; i += 2 )
    {
      document.write ( "\n" );
      print_debug_var ( arguments[i], arguments[i+1], 0 );
    }

    document.write ( "---------------------------------------------------\n"
                   + "
\n" ); } this.print_debug = print_debug; } var log = new log(); // This object implements the global SESSION variable: function SESSION() { function OBJECT(){} this.REQUEST = new OBJECT(); var browser = new OBJECT(); browser.USER_AGENT = navigator.userAgent; browser.plugins = new OBJECT(); var userAgent = navigator.userAgent.toLowerCase(); var appVersion = navigator.appVersion.toLowerCase(); // Detect OS: if ( userAgent.indexOf ( "mac" ) >= 0 ) { browser.os = "Mac"; } else if ( userAgent.indexOf ( "win" ) >= 0 || userAgent.indexOf ( "16bit" ) >= 0 ) { browser.os = "Windows"; } else if ( userAgent.indexOf ( "unix" ) >= 0 || userAgent.indexOf ( "x11" ) >= 0 || userAgent.indexOf ( "linux" ) >= 0 || userAgent.indexOf ( "bsd" ) >= 0 || userAgent.indexOf ( "sunos" ) >= 0 || userAgent.indexOf ( "irix" ) >= 0 || userAgent.indexOf ( "lynx" ) >= 0 || userAgent.indexOf ( "hp-ux" ) >= 0 || userAgent.indexOf ( "aix" ) >= 0 || userAgent.indexOf ( "sco" ) >= 0 || userAgent.indexOf ( "ncr" ) >= 0 || userAgent.indexOf ( "dec" ) >= 0 || userAgent.indexOf ( "osf1" ) >= 0 || userAgent.indexOf ( "ultrix" ) >= 0 || userAgent.indexOf ( "sinix" ) >= 0 ) { browser.os = "Unix"; } // Detect Browser: if ( userAgent.indexOf ( "opera" ) >= 0 ) { browser.name = "Opera"; browser.version = parseFloat ( appVersion ); } else if ( userAgent.indexOf ( "konqueror" ) >= 0 ) { browser.name = "Konqueror"; var p = userAgent.indexOf ( "konqueror" ); browser.version = parseFloat ( appVersion.substring ( p + 10, appVersion.indexOf ( ";", p ) ) ); } else if ( browser.os == "Mac" && userAgent.indexOf ( "safari" ) >= 0 ) { browser.name = "Safari"; browser.version = parseFloat ( appVersion ); } else if ( appVersion.indexOf ( "msie" ) >= 0 ) { browser.name = "Internet Explorer"; var p = appVersion.indexOf ( "msie" ); if ( browser.os == "Mac" ) { browser.version = parseFloat ( userAgent.substring ( p + 5, userAgent.indexOf ( ";", 5 ) ) ); } else { browser.version = parseFloat ( appVersion.substring ( p + 5, appVersion.indexOf ( ";", p ) ) ); } } else if ( userAgent.indexOf ( "mozilla" ) >= 0 && userAgent.indexOf ( "spoofer" ) < 0 && userAgent.indexOf ( "compatible" ) < 0 && userAgent.indexOf ( "webtv" ) < 0 && userAgent.indexOf ( "hotjava" ) < 0 ) { if ( navigator.product.toLowerCase() == "gecko" && userAgent.indexOf ( "mozilla/5" ) >= 0 && ( navigator.vendor == "Firefox" || userAgent.indexOf ( "firefox" ) >= 0 ) ) { browser.name = "Firefox"; if ( navigator.vendorSub ) { browser.version = navigator.vendorSub; } else { browser.version = parseFloat ( userAgent.substring ( userAgent.indexOf ( "firefox" ) + 8 ) ); } } else if ( navigator.product.toLowerCase() == "gecko" && userAgent.indexOf ( "mozilla/5" ) >= 0 && ( navigator.vendor == "Firebird" || navigator.vendor == "Mozilla" || navigator.vendor == "Debian" || navigator.vendor == "" ) ) { browser.name = "Other Browser"; browser.version = ""; } else { browser.name = "Netscape"; if ( navigator.vendor == "Netscape" || navigator.vendor == "Netscape6" ) { browser.version = parseFloat ( navigator.vendorSub ); } else { browser.version = parseFloat ( appVersion ); } } } else { browser.name = "Unknown"; browser.version = ""; } // Detect Plug-ins: function detect_plugin_pi() { var results = 0; for ( var j = 0; j < navigator.plugins.length; j++ ) { for ( var i = 0; i < arguments.length; i++ ) { if ( navigator.plugins[j].name.indexOf ( arguments[i] ) >= 0 || navigator.plugins[j].description.indexOf ( arguments[i] ) >= 0 ) { results++; if ( results == arguments.length ) return ( true ); } } } return ( false ); } // Can/should _mt be done the same way as _pt? function detect_plugin_mt() { return ( navigator.mimeTypes[arguments[i]] && navigator.mimeTypes[arguments[i]].enabledPlugin && navigator.mimeTypes[arguments[i]].enabledPlugin.description ); } if ( typeof ( navigator.plugins ) != "undefined" && navigator.plugins.length > 0 ) { browser.plugins.Flash = detect_plugin_pi ( "Shockwave", "Flash" ); browser.plugins.MediaPlayer = detect_plugin_pi ( "Windows Media" ); browser.plugins.QuickTime = detect_plugin_pi ( "QuickTime" ); browser.plugins.RealPlayer = detect_plugin_pi ( "RealPlayer" ); // browser.plugins.AcrobatReader = detect_plugin_mt ( "application/pdf" ); } else if ( browser.os == "Windows" && browser.name == "Internet Explorer" && parseInt ( browser.version ) >= 4 ) { // What's the deal with http://www.webreference.com/js/column55/activex.html? document.write ( '\n' + 'Function detect_plugin_vb ( plugin )\n' + 'On Error Resume Next\n' + 'detect_plugin_vb = false\n' + 'If ScriptEngineMajorVersion >= 2 Then\n' + 'detect_plugin_vb = ( IsObject ( CreateObject ( plugin ) ) )\n' + 'If plugin = "QuickTimeCheckObject.QuickTimeCheck.1" Then\n' + 'detect_plugin_vb = detect_plugin_vb.IsQuickTimeAvailable(0)\n' + 'End If\n' + 'End If\n' + 'End Function\n' + '<\/sc' + 'ript>' ); browser.plugins.Flash = detect_plugin_vb ( "ShockwaveFlash.ShockwaveFlash.1" ); browser.plugins.MediaPlayer = detect_plugin_vb ( "MediaPlayer.MediaPlayer.1" ); browser.plugins.QuickTime = detect_plugin_vb ( "QuickTimeCheckObject.QuickTimeCheck.1" ); // This one crashes IE/XP? // browser.plugins.RealPlayer = detect_plugin_vb ( "rmocx.RealPlayer G2 Control" ); // || detect_plugin_vb ( "RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)" ) // || detect_plugin_vb ( "RealVideo.RealVideo(tm) ActiveX Control (32-bit)" ); // browser.plugins.AcrobatReader = detect_plugin_vb ( "PDF.PdfCtrl.1" ) // || detect_plugin_vb ( "AcroExch.Document" ); } else if ( typeof ( navigator.mimeTypes ) != "undefined" && navigator.mimeTypes.length ) { browser.plugins.Flash = detect_plugin_mt ( "application/x-shockwave-flash" ); browser.plugins.MediaPlayer = detect_plugin_mt ( "application/x-mplayer2" ); browser.plugins.QuickTime = detect_plugin_mt ( "video/quicktime" ); browser.plugins.RealPlayer = detect_plugin_mt ( "audio/x-pn-realaudio-plugin" ); // browser.plugins.AcrobatReader = detect_plugin_mt ( "application/pdf" ); } browser.screen = new OBJECT(); browser.screen.x = screen.width; browser.screen.y = screen.height; this.REQUEST.BROWSER = browser; this.REQUEST.REFERER = document.referrer; } var SESSION = new SESSION(); /////////////////////////////////////////////////////////////////////////////// // Adapted from: http://www.json.org/json2.js - 2008-05-25 and Minified: if(!this.JSON){JSON=function(){function f(n){return n<10?'0'+n:n;} Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+ f(this.getUTCMonth()+1)+'-'+ f(this.getUTCDate())+'T'+ f(this.getUTCHours())+':'+ f(this.getUTCMinutes())+':'+ f(this.getUTCSeconds())+'Z';};var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==='string'){return c;} return'\\u'+('0000'+ (+(a.charCodeAt(0))).toString(16)).slice(-4);})+'"':'"'+string+'"';} function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);} if(typeof rep==='function'){value=rep.call(holder,key,value);} switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';} gap+=indent;partial=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){length=value.length;for(i=0;i