﻿var bIEFlashEnabled;

var vBrowserContent;
var vOpSystem;

var req_WIN_IE    = "5.5, 6 or 7";
var req_WIN_IE_MP = "6.4, 7 or 9";
var req_WIN_IE_SW = "5.0";

var req_MAC_IE    = "5.2";
var req_MAC_IE_MP = "6.4, 7.1 or 9.0";
var req_MAC_IE_SW = "5.0";

var req_WIN_NN    = "7.2";
var req_WIN_NN_SW = "5.0";
var req_WIN_NN_MP = "9 or 10";

var req_WIN_FF    = "1.x or 2.0";
var req_WIN_FF_SW = "5.0";
var req_WIN_FF_MP = "9 or 10";

var req_MAC_NN    = "7.2 and above";
var req_MAC_NN_MP = "9.0";
var req_MAC_NN_SW = "5.0";
var req_MAC_NN_QT = "6.4";

var flashversion;
var vToDo;
var vToDoAlert;

var BROWSER;

var bBrowserCont = true;

function BrowserConfig()
{
  this.appName = navigator.userAgent
  this.appVer  = navigator.appVersion
  this.dom  = document.getElementById ? 1 : 0
  this.ostype = "UN";
  this.bwinfo = "";
  this.flashInfo = "";
  this.audInfo = "";

  this.type = ( this.appName.indexOf( 'MSIE' ) != -1 ? 'IE' : this.appName.indexOf( 'Netscape' ) != -1 ? 'NN' : this.appName.indexOf( 'Firefox' ) != -1 ? 'FF' : 'UN' )

  if( this.type == 'IE' )
  {
    this.verno = this.appVer.indexOf( "MSIE 5.5" ) > -1 ? '5.5' : this.appVer.indexOf( "MSIE 6.0" ) > -1 ? '6.0' : this.appVer.indexOf( "MSIE 7.0" ) > -1 ? '7.0' : '0.0'
    this.bwinfo = "Microsoft Internet Explorer ( Version " + this.verno + " )" 
  }
  else if( this.type == 'NN' ) 
  {
    this.verno = parseFloat( navigator.userAgent.split('/')[3] )
    this.bwinfo = "Netscape Navigator ( Version " + this.verno + " )"
  }
  else if( this.type == 'FF' ) 
  {
    this.verno = parseFloat( navigator.userAgent.split('/')[3] )
    this.bwinfo = "Mozilla Firefox ( Version " + this.verno + " )"
  }

  this.ie = this.type == 'IE' && parseFloat( this.verno ) >= 5.5 && this.dom ? 1 : 0;
  this.ns = this.type == 'NN' && parseFloat( this.verno ) >= 7.2 && this.dom ? 1 : this.type == 'FF' && parseFloat( this.verno ) >= 1.0 && this.dom ? 1 : 0;

if ( this.appVer.indexOf( "Win" ) != -1 )
  {
    this.osname = "Microsoft Windows";
    this.ostype = "WIN";
  }

  if ( this.appVer.indexOf( "Mac" ) != -1 )
  {
    this.osname = "Macintosh";
    this.ostype = "MAC";
  }

  return this
}

var bw = BrowserConfig();

// Check for OS
function isOpSystemOK()
{
  bw = BrowserConfig()

  vOpSystem = "Operating System detected : " + bw.osname;

  vBrowserContent = "<tr><td><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">Course Requirements</font></td><td ><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">Course requires...</font></td><td ><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">Your system has...</font></td><td ><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">Status </font></td></tr>";

  vToDo = "";

  if( bw.ostype == 'WIN' || bw.ostype == 'MAC' )
    return true;
  else
  {
    vBrowserContent = "";
    vToDo += "<p align=center><font style=\"font-family:verdana;font-size:10pt;\">WTDS Courseware is supported on <br><b>\\'Microsoft Windows 2000\\'</b> and <b>\\'Microsoft Windows XP\\'</b> <br>operating Systems only.<br><br> Please check the WTDS Compatibility Table below.</font>";
    return false;
  }
}

