// JavaScript Document
	function sendEvent(typ,prm) { 
		thisMovie("flvpreview").sendEvent(typ,prm); 
	};

	function previewmedia(type, deffile, stream_url)
	{
		sendEvent("stop");
		if(type == 'audio')
		{
			createplayer("true", "media_preview", deffile, "true", stream_url)
			//thisMovie("flvpreview").loadFile({file:'<?php echo HTTP_SERVER . DIR_WS_CATALOG . "song_playlist.php";?>'});
		}
		else
		{
			createplayer("false", "media_preview", deffile, "true", stream_url); 
		}
	}
	
	function thisMovie(movieName) {
	    if(navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			return document[movieName];
		}
	};

	function createplayer(showeq, container, deffile, autoplay, stream_url)
	{
		var s1 = new SWFObject("flvplayer.swf", "flvpreview", "304", "250", "7");
		s1.addVariable("javascriptid", "flvpreview");
		s1.addParam("allowfullscreen", "true");
		s1.addParam("allowscriptaccess", "true");
		s1.addParam("wmode", "transparent");
		s1.addVariable("file", deffile);
		s1.addVariable("enablejs", "true");
		s1.addVariable("autostart", autoplay);
		s1.addVariable("showeq", showeq);
		s1.addVariable("usekeys", "true");
		s1.addVariable("showicons", "false");
		s1.addVariable("width", "304");
		s1.addVariable("height", "250");
		s1.addVariable("overstretch", "true");
		s1.addVariable("flush", "false");
		if(stream_url != '') {
			s1.addVariable("streamscript", stream_url + "stream_video.php");
		}
		s1.write(container);
	}

	/*function getUpdate(typ,pr1,pr2,pid) {
		if(typ == "time") { currentPosition = pr1; }
		else if(typ == "volume") { currentVolume = pr1; }
		else if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100); }
		var id = document.getElementById(typ);
		id.innerHTML = typ+ ": "+Math.round(pr1);
		pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
		if(pid != "null") {
			document.getElementById("pid").innerHTML = "(received from the player with id <i>"+pid+"</i>)";
		}
	};
	function getItemData(idx) {
		var obj = thisMovie("flvpreview").itemData(idx);
		var nodes = "";
		for(var i in obj) {
			nodes += "<li>"+i+": "+obj[i]+"</li>"; 
		}
		document.getElementById("data").innerHTML = nodes;
	};*/
	function bookmarksite(loc)
	{
		if (window.sidebar)
		window.sidebar.addPanel(document.title, loc, "");
		else if (document.all)
		window.external.AddFavorite(loc, document.title);
		
    }
