


jQuery.fn.qtobject = function(src, id, w, h, options) {  

  $(this).parent().find('span.no-script').css('display', 'none');
  
  var defaults = {  
    params: {scale: "tofit", kioskmode: true, controller: true, cache: true, targetcache: true, enablejavascript: true, postdomevents: true}
  };  

  var options = $.extend(defaults, options);  

  var qtInstalled = isQTInstalled();
  var qtHTML = "";
  var paramTags = "";
 
  if (navigator.plugins && navigator.plugins.length) { // not ie
  qtHTML += '<embed pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime" src="' + src + '" width="' + w + '" height="' + h + '" id="' + id + '"';
    for (var key in options.params) {
      paramTags += ' ' + key + '="' + encodeURIComponent(options.params[key]) + '"';
    } 
  qtHTML += paramTags+'></embed>';
  } else { // pc ie
  qtHTML += '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="' + w + '" height="' + h + '" id="' + id + '" style="behavior:url(#qt_event_source);">';
    for (var key in options.params) {
      paramTags += '<param name="' + key + '" value="' + encodeURIComponent(options.params[key]) + '" />';      
    } 
    paramTags += '<param name="src" value="' + src + '" />';
  qtHTML += paramTags+'</object>';
  }

  if ( qtInstalled ) {
    $(this).parent().html( qtHTML );
  }

  function isQTInstalled() {
  var qtInstalled = false;
  qtObj = false;
    if (navigator.plugins && navigator.plugins.length) {
      for (var i=0; i < navigator.plugins.length; i++ ) {
      var plugin = navigator.plugins[i];
        if (plugin.name.indexOf("QuickTime") > -1) {
        qtInstalled = true;
        }
      }
    } else {
    execScript('on error resume next: qtObj = IsObject(CreateObject("QuickTimeCheckObject.QuickTimeCheck.1"))','VBScript');
    qtInstalled = qtObj;
    }
  return qtInstalled;
  }

};

function qtLoadVR(obj, src) {
  obj.SetURL(src);
  obj.SetControllerVisible(true);
  obj.SetRectangle('0,-1,508,324');
}