// Check for Browser
function isBrowserOK()
{
  bw = BrowserConfig()

  vToDo = "";
  vCheck = "";

  if ( bw.ostype == 'MAC' )
  {
    if(  bw.type == 'UN' || bw.type == 'FF' || bw.type == 'IE' || ( bw.type == 'NN' && bw.verno == undefined ) )
    {
      vToDo = "<p align=center><font style=\"font-family:verdana;font-size:10pt;\">The browser your are using is not supported for WTDS Courseware. <br><br>Please install <a href=\\'http://channels.netscape.com/ns/browsers/download.jsp\\' target=new>Netscape Navigator</a> ( version 7.2 and above ).<br><br> For more details, please check compatibility table below.</font></p>";
      return false;
    }
    else if ( bw.type == 'NN' && !bw.ns )
    {
      vToDo = "<p align=center><font style=\"font-family:verdana;font-size:10pt;\">The Netscape Navigator( version "+bw.verno+") browser your are using is not supported for WTDS Courseware. <br><br>Please install <a href=\\'http://channels.netscape.com/ns/browsers/download.jsp\\' target=new>Netscape Navigator</a> ( version 7.2 and above ).<br><br> For more details, please check compatibility table below.</font></p>";
      return false;
    }
    else
      vCheck = "<td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
  }

  if ( bw.ostype == 'WIN' )
  {
    if( bw.ns || bw.ie )
    {
      vCheck = "<td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
    }
    else
    {
      vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For browser</font><br><font style=\"font-family:verdana;font-size:8pt;\">You need one of the following browsers for WTDS courses.<br>&nbsp;&nbsp;-&nbsp;<a href=\\'http://www.microsoft.com/windows/ie/downloads/default.mspx\\' target=new>Microsoft Internet Explorer</a> (ver 5.5 and above)<br>&nbsp;&nbsp;-&nbsp;<a href=\\'http://channels.netscape.com/ns/browsers/download.jsp\\' target=new>Netscape Navigator</a> (ver 7.2 and above).<br>&nbsp;&nbsp;-&nbsp;<a href=\\'http://www.mozilla.com/firefox/\\' target=new>Mozilla Firefox</a> (ver 1.0.6 and above).<br>For more details, please check compatibility table below.</font></p>";
      return false;
    }
  }

  vBrowserContent += "<tr><td><font style=\"font-family:verdana;font-size:8pt;\">"+bw.appName+"</font></td><td><font style=\"font-family:verdana;font-size:8pt;\">Version "+ eval( "req_"+bw.ostype+"_"+bw.type ) +"</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">Version "+ bw.verno +"</font></td>" + vCheck;

  return ( bw.ns || bw.ie )
}

// Check for Browser
function isBrowserOKStart()
{
  bw = BrowserConfig()

  vToDo = "";
  vToDoAlert = "";

  if( !( bw.ns || bw.ie ) )
  {
    vToDo += "<font style=\"font-family:verdana;font-size:8pt;font-weight:bold;color:red;\">Incompatible Browser</font><br><font style=\"font-family:verdana;font-size:8pt;\">You need one of the following browsers for WTDS courses.<br>&nbsp;&nbsp;-&nbsp;Microsoft Internet Explorer (ver 5.5 and above) for Microsoft Windows 2000, XP<br>&nbsp;&nbsp;-&nbsp;Netscape Navigator (ver 7.2 and above) for Microsoft Windows 2000, XP<br>&nbsp;&nbsp;-&nbsp;Netscape Navigator (ver 7.2 and above) for Macintosh</font><br><br>";

    vToDoAlert += "Incompatible Browser\n\nYou need one of the following browsers for WTDS courses.\n\t- Microsoft Internet Explorer (ver 5.5 and above) for Microsoft Windows 2000, XP\n\t- Netscape Navigator (ver 7.2 and above) for Microsoft Windows 2000, XP\n\t- Netscape Navigator (ver 7.2 and above) for Macintosh";
  }

  return ( bw.ns || bw.ie )
}

