/*
 * jsBrwSniff v0.5
 *
 * A browser sniffer library
 * http://jsbrwsniff.sf.net
 *
 * Released under the GNU LGPL license
 * Author: Pau Garcia i Quiles <paugq AT users DOT sourceforge DOT net>
 *
 */


var jsVer = -1;
var pluginFound = false;
var pluginName = "";

function getBrowser(obj) {
    var b=new Array("unknown", "unknown", "unknown", "unknown");

    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);

    if (brs.search(/omniweb[\/\s]v?(\d+([\.-]\d)*)/) != -1) {
    // Omniweb
        b[0]="omniweb";
        b[1]=brs.match(/omniweb[\/\s]v?(\d+([\.-]\d)*)/)[1];
        (b[1] > 4.5 ? b[2]="khtml" : b[2]="omniweb");
        (brs.search(/omniweb[\/\s]((\d+([\.-]\d)*)-)?v(\d+([\.-]\d)*)/) == -1 ?       b[3]=brs.match(/omniweb[\/\s](\d+([\.-]\d)*)/)[1] :        b[3]=brs.match(/omniweb[\/\s]((\d+([\.-]\d)*)-)?v(\d+([\.-]\d)*)/)[4]);
        return b;
    } else if (brs.search(/opera[\/\s](\d+(\.?\d)*)/) != -1) {
    // Opera
        b[0]="opera";
        b[1]=brs.match(/opera[\/\s](\d+(\.?\d)*)/)[1];
        b[2]="opera";
        b[3]=b[1];
        return b;
    } else if (brs.search(/crazy\s?browser\s(\d+(\.?\d)*)/) != -1) {
    // Crazy Browser
        b[0]="crazy";6
        b[1]=brs.match(/crazy\s?browser\s(\d+(\.?\d)*)/)[1];
        b[2]="msie";
        b[3]=getMSIEVersion();
        return b;
    } else if (brs.search(/myie2/) != -1) {
    // MyIE2
        b[0]="myie2";
        b[2]="msie";
        b[3]=brs.match(/msie\s(\d+(\.?\d)*)/)[1];
        return b;
    } else if (brs.search(/netcaptor/) != -1) {
    // NetCaptor
        b[0]="netcaptor";
        b[1]=brs.match(/netcaptor\s(\d+(\.?\d)*)/)[1];
        b[2]="msie";
        b[3]=getMSIEVersion();
        return b;
    } else if (brs.search(/avant\sbrowser/) != -1) {
    // Avant Browser
        b[0]="avantbrowser";
        b[2]="msie";
        b[3]=getMSIEVersion();
        return b;
    } else if (brs.search(/msn\s(\d+(\.?\d)*)/) != -1) {
    // MSN Explorer
        b[0]="msn";
        b[1]=brs.match(/msn\s(\d+(\.?\d)*)/)[1];
        b[2]="msie";
        b[3]=getMSIEVersion();
        return b;
    } else if (brs.search(/msie\s(\d+(\.?\d)*)/) != -1) {
    // MS Internet Explorer
        b[0]="Microsoft Internet Explorer";
        b[1]=getMSIEVersion();
        b[2]="msie";
        b[3]=b[1];
        return b;
    } else if (brs.search(/powermarks\/(\d+(\.?\d)*)/) != -1) {
    // PowerMarks
        b[0]="powermarks";
        b[1]=brs.match(/powermarks\/(\d+(\.?\d)*)/)[1];
        b[2]="msie";
        try {
            b[3]=getMSIEVersion();
        } catch (e) { }
        return b;
    } else if (brs.search(/konqueror[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Konqueror
        b[0]="konqueror";
        b[1]=brs.match(/konqueror[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="khtml";
        return b;
     } else if (brs.search(/chrome\/(\d)*/) != -1) {
    // Safari
        b[0]="Google Chrome";
        b[1]=brs.match(/chrome\/(\d+(\.?\d*)*)/)[1];
        b[2]="applewebkit";
        b[3]=brs.match(/applewebkit\/(\d+(\.?\d*)*)/)[1];
        return b;
    } else if (brs.search(/safari\/(\d)*/) != -1) {
    // Safari
        b[0]="safari";
        b[1]=brs.match(/safari\/(\d+(\.?\d*)*)/)[1];
        b[2]="khtml";
        b[3]=brs.match(/applewebkit\/(\d+(\.?\d*)*)/)[1];
        return b;
    } else if(brs.search(/zyborg/) != -1) {
    // Zyborg (SSD)
        b[0]="zyborg";
        b[1]=brs.match(/zyborg\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if (brs.search(/netscape6[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Netscape 6.x
        b[0]="netscape";
        b[1]=brs.match(/netscape6[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/netscape\/(7\.\d*)/) != -1) {
    // Netscape 7.x
        b[0]="netscape";
        b[1]=brs.match(/netscape\/(7\.\d*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/galeon[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Galeon
        b[0]="galeon";
        b[1]=brs.match(/galeon[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/nautilus[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Nautilus
        b[0]="nautilus";
        b[1]=brs.match(/nautilus[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/firefox[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Firefox
        b[0]="firefox";
        b[1]=brs.match(/firefox[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/k-meleon[\/\s](\d+([\.-]\d)*)/) != -1) {
    // K-Meleon
        b[0]="kmeleon";
        b[1]=brs.match(/k-meleon[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/playstation\s3/) != -1) {
    // Playstation 3
        b[0]="netfront";
        b[1]="2.81"; // Taken from the Wikipedia article
        b[2]="playstation3"
        b[3]=brs.match(/playstation\s3;\s(\d+\.\d+)/)[1];
        return b;
    } else if (brs.search(/firebird[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Firebird
        b[0]="firebird";
        b[1]=brs.match(/firebird[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/phoenix[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Phoenix
        b[0]="phoenix";
        b[1]=brs.match(/phoenix[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/camino[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Camino
        b[0]="camino";
        b[1]=brs.match(/camino[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/epiphany[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Epiphany
        b[0]="epiphany";
        b[1]=brs.match(/epiphany[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/chimera[\/\s](\d+([\.-]\d)*)/) != -1) {
    // Chimera
        b[0]="chimera";
        b[1]=brs.match(/chimera[\/\s](\d+([\.-]\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/icab[\s\/]?(\d+(\.?\d)*)/) !=-1) {
    // iCab
        b[0]="icab";
        b[1]=brs.match(/icab[\s\/]?(\d+(\.?\d)*)/)[1];
        b[2]="icab";
        b[3]=b[1];
        return b;
    } else if (brs.search(/netfront\/(\d+([\._]\d)*)/) != -1) {
    // NetFront
        b[0]="netfront";
        b[1]=brs.match(/netfront\/(\d+([\._]\d)*)/)[1];
        b[2]="netfront";
        b[3]=b[1];
        return b;
    } else if (brs.search(/netscape4\/(\d+([\.-]\d)*)/) != -1) {
    // Netscape 4.x
        b[0]="netscape";
        b[1]=brs.match(/netscape4\/(\d+([\.-]\d)*)/)[1];
        b[2]="mozold";
        b[3]=b[1];
        return b;
    } else if ( (brs.search(/mozilla\/(4.\d*)/) != -1) && (brs.search(/msie\s(\d+(\.?\d)*)/) == -1) ) {
        b[0]="netscape";
        b[1]=brs.match(/mozilla\/(4.\d*)/)[1];
        b[2]="mozold";
        b[3]=b[1];
        return b;
    } else if ((brs.search(/mozilla\/5.0/) != -1) && (brs.search(/gecko\//) != -1)) {
    // Mozilla Seamonkey
        b[0]="mozsea";
        b[1]=brs.match(/rv\x3a(\d+(\.?\d)*)/)[1];
        b[2]="gecko";
        b[3]=getGeckoVersion();
        return b;
    } else if (brs.search(/elinks/) != -1) {
    // ELinks
        b[0]="elinks";
        (brs.search(/elinks\/(\d+(\.?\d)*)/) == -1 ?
b[1]=brs.match(/elinks\s\x28(\d+(\.?\d)*)/)[1] :
b[1]=brs.match(/elinks\/(\d+(\.?\d)*)/)[1]);
        b[2]="elinks";
        b[3]=b[1];
        return b;
    } else if (brs.search(/w3m\/(\d+(\.?\d)*)/) != -1) {
    // w3m
        b[0]="w3m"
        b[1]=brs.match(/(^w3m|\sw3m)\/(\d+(\.?\d)*)/)[2];
        b[2]="w3m";
        b[3]=b[1];
        return b;
    } else if (brs.search(/links/) != -1) {
    // Links
        b[0]="links";
        (brs.search(/links\/(\d+(\.?\d)*)/) == -1 ? b[1]=brs.match(/links\s\x28(\d+(\.?\d)*)/)[1] : b[1]=brs.match(/links\/(\d+(\.?\d)*)/)[1]);
        b[2]="links";
        b[3]=b[1];
        return b;
    } else if (brs.search(/java[\/\s]?(\d+([\._]\d)*)/) != -1) {
    // Java (as web-browser)
        b[0]="java";
        b[1]=brs.match(/java[\/\s]?(\d+([\._]\d)*)/)[1];
        b[2]="java";
        b[3]=b[1];
        return b;
    } else if(brs.search(/lynx/) != -1) {
    // Lynx (SSD)
        b[0]="lynx";
        b[1]=brs.match(/lynx\/(\d+(\.?\d)*)/)[1];
        b[2]="libwww-fm";
        b[3]=brs.match(/libwww-fm\/(\d+(\.?\d)*)/)[1];
        return b;
    } else if(brs.search(/dillo/) != -1) {
    // Dillo (SSD)
        b[0]="dillo";
        b[1]=brs.match(/dillo\s*\/*(\d+(\.?\d)*)/)[1];
        b[2]="dillo";
        b[3]=b[1];
        return b;
    } else if(brs.search(/wget/) != -1) {
    // wget (SSD)
        b[0]="wget";
        b[1]=brs.match(/wget\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if(brs.search(/googlebot\-image/) != -1) {
    // GoogleBot-Image (SSD)
        b[0]="googlebotimg";
        b[1]=brs.match(/googlebot\-image\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if(brs.search(/googlebot/) != -1) {
    // GoogleBot (SSD)
        b[0]="googlebot";
        b[1]=brs.match(/googlebot\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if(brs.search(/msnbot/) != -1) {
    // MSNBot (SSD)
        b[0]="msnbot";
        b[1]=brs.match(/msnbot\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else if(brs.search(/turnitinbot/) != -1) {
    // Turnitin (SSD)
        b[0]="turnitinbot";
        b[1]=brs.match(/turnitinbot\/(\d+(\.?\d)*)/)[1];
        b[2]="robot";
        b[3]="-1"
        return b;
    } else {
        b[0]="unknown";
        return b;
    }
}

// Return browser's (actual) major version or -1 if bad version entered
function getMajorVersion(v) {
    return (isEmpty(v) ? -1 : (hasDot(v) ? v : v.match(/(\d*)(\.\d*)*/)[1]))
}

// Return browser's (actual) minor version or -1 if bad version entered
function getMinorVersion(v) {
    return (!isEmpty(v) ? (!hasDot(v) ? v.match(/\.(\d*([-\.]\d*)*)/)[1] : 0) :
-1)
}

// Return operating system we are running on top of
function getOS(obj) {

    var os=new Array("unknown", "unknown");

    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);

    if (brs.search(/windows\sce/) != -1) {
        os[0]="wince";
        try {
            os[1]=brs.match(/windows\sce\/(\d+(\.?\d)*)/)[1];
        } catch (e) { }
        return os;
    } else if ( (brs.search(/windows/) !=-1) || ((brs.search(/win9\d{1}/) !=-1))
) {
        os[0]="Windows";
        if (brs.search(/nt\s5\.1/) != -1) {
            os[1]="XP";
        } else if (brs.search(/nt\s5\.0/) != -1) {
            os[1]="2000";
        } else if ( (brs.search(/win98/) != -1) || (brs.search(/windows\s98/)!=
-1 ) ) {
            os[1]="98";
        } else if (brs.search(/windows\sme/) != -1) {
            os[1]="me";
        } else if (brs.search(/nt\s5\.2/) != -1) {
            os[1]="win2k3";
        } else if ( (brs.search(/windows\s95/) != -1) || (brs.search(/win95/)!=
-1 ) ) {
            os[1]="95";
        } else if ( (brs.search(/nt\s4\.0/) != -1) || (brs.search(/nt4\.0/) ) !=
-1) {
            os[1]="nt4";
        }

        return os;
    } else if (brs.search(/linux/) !=-1) {
        os[0]="linux";
        try {
            os[1] = brs.match(/linux\s?(\d+(\.?\d)*)/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/mac\sos\sx/) !=-1) {
        os[0]="macosx";
        return os;
    } else if (brs.search(/freebsd/) !=-1) {
        os[0]="freebsd";
        try {
            os[1] = brs.match(/freebsd\s(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/sunos/) !=-1) {
        os[0]="sunos";
        try {
            os[1]=brs.match(/sunos\s(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/irix/) !=-1) {
        os[0]="irix";
        try {
            os[1]=brs.match(/irix\s(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/openbsd/) !=-1) {
        os[0]="openbsd";
        try {
            os[1] = brs.match(/openbsd\s(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if ( (brs.search(/macintosh/) !=-1) || (brs.search(/mac\x5fpowerpc/)
!= -1) ) {
        os[0]="macclassic";
        return os;
    } else if (brs.search(/os\/2/) !=-1) {
        os[0]="os2";
        try {
            os[1]=brs.match(/warp\s((\d(\.\d)*)*)/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/openvms/) !=-1) {
        os[0]="openvms";
        try {
            os[1]=brs.match(/openvms\sv((\d(\.\d)*)*)/)[1];
        } catch (e)  { }
        return os;
    } else if ( (brs.search(/amigaos/) !=-1) || (brs.search(/amiga/) != -1) ) {
        os[0]="amigaos";
        try {
            os[1]=brs.match(/amigaos\s?(\d(\.\d)*)*/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/hurd/) !=-1) {
        os[0]="hurd";
        return os;
    } else if (brs.search(/hp\-ux/) != -1) {
        os[0]="hpux";
        try {
            os[1]=brs.match(/hp\-ux\sb\.[\/\s]?(\d+([\._]\d)*)/)[1];
        } catch (e) { }
        return os;
    } else if ( (brs.search(/unix/) !=-1) || (brs.search(/x11/) != -1 ) ) {
        os[0]="unix";
        return os;
    } else if (brs.search(/cygwin/) !=-1) {
        os[0]="cygwin";
        return os;
    } else if (brs.search(/java[\/\s]?(\d+([\._]\d)*)/) != -1) {
        os[0]="java";
        try {
            os[1]=brs.match(/java[\/\s]?(\d+([\._]\d)*)/)[1];
        } catch (e) { }
        return os;
    } else if (brs.search(/palmos/) != -1) {
        os[0]="palmos";
        return os;
    } else if (brs.search(/symbian\s?os\/(\d+([\._]\d)*)/) != -1) {
        os[0]="symbian";
        try {
            os[1]=brs.match(/symbian\s?os\/(\d+([\._]\d)*)/)[1];
        } catch (e) { }
        return os;
    } else {
        os[0]="unknown";
        return os;
    }
}

// Return Gecko version
function getGeckoVersion() {
    return brs.match(/gecko\/([0-9]+)/)[1];
}

// Return MSIE version
function getMSIEVersion() {
    
    return brs.match(/msie\s(\d+(\.?\d)*)/)[1];
}

// Return full browser UA string
function getFullUAString(obj) {
    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);
    return brs;
}

function getFlashVersion(object){

                var f= "";
                
                f = "Not Installed/Unknown";
                //IE activeX detection
                document.writeln('<script language="VBscript">');
                document.writeln('Function detectActiveXControl(activeXControlName)');
                document.writeln('  on error resume next');
                document.writeln('  detectActiveXControl = False');
                document.writeln('  detectActiveXControl = IsObject(CreateObject(activeXControlName))');
                document.writeln('End Function');
                
                document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
	            document.writeln('detectableWithVB = False');
	            document.writeln('If ScriptEngineMajorVersion >= 2 then');
	            document.writeln('  detectableWithVB = True');
	            document.writeln('End If');
	            
	            
	            document.writeln('Function VBGetSwfVer(i)');
                document.writeln('  on error resume next');
                document.writeln('Dim swControl, swVersion, aTest');
                document.writeln('swVersion = 0 ');
                document.writeln('set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i)) ');
                document.writeln('if (IsObject(swControl)) then ');
                document.writeln('swVersion = swControl.GetVariable("$version") ');
                document.writeln('aTest = Split(swVersion, " ", -1, 1)');
                document.writeln('end if ');
                document.writeln('VBGetSwfVer = Replace(aTest(1), ",", ".")');
                document.writeln('End Function');
                document.writeln('</scr'+'ipt>');
                
                
                var b = navigator.userAgent.toLowerCase();
               
                if ( (b.indexOf('msie') != -1) && (b.indexOf('win') != -1) && (b.indexOf('opera') == -1) ) {
                        
                        //IE
                       
                        
                        //IE6 and less
                        for (var i=3; i<15; i++)
                        {
                            if(detectActiveXControl("ShockwaveFlash.ShockwaveFlash."+i) == true)
                            f = VBGetSwfVer(i);

                        }
                        
                        
                } else {
                        
                        //Other browsers
                        if (navigator.plugins["Shockwave Flash"]) {
                                var pluginDesc = navigator.plugins["Shockwave Flash"].description;
                                f = pluginDesc; //parseInt( pluginDesc.charAt( pluginDesc.indexOf(".")-1 ) );
                                
                        }
                        
                        //webTV
                        if(b.indexOf("webtv/2.6") != -1) f = 4;
                        if(b.indexOf("webtv/2.5") != -1) f = 3;
                        if(b.indexOf("webtv") != -1) f = 2;
                        
                }
                
                return f        
        }
// Is Flash plug-in installed?
//function hasFlashPlugin(obj) {

//    (isEmpty(obj) ? brs=navigator.userAgent.toLowerCase() : brs=obj);

//    var f=new Array("0", "0");
//    var brwEng=getBrowser(obj)[2];
//    var opSys=getOS(obj)[0]; 

//    //if (getBrowser(obj)[2]!="msie") {
//    if ( (brwEng=="gecko") || (brwEng=="opera") || (brwEng=="khtml") || (brwEng=="mozold") || (opSys=="macosx") || (opSys=="macclassic") ) {
//        // Non-IE Flash plug-in detection

//        if (navigator.plugins && navigator.plugins.length) 
//        {
//            x = navigator.plugins["Shockwave Flash"];
//            if (x) 
//            {
//                f[0] = 2;
//                if (x.description) 
//                {
//                    y = x.description;
//                    f[1] = y.charAt(y.indexOf('.')-1);
//                }
//            } else {
//                f[0] = 1;
//            }
//            if (navigator.plugins["Shockwave Flash 2.0"]) {
//                f[0] = 2;
//                f[0] = 2;
//            }
//        } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
//            x = navigator.mimeTypes['application/x-shockwave-flash'];
//            if (x && x.enabledPlugin) {
//                f[0] = 2;
//            } else {
//                f[0] = 1;
//            }
//        }

//   return f;

//  } else if (brwEng=="msie") {
//      // IE flash detection.
//       for(var i=15; i>0; i--) {
//           try {
//               var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
//             
//               f[1] = i;
//               break;
//               //return;
//           } catch(e) { }
//       }

//       if (f[1]>0) {
//           f[0]=2
//       } else {
//           f[0]=1
//       }
//   return f;
//   } else {
//       f[0]=0;
//       f[1]=0;
//       return f;
//   }
//}

function detectALLPDF()
{
    
    var pdf = new Array("Not Installed/Unknown");
    
    pluginFound = detectPlugin('Adobe','Acrobat'); 
    
	// if not found, try to detect with VisualBasic
	if(!pluginFound) 
	{
		 var acrobat=new Object();

        acrobat.installed=false;
        acrobat.version='0.0';

        if (navigator.plugins && navigator.plugins.length)
        {
            for ( var x = 0, l = navigator.plugins.length; x < l; ++x ) 
            {
                if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1)
                {
                    acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]);

                    if (acrobat.version.toString().length == 1) acrobat.version+='.0';
                     
                    acrobat.installed=true;
                    pdf[0] = acrobat.version; 
                   
                    break;
                }
            }
        }
        else if (window.ActiveXObject)
        {
           
            for (x=2; x<10; x++)
            {
                try
                {
                    oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');");
                    if (oAcro)
                    {
                        acrobat.installed=true;
                        acrobat.version=x+'.0';
                        pdf[0] = acrobat.version; 
                       
                    }
                    
                    
                }
                catch(e) {}
            }
            
             try
            {
                oAcro4=new ActiveXObject('PDF.PdfCtrl.1');
                if (oAcro4)
                {
                    acrobat.installed=true;
                    acrobat.version='4.0';
                    pdf[0] = acrobat.version; 
                }
            }
            catch(e) {}
            

            try
            {
                oAcro7=new ActiveXObject('AcroPDF.PDF.1');
                if (oAcro7)
                {
                    acrobat.installed=true;
                    acrobat.version='7.0';
                    pdf[0] = acrobat.version; 
                }
            }
            catch(e) {}

            }

            
	}
	
	if (pluginFound)
	{
	    pdf[0] = pluginName; //pluginFound.toString();
	}
	// check for redirection
	return pdf;
}

// Here we write out the VBScript block for MSIE Windows

function detectPlugin() {
	// allow for multiple checks in a single pass
	var daPlugins = detectPlugin.arguments;
	// consider pluginFound to be false until proven true
	var pluginFound = false;
	// if plugins array is there and not fake
	if (navigator.plugins && navigator.plugins.length > 0) {
		var pluginsArrayLength = navigator.plugins.length;
		// for each plugin...
		for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
			// loop through all desired names and check each against the current plugin name
			var numFound = 0;
			for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
				// if desired plugin name is found in either plugin name or description
				if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
					(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
					// this name was found
				     
					pluginName = navigator.plugins[pluginsArrayCounter].description;
				
					numFound++;
				}   
			}
			// now that we have checked all the required names against this one plugin,
			// if the number we found matches the total number provided then we were successful
			if(numFound == daPlugins.length) {
				pluginFound = true;

				// if we've found the plugin, we can stop looking through at the rest of the plugins
				break;
			}
		}
	}
	return pluginFound;
} // detectPlugin


// Are pop-up windows allowed for this site? (i. e. has the user a pop-up blocker?)
function popupsAllowed() {
    var allowed = false;
    var w = window.open("about:blank","","directories=no,height=1,width=1,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,left=0,top=0,location=no");
    if (w) {
        allowed = true;
        w.close();
    }
    return allowed;
}
function getScreenResolution()
{
    var sr = "Unknown";
    
    if (self.screen)
    {
        return screen.width + " x " + screen.height;
    }else
    {
        return sr;
    }
   
}

    // To use, simple do: Get_Cookie('cookie_name'); 
    // replace cookie_name with the real cookie name, '' are required
    function Get_Cookie( check_name ) {
	    // first we'll split this cookie up into name/value pairs
	    // note: document.cookie only returns name=value, not the other components
	    var a_all_cookies = document.cookie.split( ';' );
	    var a_temp_cookie = '';
	    var cookie_name = '';
	    var cookie_value = '';
	    var b_cookie_found = false; // set boolean t/f default f
    	
	    for ( i = 0; i < a_all_cookies.length; i++ )
	    {
		    // now we'll split apart each name=value pair
		    a_temp_cookie = a_all_cookies[i].split( '=' );
    		
    		
		    // and trim left/right whitespace while we're at it
		    cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
    	
		    // if the extracted name matches passed check_name
		    if ( cookie_name == check_name )
		    {
			    b_cookie_found = true;
			    // we need to handle case where cookie has no value but exists (no = sign, that is):
			    if ( a_temp_cookie.length > 1 )
			    {
				    cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			    }
			    // note that in cases where cookie is initialized but no value, null is returned
			    return cookie_value;
			    break;
		    }
		    a_temp_cookie = null;
		    cookie_name = '';
	    }
	    if ( !b_cookie_found ) 
	    {
		    return null;
	    }
    }

    /*
    only the first 2 parameters are required, the cookie name, the cookie
    value. Cookie time is in milliseconds, so the below expires will make the 
    number you pass in the Set_Cookie function call the number of days the cookie
    lasts, if you want it to be hours or minutes, just get rid of 24 and 60.

    Generally you don't need to worry about domain, path or secure for most applications
    so unless you need that, leave those parameters blank in the function call.
    */
    function Set_Cookie( name, value, expires, path, domain, secure ) {

	    // set time, it's in milliseconds
	    var today = new Date();
	    today.setTime( today.getTime() );
	    // if the expires variable is set, make the correct expires time, the
	    // current script below will set it for x number of days, to make it
	    // for hours, delete * 24, for minutes, delete * 60 * 24
	    if ( expires )
	    {
		    expires = expires * 1000 * 60 * 60 * 24;
	    }
	    
	    var expires_date = new Date( today.getTime() + (expires) );
	    

	    document.cookie = name + "=" +escape( value ) +
		    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
		    ( ( path ) ? ";path=" + path : "" ) + 
		    ( ( domain ) ? ";domain=" + domain : "" ) +
		    ( ( secure ) ? ";secure" : "" );
    }

    // this deletes the cookie when called
    function Delete_Cookie( name, path, domain ) {
	    if ( Get_Cookie( name ) ) document.cookie = name + "=" +
			    ( ( path ) ? ";path=" + path : "") +
			    ( ( domain ) ? ";domain=" + domain : "" ) +
			    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
    }
function checkCookies()
{
       var c = "";
        
       // remember, these are the possible parameters for Set_Cookie:
        // name, value, expires, path, domain, secure
        Set_Cookie( 'test', 'none', '', '/', '', '' );
        // if Get_Cookie succeeds, cookies are enabled, since 
        //the cookie was successfully created.
        if ( Get_Cookie( 'test' ) )
        {
	        c = 'Enabled';
	       
	        /* 
	        this is an example of a set cookie variable, if 
	        you want to use this on the page or on another script 
	        instead of writing to the page you would just check that value
	        for true or false and then do what you need to do.
	        */
	        cookie_set = true;
	        // and these are the parameters for Delete_Cookie:
	        // name, path, domain
	        // make sure you use the same parameters in Set and Delete Cookie.
	        Delete_Cookie('test', '/', '');
        }
        // if the Get_Cookie test fails, cookies 
        //are not enabled for this session.
        else
        {
	       
	        c = 'Disabled';
	        cookie_set = false;
        }

        return c;

    }
    function isMsie()
{ 
    if ((navigator.userAgent.indexOf("MSIE") != "-1") && 
        (navigator.userAgent.length > 1)) {
       return true;
    } 
    else {
       return false;
    }
}

function versionWarning()
{
    var msg = "It has been determined that the WebBuy version on your machine \n";
    msg += " is not up to date to support electronic reading.";
    msg += "\n\nSelect:";
    msg += "\n\t Ok to visit the Adobe web site for software update, or ";
    msg += "\n\t Cancel if you want to update WebBuy plugin at a later time.";
    if (confirm(msg)) {
        var url = "http://www.adobe.com/prodindex/acrobat/readstep.html";
        windowprops = "height=500,width=500,location=yes, scrollbars=yes,menubars=yes,toolbars=yes,resizable=yes";
        window.open(url, "popupWnd", windowprops);
    }
}

function getVersions() {
    var version;
    var pdf = "Not Installed/Unknown";
    var acrobatInstalled = false;
    if (isMsie())
    { 	

        try
        {
            version = pdfObj.GetVersions().split(','); 
            
            version = version[0].split('=');   
            version = version[1]; 
            //pdf = version;  
            pdf = "Installed";
        }
        catch(e)
        {
        }
    }
    else
    {
       pluginFound = detectPlugin('Adobe','Acrobat'); 
       
       if (!pluginFound)
       {
           var acrobat=new Object();

            acrobat.installed=false;
            acrobat.version='0.0';

            if (navigator.plugins && navigator.plugins.length)
            {
                for ( var x = 0, l = navigator.plugins.length; x < l; ++x ) 
                {

                    if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1)
                    {
                       
                        acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]);

                        if (acrobat.version.toString().length == 1) acrobat.version+='.0';
                         
                        acrobat.installed=true;
                        //pdf = acrobat.version; 
                        pdf = "Installed";
                       
                        break;
                    }
                }
            }
        }
        else
        {
            pdf = "Installed";
        }
    }
    return pdf;
}
 function errorHandler(message, url, line) 
{
    var msg = "The system was not able to determine if the Acrobat running \n";
    msg += " on your system was the correct version or that it was missing some \n";
    msg += "components to continue.";
    msg += "\n\nSelect:";
    msg += "\n\t Ok to visit the Adobe web site for software update, or ";
    msg += "\n\t Cancel if you want to abort now.";
    if (confirm(msg)) {
        var url = "http://www.adobe.com/prodindex/acrobat/readstep.html";
        windowprops = "height=500,width=500,location=yes, scrollbars=yes,menubars=yes,toolbars=yes,resizable=yes";
        window.open(url, "popupWnd", windowprops);
    }
    return true;
}

function _jsVersion() {

    document.write('<script language="JavaScript1.0">');
    document.write('var jsVer=1.0;');
    document.write('</script>');

    document.write('<script language="JavaScript1.1">');
    document.write('var jsVer=1.1;');
    document.write('</script>');

    document.write('<script language="JavaScript1.2">');
    document.write('var jsVer=1.2;');
    document.write('</script>');

    document.write('<script language="JavaScript1.3">');
    document.write('var jsVer=1.3;');
    document.write('</script>');

    document.write('<script language="JavaScript1.4">');
    document.write('var jsVer=1.4;');
    document.write('</script>');

    document.write('<script language="JavaScript1.5">');
    document.write('var jsVer=1.5;');
    document.write('</script>');

    document.write('<script language="JavaScript1.6">');
    document.write('var jsVer=1.6;');
    document.write('</script>');

    document.write('<script language="JavaScript1.7">');
    document.write('var jsVer=1.7;');
    document.write('</script>');

    document.write('<script language="JavaScript1.8">');
    document.write('var jsVer=1.8;');
    document.write('</script>');

    document.write('<script language="JavaScript2.0">');
    document.write('var jsVer=2.0;');
    document.write('</script>');

}

// What is the newest version of Javascript does the browser report as supported?
function jsVersion() {
   _jsVersion(); 
   return jsVer;
}

/* FOR INTERNAL USE ONLY. THIS FUNCTIONS ARE SUBJECT TO CHANGE, DON'T TRUST THEM */
// Is input empty?
function isEmpty(input) {
    return (input==null || input =="")
}

// Does this string contain a dot?
function hasDot(input) {
    return (input.search(/\./) == -1)
}
/* END OF FOR INTERNAL USE ONLY FUNCTIONS */

