function isObject(type){
   return ( "undefined" != typeof(type) );
}

function winIE5upPlyrDetect(){
   var player;
   var iectl;
   try{
      // attempt to instantiate the IE control to see if activeX is enabled.
      iectl = new ActiveXObject("Shell.Explorer");
   }
   catch(e){
   }
   try{
      player = new ActiveXObject("rmocx.RealPlayer G2 Control.1");
      version = (player.GetVersionInfo());
   }
   catch(e){
   }
   if(!isObject(iectl)){
      return "unknown"; //ActiveX disabled
   }
   return new String(isObject(player));
}

function checkPlugin(name){
   plugin = navigator.plugins[name];
   if(isObject(plugin)){
      version = plugin.description;
      return true;
   }
   return false;
}

function pluginDetect(){
   return (
          (checkPlugin("RealPlayer Version Plugin"))
          ||
          (checkPlugin("RealOne Player Version Plugin"))
          );
}

function mimeTypeDetect(){
   return (
          isObject(navigator.mimeTypes)
          &&
          isObject(navigator.mimeTypes["audio/x-pn-realaudio-plugin"])
          );
}

function isWinIE5plus(){
   var result = false;
   var uaLower = navigator.userAgent.toLowerCase();
   if(uaLower.indexOf("windows") >=0 && uaLower.indexOf("msie")>=0){
      var versRX = /msie\s+[5-9]/;
      result = versRX.test(uaLower);
   }
   return result;
}

function hasRealPlayer(){
   if( isWinIE5plus() ){
      return winIE5upPlyrDetect();
   }
   else{
      return ((pluginDetect() || mimeTypeDetect())?"true":"unknown");
   }
}