// Check for Browser Cookie Enabled
function isCookiesEnabled()
{
  bw = BrowserConfig()

  bRet = navigator.cookieEnabled
  if ( bRet )
    bRet = cookiesEnabled();

  vBrowserContent += "<tr><td><font style=\"font-family:verdana;font-size:8pt;\">Browser Cookies Enabled</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">Yes</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">"+ ( bRet ? "Yes" : "No" ) +"</font></td>";
  if ( bRet )
  {
    vBrowserContent += "<td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
  }
  else
  {
    vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For browser cookies</font><br><font style=\"font-family:verdana;font-size:8pt;\">Cookies are disabled for your "+bw.bwinfo+" broswer. Please enable them. Help available on <a href=# onclick=\"window.open(\\'http://www.trainurself.de/offline/htm/faqs/faqs.htm#Q_2\\')\", \\'faq\\', \\'left=50,top=50,width=750,height=600,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0\\' )> FAQs.</a><br>For more details, please check compatibility table below. </font><br>";
    vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";
  }

  return bRet;
}

// Check for Browser Java Enabled
function isJavaEnabled() {

  bw = BrowserConfig()

  if ( bw.ostype == "MAC" ) return true;

  vBrowserContent += "<tr><td><font style=\"font-family:verdana;font-size:8pt;\">Browser Java Enabled</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">Yes</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">"+ ( navigator.javaEnabled() ? "Yes" : "No" ) +"</font></td>";

  if ( navigator.javaEnabled() )
  {
    vBrowserContent += "<td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
  }
  else
  {
    vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For browser JAVA</font><br><font style=\"font-family:verdana;font-size:8pt;\">JAVA is disabled for your "+bw.bwinfo+" broswer. Please enable it. Help available on <a href=# onclick=\"window.open(\\'http://www.trainurself.de/offline/htm/faqs/faqs.htm#Q_4\\')\", \\'faq\\', \\'left=50,top=50,width=750,height=600,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0\\' )> FAQs.</a><br>For more details, please check compatibility table below. </font><br>";
    vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";
  }

  return navigator.javaEnabled();
}

// Check for Browser Sockwave Flash Enabled
function isFlashEnabled()
{
  bw = BrowserConfig()

  var isFlashOk = true;

  vBrowserContent += "<tr><td><font style=\"font-family:verdana;font-size:8pt;\">Macromedia Shockwave Flash Plugin</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">Version "+ eval( "req_"+bw.ostype+"_"+bw.type+"_SW" ) +" and above</font></td>";

  var flashinstalled = false;
  MSDetect = "false";

  if ( bw.type == 'NN' || bw.type == 'FF' )
  {
    flashObj = navigator.plugins[ "Shockwave Flash" ];
    if ( flashObj )
    {
      flashinstalled = true;
      if ( flashObj.description )
      {
        flashDesc = flashObj.description;
        flashversion = flashDesc.charAt( flashDesc.indexOf( '.' ) - 1 );
        bw.flashInfo = flashDesc
      }
    }
    else
      flashinstalled = false;

    if ( navigator.plugins[ "Shockwave Flash 2.0" ] )
    {
      flashinstalled = true;
      flashversion = 2;
      bw.flashInfo = "Shockwave Flash 2.0"
    }
  }
  else if ( bw.type == 'IE' )
  {
    flashinstalled = CheckIEActiveXForFlash();
    bw.flashInfo = "Shockwave Flash " + flashversion
  }

  vBrowserContent += "<td><font style=\"font-family:verdana;font-size:8pt;\">Version "+ flashversion +"</font></td>";
  if ( flashinstalled )
  {
    if ( flashversion >= parseFloat( eval( "req_"+bw.ostype+"_"+bw.type+"_SW" ) ) )
    {
      vBrowserContent += "<td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
    }
    else
    {
      isFlashOk = false;
      vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";
    }
  }
  else
  {
    isFlashOk = false;
    vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";
  }

  if ( !isFlashOk )
  {
    if ( bw.ie )
    {
      vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For Shockwave Flash</font><br><font style=\"font-family:verdana;font-size:8pt;\">You do not have right version of Shockwave flash plugin installed OR your browser may be having difficulty locating the Macromedia Shockwave Flash plugin.<br>To check for the installed version, <br>&nbsp;&nbsp;-&nbsp;Under the <b>Tools</b> menu, choose <b>Internet Options</b>.<br>&nbsp;&nbsp;-&nbsp;Click the <b>Security</b> tab at the top of the <b>Internet Options</b> panel.<br>&nbsp;&nbsp;-&nbsp;Click <b>Settings</b> button and then <b>View Objects</b> button. Here you can see the activex installed for Explorer.<br>&nbsp;&nbsp;-&nbsp;Check for <b>Shockwave Flash Object</b>, if present <b>right click</b> on it and select <b>Properties</b> from menu.<br>&nbsp;&nbsp;-&nbsp;Check the <b>Version</b> tab on newly opened window</font><br><font style=\"font-family:verdana;font-size:8pt;\">If you do not have the right version of Macromedia Shockwave Flash plugin installed. Go to the <a href=\\'http://www.macromedia.com\\' target=new>Macromedia Website</a> and install the right version as listed.<br>For more details, please check compatibility table below.</font>"
    }
    if ( bw.ns )
    {
      vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For Shockwave Flash</font><br><font style=\"font-family:verdana;font-size:8pt;\">You do not have right version of Shockwave flash plugin installed OR your browser may be having difficulty locating the Macromedia Shockwave Flash plugin. <br>To check for the installed version, <br>&nbsp;&nbsp;-&nbsp;Under the <b>Help</b> menu, choose <b>About Plug-ins</b>. This will show the list of Installed plug-ins for Netscape. <br>&nbsp;&nbsp;-&nbsp;Now search for Shockwave Flash entry.<br>If you do not have the right version of Macromedia Shockwave Flash plugin installed. Go to the <a href=\\'http://www.macromedia.com\\' target=new>Macromedia Website</a> and install the right version as listed.<br>For more details, please check compatibility table below.</font>"
    }
  }
  return isFlashOk;
}

