//
// BEGIN FLOCK GPL
//
// Copyright Flock Inc. 2005-2009
// http://flock.com
//
// This file may be used under the terms of the
// GNU General Public License Version 2 or later (the "GPL"),
// http://www.gnu.org/licenses/gpl.html
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
//
// END FLOCK GPL
//

function detectFlash() {
  // Check for presence of flash - enumerate through all the plugins and
  // see if flash is present and enabled.
  navigator.plugins.refresh(false);

  var numPlugins = navigator.plugins.length;
  for (var i = 0; i < numPlugins; i++) {
    var plugin = navigator.plugins[i];

    if (plugin) {
      var numTypes = plugin.length;
      for (var j = 0; j < numTypes; j++) {
        var mimetype = plugin[j];

        if (mimetype &&
            mimetype.type == "application/x-shockwave-flash" &&
            mimetype.enabledPlugin)
        {
          // We have flash!
          return true;
        }
      }
    }
  }

  return false;
} 
