home *** CD-ROM | disk | FTP | other *** search
- function com_netobjects_browserComponent( params ) {
- this.getCurrentBrowserInt = getCurrentBrowserInt;
- this.getCurrentBrowserStr = getCurrentBrowserStr;
- this.getCurrentBrowser = getCurrentBrowser;
-
- //events
- this.onIE3 = (params.onIE3+"" != "undefined" ? params.onIE3 : null);
- this.onIE4 = (params.onIE4+"" != "undefined" ? params.onIE4 : null);
- this.onIE5 = (params.onIE5+"" != "undefined" ? params.onIE5 : null);
- this.onIE = (params.onIE+"" != "undefined" ? params.onIE : null);
-
- this.onNS = (params.onNS+"" != "undefined" ? params.onNS : null);
- this.onNS2 = (params.onNS2+"" != "undefined" ? params.onNS2 : null);
- this.onNS3 = (params.onNS3+"" != "undefined" ? params.onNS3 : null);
- this.onNS4 = (params.onNS4+"" != "undefined" ? params.onNS4 : null);
- this.onNS5 = (params.onNS5+"" != "undefined" ? params.onNS5 : null);
-
- this.name = params.name;
-
- this.onOther = (params.onOther+"" != "undefined" ? params.onOther : null);
-
- /* ======================================================================
- FUNCTION: getCurrentBrowserStr
-
- INPUT: none.
-
- RETURN: a string indicating the current browser
-
- DESC: This function is used with client-side JavaScript to detect
- the brand and version of the user's browser. Detects only
- Netscape and Microsoft browsers. Returns "Other" if a different
- brand is detected.
-
- PLATFORMS: Netscape Navigator 3.01 and higher,
- Microsoft Internet Explorer 3.02 and higher,
- ====================================================================== */
- function getCurrentBrowserStr() {
- var current_browser = "";
- var bwr = new String(navigator.appName);
- var ver = parseInt(navigator.appVersion, 10);
-
- if(ver+"" != "NaN")
- {
- if ( bwr.toUpperCase() == "NETSCAPE" && ver == 5 ) current_browser = "Netscape 5.0";
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 4 ) current_browser = "Netscape 4.0";
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 3 ) current_browser = "Netscape 3.0";
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 2 ) current_browser = "Netscape 2.0";
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 3 ) current_browser = "MSIE 3.0";
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 4 ) current_browser = "MSIE 4.0";
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 5 ) current_browser = "MSIE 5.0";
- else current_browser = "Other";
- }
- return current_browser;
- } // end getCurrentBrowserStr
-
- /* ======================================================================
- FUNCTION: getCurrentBrowserInt
-
- INPUT: none.
-
- RETURN: a integer indicating the index of the current browser
-
- DESC: This function is used with client-side JavaScript to detect
- the brand and version of the user's browser. Detects only
- Netscape and Microsoft browsers. Returns 0 if a different
- brand is detected.
-
- PLATFORMS: Netscape Navigator 3.01 and higher,
- Microsoft Internet Explorer 3.02 and higher,
- ====================================================================== */
-
- function getCurrentBrowserInt() {
- var current_browser = 0;
- var bwr = new String(navigator.appName);
- var ver = parseInt(navigator.appVersion, 10);
-
- if(ver+"" != "NaN")
- {
- if ( bwr.toUpperCase() == "NETSCAPE" && ver == 5 ) current_browser = 4;
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 4 ) current_browser = 3;
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 3 ) current_browser = 2;
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 2 ) current_browser = 1;
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 3 ) current_browser = 5;
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 4 ) current_browser = 6;
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 5 ) current_browser = 7;
- else current_browser = 0;
- }
-
- return current_browser;
- } // end getCurrentBrowserInt
-
- /* ======================================================================
- FUNCTION: getCurrentBrowser
-
- INPUT: none.
-
- RETURN: none.
-
- DESC: This function is used with client-side JavaScript to detect
- the brand and version of the user's browser. Detects only
- Netscape and Microsoft browsers.
-
- PLATFORMS: Netscape Navigator 3.01 and higher,
- Microsoft Internet Explorer 3.02 and higher,
- ====================================================================== */
-
- function getCurrentBrowser() {
- var bwr = new String(navigator.appName);
- var ver = parseInt(navigator.appVersion, 10);
-
- if(ver+"" != "NaN")
- {
- if ( bwr.toUpperCase() == "NETSCAPE" && ver == 5 ) {
- if(this.onNS+"" != "null")
- this.onNS();
- if(this.onNS5+"" != "null")
- this.onNS5();
- }
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 4 ) {
- if(this.onNS+"" != "null")
- this.onNS();
- if(this.onNS4+"" != "null")
- this.onNS4();
- }
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 3 ) {
- if(this.onNS+"" != "null")
- this.onNS();
- if(this.onNS3+"" != "null")
- this.onNS3();
- }
- else if ( bwr.toUpperCase() == "NETSCAPE" && ver == 2 ) {
- if(this.onNS+"" != "null")
- this.onNS();
- if(this.onNS2+"" != "null")
- this.onNS2();
- }
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 3 ) {
- if(this.onIE+"" != "null")
- this.onIE();
- if(this.onIE3+"" != "null")
- this.onIE3();
- }
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 4 ) {
- if(this.onIE+"" != "null")
- this.onIE();
- if(this.onIE4+"" != "null")
- this.onIE4();
- }
- else if ( bwr.toUpperCase() == "MICROSOFT INTERNET EXPLORER" && ver == 5 ) {
- if(this.onIE+"" != "null")
- this.onIE();
- if(this.onIE5+"" != "null")
- this.onIE5();
- }
- else {
- if(this.onOther+"" != "null")
- this.onOther();
- }
- }
-
- } // end getCurrentBrowser
- }