// Check for Browser Windows Media Player Enabled
function isAudioEnabled()
{
   bw = BrowserConfig()

   var vMpVersion = "";
   var quicktimeVersion = "";

   var isAudioOk = false;

   if ( bw.ostype == 'MAC' )
   {
     vBrowserContent += "<tr><td><font style=\"font-family:verdana;font-size:8pt;\">QuickTime player</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">Version "+ eval( "req_"+bw.ostype+"_"+bw.type+ "_QT" ) + "</font></td>";

     if( bw.type == 'NN' )
     {
        // NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Quicktime plugin in plugin array
        if ( navigator.plugins != null && navigator.plugins.length > 0 ) 
        {
          for ( i=0; i < navigator.plugins.length; i++ ) 
          {
             var plugin = navigator.plugins[i];
             if ( plugin.name.indexOf( "QuickTime" ) > -1 ) 
             {
               quicktimeVersion = parseFloat( plugin.name.substring(18) );
             }
          }
        }
     }

     if ( quicktimeVersion == "" )
     {
       vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For QuickTime player</font><br><font style=\"font-family:verdana;font-size:8pt;\">You do not have QuickTime Player installed on your system OR Netscape Navigator may be having difficulty locating the QuickTime player Plugin.<br>&nbsp;&nbsp;1.&nbsp;If QuickTime player is not installed on your system, you can download it from <a href=\\'http://www.apple.com/quicktime/download/\\' target=new>here</a> and install.<br>&nbsp;&nbsp;2.&nbsp;If QuickTime player is installed on your system, check for the installed plugins for Netscape Navigator, <br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Under the <b>Help</b> menu, choose <b>About Plug-ins</b>. This will show the list of Installed plug-ins for Netscape. <br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Now search for QuickTime Player entry.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If not present, the problem can be solved by uninstalling and installing the QuickTime Player again.<br>&nbsp;&nbsp;3.&nbsp;If you have installed Netscape Navigator after QuickTime Player, you will need to re-install QuickTime Player again.<br>For more details, please check compatibility table below.</font>";

       vBrowserContent += "<td><font style=\"font-family:verdana;font-size:8pt;\">Not installed</font></td><td>";

       isAudioOk = false;
     }
     else if ( quicktimeVersion >= 6.4 )
     {
       vBrowserContent += "<td><font style=\"font-family:verdana;font-size:8pt;\"Version "+quicktimeVersion+"</font></td><td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
       isAudioOk = true;
     }
     else
     {
       vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For QuickTime Player</font><br><font style=\"font-family:verdana;font-size:8pt;\">You do not have right version of \\'QuickTime player\\' installed on your system. Please download it from <a href=\\'http://www.apple.com/quicktime/download/\\' target=\\'new\\'>here</a> and install.<br>For more details, please check compatibility table below.</font>";

       vBrowserContent += "<td><font style=\"font-family:verdana;font-size:8pt;\"Version "+quicktimeVersion+"</font></td>";
  
       isAudioOk = false;
     }

     vMpVersion = quicktimeVersion;

     if ( !isAudioOk )
     {
       vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";
     }

     bw.audInfo = "QuickTime Player ( Version " + quicktimeVersion + " )" 
   }

   if ( bw.ostype == 'WIN' )
   {
     vBrowserContent += "<tr><td><font style=\"font-family:verdana;font-size:8pt;\">Microsoft Windwos Media player</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">Version "+ eval( "req_"+bw.ostype+"_"+bw.type+ "_MP" ) + "</font></td>";

     if( bw.type == 'NN' || bw.type == 'FF' )
     {
       try
       {
         audioObject = GeckoActiveXObject( "MediaPlayer.MediaPlayer.1" );
         if ( audioObject )
         {
           isAudioOk = true;
           vMpVersion = "6.4";
         }
       }
       catch ( ex )
       {
         isAudioOk = false;
       }

       if ( !isAudioOk )
       {
         try
         {
           audioObject = new GeckoActiveXObject( "WMPlayer.OCX.7" );
           if ( audioObject )
           {
             isAudioOk = true;
             vMpVersion = audioObject.versionInfo
           }
         }
         catch ( ex )
         {
           isAudioOk = false;
         }
       }

       if ( !isAudioOk )
       {
         if( bw.type == 'FF' )
           vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For Windows Media player</font><br><font style=\"font-family:verdana;font-size:8pt;\">You do not have Windods Media Player installed on your system OR Firefox browser may be having difficulty locating the Windows Media player ActiveX.<br><OL><LI>If Windows Media player is not installed on your system, you can download it from <a href=\\'http://www.microsoft.com/windows/windowsmedia/player/version64/plugin.aspx\\' target=new>here</a> and install.<LI>If Windows Media player is installed on your system, check for the installed plugins and activex support for Firefox browser with following steps. <br>Type <b>about:plugins</b> into the address bar. This will show the list of Installed plug-ins for Firefox. <br><UL><LI>Now search for \\'<b>Microsoft Windows Media Player Firefox Plugin</b>\\' or \\'<b>Windows Media Player Plug-in Dynamic Link Library</b>\\' entry. If the <b>\\'application/x-mplayer2\\'</b> is present, means the \\'<b>Windows Media Player Plug-in</b>\\' is installed correctly. If not present, the problem can be solved by installing it from <a href=\\'http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx\\'>this</A> website.<LI>Now search for \\'<b>Mozilla ActiveX control and plugin support</b>\\' entry. If the <b>\\'application/x-oleobject\\'</b> is present, then the ActiveX support is installed correctly. If not present, the problem can be solved by referring to <a href=\\'http://forums.mozillazine.org/viewtopic.php?t=206213\\' target=new>this</a> website help link or do the following<br>Steps to install \\'<b>ActiveX control and plugin support</b>\\' for Firefox<OL><LI>Right click <a href=\\'http://www.iol.ie/~locka/mozilla/mozactivex-ff-15.xpi\\'>here</A> and save target as \\'mozactivex-ff-15.xpi\\'<LI>Open Firefox and drag and drop mozactivex-ff-15.xpi onto it.<LI>Complete the installation and close and open Firefox again</OL></UL></OL>For more details, please check compatibility table below.</font>"
        else
           vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For Windows Media player</font><br><font style=\"font-family:verdana;font-size:8pt;\">You do not have Windods Media Player installed on your system OR Netscape Navigator may be having difficulty locating the Windows Media player plugin.<br>&nbsp;&nbsp;1.&nbsp;If Windows Media player is not installed on your system, you can download it from <a href=\\'http://www.microsoft.com/windows/windowsmedia/9series/player.aspx\\' target=new>here</a> and install.<br>&nbsp;&nbsp;2.&nbsp;If Windows Media player is installed on your system, check for the installed plugins for Netscape Navigator, <br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Under the <b>Help</b> menu, choose <b>About Plug-ins</b>. This will show the list of Installed plug-ins for Netscape. <br>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Now search for Windows Media Player entry.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If not present, the problem can be solved by uninstalling and installing the Windows Media Player again.<br>&nbsp;&nbsp;3.&nbsp;If you have installed Netscape Navigator after Windows Media Player, you will need to re-install Windows Media Player again.<br>For more details, please check compatibility table below.</font>"
       }
     }
     else if( bw.type == 'IE' )
     {
       try
       {
         audioObject = ActiveXObject( "MediaPlayer.MediaPlayer.1" );
         if ( audioObject )
         {
           isAudioOk = true;
           vMpVersion = "6.4";
         }
       }
       catch ( ex )
       {
         isAudioOk = false;
       }

       if ( !isAudioOk )
       {
         try
         {
           audioObject = new ActiveXObject( "WMPlayer.OCX.7" );
           if ( audioObject )
           {
             isAudioOk = true;
             vMpVersion = audioObject.versionInfo
           }
         }
         catch ( ex )
         {
           isAudioOk = false;
         }
       }

       if( !isAudioOk )
       {
         isAudioOk = CheckIEActiveXForMedia()
         vMpVersion = "6.4";
       }

       if ( !isAudioOk )
       {
         vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For Windows Media Player</font><br><font style=\"font-family:verdana;font-size:8pt;\">You do not have <b>Microsoft Windows Media player ActiveX</b> installed on your system. Please download it from <a href=\\'http://www.microsoft.com/windows/windowsmedia/9series/player.aspx\\' target=\\'new\\'>here</a> and install.<br>For more details, please check compatibility table below.</font>";
       }
     }

     vBrowserContent += "<td><font style=\"font-family:verdana;font-size:8pt;\">Version "+vMpVersion+"</font></td>";

     if ( !isAudioOk )
     {
       vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";
       return false;
     }

     if ( isAudioOk && parseFloat( vMpVersion ) == 6.4 || parseFloat( vMpVersion ) == 7.1 || parseFloat( vMpVersion ) == 9 )
     {
       vBrowserContent += "<td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
     }
     else
     {
       vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";

       vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For Windows Media Player</font><br><font style=\"font-family:verdana;font-size:8pt;\">You do not have right version of \\'Microsoft Windows Media player\\' installed on your system. Please download it from <a href=\\'http://www.microsoft.com/windows/windowsmedia/9series/player.aspx\\' target=\\'new\\'>here</a> and install.<br>For more details, please check compatibility table below.</font>";
     }

     bw.audInfo = "Windows Media Player ( Version " + vMpVersion + " )"
   }

   BROWSER = "#" + bw.ostype + "#" + bw.type + "#" + vMpVersion + "#";

   return isAudioOk;
}

