var hiddenHTML = new Array();
var hiddenHTMLcount = 0;

function CloseText(id,ix)
{
   return '<a href="javascript:HideVideo(\''+id+'\','+ix+')"><img src="images/close.gif" width=10 height=10> [Close Video]</a><br>';
}

function PlayQuicktime(id,file,width,height)
{
   width  = typeof(width)  != 'undefined' ? width  : 740;
   height = typeof(height) != 'undefined' ? height : 480;

   if ( width > 740 ) width = 740;
   var tag = document.getElementById(id);
   hiddenHTML[ hiddenHTMLcount ] = tag.innerHTML;
   tag.innerHTML = CloseText(id,hiddenHTMLcount)
                 + '<object width="'+width+'" height="'+height+'" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" id="quicktime_'+id+'" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0">'
                 + '<param name="url" value="'+file+'" />'
                 + '<param name="autosize" value="1" />'
                 + '<param name="controller" value="true" />'
                 + '<param name="autoplay" value="true" />'
                 + '<param name="type" value="video/quicktime" />'
                 + '<param name="loop" value="0" />'
                 + '<param name="scale" value="tofit" />'
                 + '<param name="src" value="'+file+'" />'
                 + '<embed name="quicktime_'+id+'" src="'+file+'" pluginspage="http://www.apple.com/quicktime/download/" enablejavascript="true" controller="true" width="'+width+'" height="'+height+'" type="video/quicktime" autoplay="true" autosize="true">'
                 + '</object>';
   hiddenHTMLcount++;
}

function PlayWMV(id,file,width,height)
{
   width  = typeof(width)  != 'undefined' ? width  : 740;
   height = typeof(height) != 'undefined' ? height : 480;
   height += 64;

   if ( width > 740 ) width = 740;
   var tag = document.getElementById(id);
   hiddenHTML[ hiddenHTMLcount ] = tag.innerHTML;
   tag.innerHTML = CloseText(id,hiddenHTMLcount)
                 + '<object width="'+width+'" height="'+height+'" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="wmstream_'+id+'" type="video/x-ms-wmv" data="'+file+'" codebase="http://www.microsoft.com/Windows/MediaPlayer/">'
                 + '<param name="url" value="'+file+'" />'
                 + '<param name="showcontrols" value="1" />'
                 + '<param name="showdisplay" value="0" />'
                 + '<param name="showstatusbar" value="0" />'
                 + '<param name="autosize" value="1" />'
                 + '<param name="autostart" value="1" />'
                 + '<param name="visible" value="1" />'
                 + '<param name="animationstart" value="0" />'
                 + '<param name="loop" value="0" />'
                 + '<param name="src" value="'+file+'" />'
                 + '<embed name="wmstream_'+id+'" src="'+file+'" enablejavascript="true" width="'+width+'" height="'+height+'" type="video/x-ms-wmv" autostart="1" enabled="1" showstatusbar="1" showdisplay="1" showcontrols="1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0">'
                 + '</object>';
   hiddenHTMLcount++;
}

function PlayFLV(id,file,width,height)
{
   var tag = document.getElementById(id);
   hiddenHTML[ hiddenHTMLcount ] = tag.innerHTML;
   
   tag.innerHTML = CloseText(id,hiddenHTMLcount)
                 + '<div id="flvvid_'+id+'"></div>';

   var vidtag = document.getElementById('flvvid_'+id);

   width  = typeof(width)  != 'undefined' ? width  : 740;
   height = typeof(height) != 'undefined' ? height : 480;
	 var s1 = new SWFObject('http://www.cyberradiance.com/hairfarm/forum/player.swf','flvplayer',width,height+20,'9');
	 s1.addParam('allowfullscreen','true');
	 s1.addParam('allowscriptaccess','always');
	 s1.addParam('flashvars','file='+file+'&type=video&autostart=true&repeat=always');
	 s1.write(vidtag);
   
   hiddenHTMLcount++;
}

function PlaySWF(name,file,width,height)
{
	var s1 = new SWFObject(file+'&amp;sid=db5623cb7462e7e887eabed65623d5a6','swfplayer',width,height,'9');
	s1.addParam('flashvars','file='+file+'&type=video&autostart=true&repeat=always');
	s1.write(name);
}

function HideVideo(id,ix)
{
   var tag = document.getElementById(id);
   tag.innerHTML = hiddenHTML[ix];
   hiddenHTML[ix] = '';
}