var quicktimeVersion = 0;
function getQuicktimeVersion() {
	var agent = navigator.userAgent.toLowerCase(); 
	
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Quicktime plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
      for (i=0; i < navigator.plugins.length; i++ ) {
         var plugin =navigator.plugins[i];
         if (plugin.name.indexOf("QuickTime") > -1) {
            quicktimeVersion = parseFloat(plugin.name.substring(18));
         }
      }
	}
   
	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	  document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('dim obQuicktime \n');
		document.write('set obQuicktime = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1") \n');
		document.write('if IsObject(obQuicktime) then \n');
		document.write('   if obQuicktime.IsQuickTimeAvailable(0) then \n');
		document.write('      quicktimeVersion = CInt(Hex(obQuicktime.QuickTimeVersion) / 1000000) \n');
		document.write('   end if \n');
		document.write('end if \n');
		document.write('</scr' + 'ipt\> \n');
  }

	// Can't detect in all other cases
	else {
		quicktimeVersion = quicktimeVersion_DONTKNOW;
	}

	return quicktimeVersion;
}

quicktimeVersion_DONTKNOW = -1;

function js_gui_movie (url,image,width,height,linktonote,linktourl) {
	var requiredVersion = 7;
	var quicktimeVersion = getQuicktimeVersion();
	
	if (quicktimeVersion >= requiredVersion) {
		//document.write ('<p style="margin-bottom:0px;"><img src="http://www.musclefx.com/templates/mfx4/images/click_to_play-small.jpg" /></p>');

	   document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'+width+'" height="'+height+'" codebase="http://www.apple.com/qtactivex/qtplugin.cab">');
	   document.write('<param name="SRC" value="http://www.musclefx.com/templates/mfx4/images/click_to_play.jpg">');
	   document.write('<param name="HREF" value="'+url+'">');
	   document.write('<param name="TYPE" value="video/quicktime">');
	   document.write('<param name="AUTOPLAY" value="false">');
	   document.write('<param name="CONTROLLER" value="false">');
	   document.write('<param name="TARGET" value="myself">');
	   document.write('<embed src="'+image+'" href="'+url+'" target=myself type="video/quicktime" width="'+width+'" height="'+height+'" autoplay="false" controller="false" pluginspage="http://www.apple.com/quicktime/download/">');
	   document.write('</embed>');
	   document.write('</object>');
	   if (linktourl!="") {
	   	document.write('<p class="videolink"><a href="'+linktourl+'">'+linktonote+'</a> - See more <a href="'+linktourl+'"><img src="/templates/mfx4/images/arrowmoveto.gif" /></a></p>');
		}
	}
	else if (quicktimeVersion > 0) {
	   document.write('<p><a href="http://www.apple.com/quicktime/download/"><img src="http://www.musclefx.com/templates/mfx4/images/need_quicktime_7.jpg" alt="You need Quicktime 7 from Apple." /></a></p>');
	}
	else if (quicktimeVersion == 0) {
	   document.write('<p><a href="http://www.apple.com/quicktime/download/"><img src="http://www.musclefx.com/templates/mfx4/images/need_quicktime_7.jpg" alt="You need Quicktime 7 from Apple." /></a></p>');
	}
	else if (quicktimeVersion == quicktimeVersion_DONTKNOW || quicktimeVersion == null) {
	   document.write('<p><a href="http://www.apple.com/quicktime/download/"><img src="http://www.musclefx.com/templates/mfx4/images/need_quicktime_7.jpg" alt="You need Quicktime 7 from Apple." /></a></p>');
	}

}