// Check for Screen resolution
function isResolutioinOK( pvBrowser, pvHeight, pvWidth )
{
   bw = BrowserConfig()

   vBrowserContent += "<tr><td><font style=\"font-family:verdana;font-size:8pt;\">Screen Resolution</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">"+ pvWidth + "x" + pvHeight +"</font></td><td ><font style=\"font-family:verdana;font-size:8pt;\">"+ screen.width + "x" + screen.height +"</font></td>";

   var bRet = true;

   if ( pvBrowser == "default" )
   {
     if( screen.width > pvWidth && screen.height > pvHeight )
     {
       vBrowserContent += "<td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
     }
     else
     {
       bRet = false;
       vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";
       vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For Screen resolution</font><br><font style=\"font-family:verdana;font-size:8pt;\">Screen resolution of your system is not compatible with this courseware. Please change them as per the compatibility table.<br>For more details, please check compatibility table below.</font>";
     }
   }

   if ( pvBrowser == "fullscreen" )
   {
     if( screen.width >= pvWidth && screen.height >= pvHeight )
     {
       vBrowserContent += "<td><font style=\"font-family:verdana;color:green;font-size:8pt;\">OK</font></td></tr>";
     }
     else
     {
       bRet = false;
       vBrowserContent += "<td><font style=\"font-family:verdana;color:red;font-size:8pt;\">Not OK</font></td></tr>";
       vToDo += "<p align=left><font style=\"font-family:verdana;font-size:8pt;font-weight:bold;\">For Screen resolution</font><br><font style=\"font-family:verdana;font-size:8pt;\">Screen resolution of your system is "+screen.width+"x"+screen.height+", which is not compatible with this course resolution <b>\""+pvWidth+"x"+pvHeight+"\"</b>. Please change them as per the compatibility table.<br>For more details, please check compatibility table below.</font>";
     }
   }

   return bRet;
}


