/* 
BBC News Online - http://news.bbc.co.uk/ 
(c) British Broadcasting Corporation
*/

// Launch player in popup window
function launch_main_player()
{  clickmain=window.open("/hi/english/static/audio_video/avconsole/avc_main.htm","clickmain","toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,top=100,left=100,width=432,height=440");
}

function getPlatform()
{
   var myUserAgent;

   myUserAgent = navigator.userAgent.toLowerCase();

    if ( (myUserAgent.indexOf("win") != -1)   || 
         (myUserAgent.indexOf("16bit") != -1) 
       )
    {
       return "win";
    }

    if (myUserAgent.indexOf("mac") != -1)
    {
       return "mac";
    }
      
    if (myUserAgent.indexOf("x11") != -1)
    {
       return "unx";
    }
      
    return "other";
}


// Work out what sort of browser we are using 
function getBrowserType()
{
   var myUserAgent;
   var myMajor;

   myUserAgent   = navigator.userAgent.toLowerCase();
   myMajor       = parseInt(navigator.appVersion);

   if( (myUserAgent.indexOf('mozilla')    != -1) && 
       (myUserAgent.indexOf('spoofer')    == -1) && 
       (myUserAgent.indexOf('compatible') == -1) && 
       (myUserAgent.indexOf('opera')      == -1) && 
       (myUserAgent.indexOf('webtv')      == -1)
     )
   {
      if (myMajor > 3)
      {
         return "nav4";
      }
      return "nav";
   }

   if (myUserAgent.indexOf("msie") != -1)
   {
      if (myMajor > 3)
      {
         return "ie4";
      }
      return "ie";
   }

   return "other";
}

// Handle the click request 
function request_launch()
{
   if (getPlatform() != "other" &&
       (getBrowserType() == "ie4" || getBrowserType() == "nav4")) {
      launch_main_player();
   } else {
     self.location.href="/hi/english/static/audio_video/avconsole/old_browser.stm";
   }
   return;
}