/*##
 ##
 ## General Plugin Detection
 ##
 ##*/

 var pluginovervb = false;

 function do_pluginovervb()
 {
   pluginovervb = true;
 }

 function plugin_check(plugin_mime, plugin_name, plugin_object)
 {

   // Internet Explorer (ActiveX)
   if(pluginovervb && plugin_object != '')
   {
     if(DoesExist(plugin_object) == 1)
     {
       return true;
     }
     else if(DoesExist(plugin_object) == 0)
     {
       return false;
     }
   }

   // Netscape, FireFox & Co.
   else if(navigator.mimeTypes && plugin_name != '' ? (navigator.mimeTypes[plugin_name] && navigator.mimeTypes[plugin_name].enabledPlugin != false) : true)
   {
     if(navigator.plugins)
     {
       var plugins_count = navigator.plugins.length;

       if(plugin_name != "" && navigator.mimeTypes[plugin_name] == null)
       {
         return false;
       }

       if(plugins_count > 0)
       {
         for(var i = 0; i < plugins_count; i++)
         {
           if((navigator.plugins[i].description.indexOf(plugin_mime) != -1) || (navigator.plugins[i].name.indexOf(plugin_mime) != -1))
           {
             return true;
           }
         }
       }
     }

     return false;
   }

   return false;
 }

 /*##
 ##
 ## Macromedia Flash Player Detection
 ##
 ##*/

 function isFlashInstalled()
 {
   MSDetect = 'false';
	
   if(typeof(navigator.plugins) != 'undefined' && navigator.plugins.length)
   {
     // Flash Version 3 - 8
     if( typeof(navigator.plugins["Shockwave Flash"]) != 'undefined' )
     {
       flashOjDes = navigator.plugins["Shockwave Flash"].description
			
       // Beschreibung vorhanden
       if( typeof(flashOjDes) != 'undefined' )
       {
       	if (flashOjDes.substring((flashOjDes.indexOf('Flash')+5),(flashOjDes.indexOf('.'))) < 7) return MSG_TOOLOW
         else return MSG_ACTIVE +' (Version '+ flashOjDes.substring((flashOjDes.indexOf('Flash')+5),(flashOjDes.indexOf('.'))) + ')';
       }

       // Ausgabe ohne Versionsnummer
       else
       {
         return MSG_ACTIVE;
       }
     }
		
     // Flash version 2
     else if(navigator.plugins["Shockwave Flash 2.0"])
     {
       return MSG_ACTIVE + ' (Version 2)';
     }
		
     // Nichts gefunden
     else
     {
       return MSG_NOTACTIVE;
     }
   }

   // Versuch ueber die MIME-Typen
   else if( typeof(navigator.mimeTypes) != 'undefined' && navigator.mimeTypes.length)
   {
     flashOj = navigator.mimeTypes['application/x-shockwave-flash'];
		
     if( typeof(flashOj) != 'undefined' && flashOj.enabledPlugin)
     {
       return MSG_ACTIVE;
     }
     else
     {
       return MSG_NOTACTIVE;
     }
   }

   // Versuch ueber ActiveX - Plugin
   else
   {
     MSDetect = "true";
   }

   for(var i = 10; i >= 3; i--)
   {
     if(plugin_check('Flash '+8, 'application/x-shockwave-flash', 'ShockwaveFlash.ShockwaveFlash.'+i))
     {
       return MSG_ACTIVE + ' (Version ' + i + ')';
     }
   }
	
   // Version kleiner als 3
   if(plugin_check('Flash', 'application/x-shockwave-flash', 'ShockwaveFlash.ShockwaveFlash'))
   {
     return MSG_ACTIVE + ' (Version 1 / Version 2)';
   }
	
   //Nicht vorhanden
   else
   {
     return MSG_NOTACTIVE;
   }
 }

 /*##
 ##
 ## Windows Media Player Detection
 ##
 ##*/

 function isWindowsMediaPlayerInstalled()
 {
   if(	plugin_check('Windows Media', 'application/x-mplayer2', 'MediaPlayer.MediaPlayer.1') || 
	plugin_check('Windows Media', 'application/x-drm', '')
     )
   {
     return MSG_ACTIVE;
   }

   // Nicht erkannt
   else
   {
     return MSG_NOTACTIVE;
   }
 }

 /*##
 ##
 ## Real Player Detection
 ##
 ##*/

 function isRealPlayerInstalled()
 {
   if(	plugin_check('RealPlayer(tm) LiveConnect-Enabled Plug-In', 'audio/x-pn-realaudio-plugin', 'rmocx.RealPlayer G2 Control') || 
	plugin_check('RealPlayer(tm) G2', 'audio/x-pn-realaudio-plugin', 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)') || 
	plugin_check('RealVideo', 'audio/x-pn-realaudio-plugin', 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') || 
	plugin_check('RealPlayer', 'audio/x-pn-realaudio-plugin', '')
     )
   {
    return MSG_ACTIVE;
   }

   // Nicht erkannt
   else
   {
     return MSG_NOTACTIVE;
   }
 }

 /*##
 ##
 ## Apple Quick Time Detection
 ##
 ##*/

 function isQuickTimePlayerInstalled()
 {
   if(	plugin_check('QuickTime', 'video/quicktime', 'QuickTimeCheckObject.QuickTimeCheck.1'))
   {
     return MSG_ACTIVE;
   }

   // Nicht erkannt
   else
   {
     return MSG_NOTACTIVE;
   }
 }

 /*##
 ##
 ## Apple iTunes Detection
 ##
 ##*/

 function isItunesInstalled()
 {
   var detectObj = document.getElementById("iTunesDetector");

   var returnVal = MSG_NOTACTIVE;

   if(detectObj != null && typeof(detectObj) != 'undefined')
   {
     if(typeof(detectObj.IsITMSHandlerAvailable) != 'undefined')
     {
       returnVal = MSG_ACTIVE;
     }
     else
     {
       returnVal = MSG_NOTACTIVE;
     }
   }

   return returnVal;
 }

 /*##
 ##
 ## Skype Detection
 ##
 ##*/

 function isSkypeInstalled()
 {
   if(plugin_check('Skype', 'application/x-skype', 'Skype.Detection'))
   {
     return MSG_ACTIVE;
   }

   // Nicht erkannt
   else
   {
     return MSG_NOTACTIVE;
   }
 }

 /*##
 ##
 ## Acrobat Reader Detection
 ##
 ##*/

 function isAcrobatReaderInstalled()
 {
   if(	plugin_check('Acrobat', 'application/pdf', 'pdf.PdfCtrl.6') || 
	plugin_check('PDFViewer', 'application/pdf', 'GBDetect.Detect.1') || 
	plugin_check('nppdf.so', 'application/pdf', 'pdf.PdfCtrl.5')
     )
   {
     return MSG_ACTIVE;
   }

   // Nicht erkannt
   else
   {
     return MSG_NOTACTIVE;
   }
 }

 /*##
 ##
 ## Ajax Detection
 ##
 ##*/

 function isAjax()
 {
   var xmlHttp = false;
	
   try
   {
     // Internet Explorer
     if(typeof(window.ActiveXObject) != 'undefined')
     {
       for(var i = 7; i > 0; i--)
       {
         try
         {
           if(i == 1)
           {
             xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');    
           }
           else if(i == 2)
           {
             xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');    
           }
           else
           {
             xmlHttp = new ActiveXObject('Msxml2.XMLHTTP.' + i + '.0');
           }
					
           // Erfolg
           break;
         }
				
         catch(e)
         {
           xmlHttp = false;
         }
       }
     }

     // not IE - Browser
     else if(typeof(window.XMLHttpRequest) != 'undefined')
     {
       xmlHttp = new XMLHttpRequest();
     }
   }

   // Fehler
   catch(e)
   {
     xmlHttp = false;
   }

   if(typeof(xmlHttp) != 'boolean' || xmlHttp != false)
   {
     return MSG_ACTIVE;
   }
   else
   {
     return MSG_NOTACTIVE;
   }
 }