function isSystemOK( pvBrowser, pvHeight, pvWidth )
{
  var bIsSystemOK = true;

  if ( !isOpSystemOK() )
  {

    bBrowserCont = true;
    return false;
  }
  if ( !isBrowserOK() )
  {
    bBrowserCont = true;
    return false;
  }
  if ( !isResolutioinOK( pvBrowser, pvHeight, pvWidth ) )
  {
     bIsSystemOK = false;
  }

  if ( !isJavaEnabled() )
  {
    bIsSystemOK = false;
  }

  if ( !isCookiesEnabled() )
  {
    bIsSystemOK = false;
  }
  /*
  if ( !isFlashEnabled() )
  {
    bIsSystemOK = false;
  }
  */
  if ( !isAudioEnabled() )
  {
    bIsSystemOK = false;
  }
  return true;
}

function getBrowserContent()
{
  return '<HTML><HEAD>' +
         '<BODY>' +
         '<blink><FONT style="font-family:Verdana;font-size:12pt;font-weight:bold;color:red;">LMS System Check Failure</FONT></blink>' +
         '<br><br><font style="font-family:Verdana;font-size:8pt;font-weight:bold;color:black;">'+vOpSystem+'</b></font><br>' +   ( bBrowserCont ?
         '<br><table BORDER=1 CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH="70%" >' +
         vBrowserContent +
         '</table>' : "" ) + "<br>" + vToDo +
         '<br><FONT style="font-family:Verdana;font-size:9pt;font-weight:bold;color:blue;">WTDS Compatibility Table</FONT>'+
         '<table><tr><td><div style="background-color:red;width:20;height:10"></div></td><td><font style="font-size: 8pt; font-family: verdana;" size="-1">Not supported</font></td></tr></table></div>'+
         '<table style="width: 100%; text-align: left;" border="1" cellpadding="2" cellspacing="0">' +
         '<tr bgcolor="#AEAEFF">' +
         '<td style="vertical-align: top;"><font style="font-weight: bold; font-size: 8pt; font-family: verdana;" size="-1">Operating System</font></td>' +
         '<td style="vertical-align: top;"><font style="font-weight: bold; font-size: 8pt; font-family: verdana;" size="-1">Browser</font></td>' +
         '<td style="vertical-align: top;"><font style="font-weight: bold; font-size: 8pt; font-family: verdana;" size="-1">Audio / Video Player</font></td>' +
         '<td style="vertical-align: top;"><font style="font-weight: bold; font-size: 8pt; font-family: verdana;" size="-1">Flash Activex</font></td>' +
         '<td width="10%" style="vertical-align: top;"><font style="font-weight: bold; font-size: 8pt; font-family: verdana;" size="-1">Browser Cookies Enabled</font></td>' +
         '<td width="10%" style="vertical-align: top;"><font style="font-weight: bold; font-size: 8pt; font-family: verdana;" size="-1">Browser Java Enabled</font></td>' +
         '<td width="10%" style="vertical-align: top;"><font style="font-weight: bold; font-size: 8pt; font-family: verdana;" size="-1">Browser Pop-up Enabled</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;" rowspan="4"><font style="font-size: 8pt; font-family: verdana;" size="-1">Microsoft Windows 2000</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Microsoft Internet Explorer<br>Version: 5.5</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Windows Media Player 6.4<br>Windows Media Player 7.1<br>Windows Media Player 9<br><font style="color:red;">Windows Media Player 10</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Microsoft Internet Explorer<br> Version: 6.0 with SP1, 7.0</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Windows Media Player 6.4<br>Windows Media Player 7.1<br>Windows Media Player 9<br>Windows Media Player 10</td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Netscape Navigator <br> Version: 7.2</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Windows Media Player 6.4<br>Windows Media Player 7.1<br>Windows Media Player 9<br>Windows Media Player 10</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Mozilla Firefox <br> Version 1.x/2.0</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1"><font style="color:red;">Windows Media Player 6.4<br>Windows Media Player 7.1</font><br>Windows Media Player 9<br>Windows Media Player 10</td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;" rowspan="4"><font style="font-size: 8pt; font-family: verdana;" size="-1">Microsoft Windows XP</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Microsoft Internet Explorer<br>Version: 5.5</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1"><font style="color:red;">Windows Media Player 6.4<br>Windows Media Player 7.1</font><br>Windows Media Player 9<br>Windows Media Player 10</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Microsoft Internet Explorer<br> Version: 6.0 with SP1, 7.0</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1"><font style="color:red;">Windows Media Player 6.4<br>Windows Media Player 7.1</font><br>Windows Media Player 9<br>Windows Media Player 10<br>Windows Media Player 11</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Netscape Navigator <br> Version: 7.2</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1"><font style="color:red;">Windows Media Player 6.4<br>Windows Media Player 7.1</font><br>Windows Media Player 9<br>Windows Media Player 10</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Mozilla Firefox <br> Version 1.x/2.0</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1"><font style="color:red;">Windows Media Player 6.4<br>Windows Media Player 7.1</font><br>Windows Media Player 9<br>Windows Media Player 10<br>Windows Media Player 11</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '<tr>' +
         '<td style="vertical-align: top;" rowspan="4"><font style="font-size: 8pt; font-family: verdana;" size="-1">Macintosh OS-X</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Netscape Navigator <br> Version: 7.2</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Quicktime Player 6.4</td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Version 5.0 <br>and above</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '<td style="vertical-align: top;"><font style="font-size: 8pt; font-family: verdana;" size="-1">Yes</font></td>' +
         '</tr>' +

         '</table>' +

         '</BODY></HTML>';
}

function cookiesEnabled() {
  SetCookie( "foo", "bar" );
  if ( GetCookie( "foo" ) ) {
    DeleteCookie( "foo" );
    return true;
  } else {
    return false;
  }
}

function GetCookie( 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 getCookieVal(j);
    i = document.cookie.indexOf( " ", i ) + 1;
    if ( i == 0 ) break;
  }
  return null;
}

function DeleteCookie( name, path, domain ) {
  if ( GetCookie( name ) ) {
    document.cookie = name + "=" +
    ( ( path ) ? "; path=" + path : "" ) +
    ( ( domain ) ? "; domain=" + domain : "" ) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function SetCookie( name, value, expires, path, domain, secure ) {
  document.cookie = name + "=" + escape (value) +
  ( ( expires ) ? "; expires=" + expires.toGMTString() : "" ) +
  ( ( path ) ? "; path=" + path : "" ) +
  ( ( domain ) ? "; domain=" + domain : "" ) +
  ( ( secure ) ? "; secure" : "" );
}

function getCookieVal( offset ) {
  var endstr = document.cookie.indexOf ( ";", offset );
  if ( endstr == -1 ) endstr = document.cookie.length;
  return unescape( document.cookie.substring( offset, endstr ) );
}

