Preview = {
	current : null,
	
	show : function (index, previewUrl) {
		if (Preview.current != null) {
			Preview.hide(Preview.current, '');
		}
		Preview.current = index;
		Effect.Fade('box_'+index, { duration: 0.2 });
		_startPlayback = function (index) {
			document.getElementById('preview_'+index).style.visibility = 'visible';
			Effect.Appear('preview_'+index, { duration: 0.2 });
			Preview._play(previewUrl);
		}
		setTimeout("_startPlayback(\'"+index+"\')", 200);
	},
	
	hide : function (index, previewUrl) {
		Effect.Fade('preview_'+index, { duration: 0.2 });
		_showBox = function (index) {
			Effect.Appear('box_'+index, { duration: 0.2 });
			Preview._stop();
		}
		setTimeout("_showBox(\'"+index+"\')", 200);
	},
	
	_play : function (clipURL) {
		document.getElementById("playme").innerHTML='<OBJECT ID="mediaPlayer" ' +
		  ' CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"  ' +
		  ' CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ' +
		  ' STANDBY="Laddar Microsoft Windows Media Player komponenter..." ' +
		  ' TYPE="application/x-oleobject">' +
		  ' <PARAM NAME="fileName" VALUE="' + clipURL + '">' +
		  ' <PARAM NAME="animationatStart" VALUE="false">' +
		  ' <PARAM NAME="transparentatStart" VALUE="false">' +
		  ' <PARAM NAME="autoStart" VALUE="true">' +
		  ' <PARAM NAME="showControls" VALUE="false">' +
		' <EMBED type="application/x-mplayer2" ' +
		' pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/"' +
		' SRC="' + clipURL + '"' +
		' name="MediaPlayer1"' +
		' width=0' +
		' height=0' +
		' AutoStart=true' +
		' showControls=false' +
		' >' +
		' </EMBED>' +
		' </OBJECT>';
		return false;
	},

	_stop : function () {
		document.getElementById("playme").innerHTML="";
		return false;
	}
}