function sendEvent(swf,typ,prm) { 
  thisMovie(swf).sendEvent(typ,prm); 
};

function thisMovie(swf) {
  if(navigator.appName.indexOf("Microsoft") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
};

function loadFile(swf,obj) { 
  thisMovie(swf).loadFile(obj); 
};

/** display image with link after video playback
var currentState;
function getUpdate(typ,pr1,pr2,pid) {
	if(pid != "null") {
		if((typ == "state")&&(pr1 != undefined)) { 
			currentState = pr1; 
			if(currentState=="3") { loadFile(pid,{file:'/images/common/videoend.jpg',link:'/join'}); sendEvent(pid, 'playpause'); }

		}
	}
};
*/

/** goto first item in playlist after video playback **/
var checkItems = new Array();
function getUpdate(typ,pr1,pr2,pid) {
 if (pid != "null") {
  if (typ == "item" && pr1 == 1) {
    for (var count = 0; count < checkItems.length; count++) if (checkItems[count] == pid) break;
    checkItems[checkItems.length] = pid;
  }
  if (typ == "state" && pr1 == 3) {
   for (var count = 0; count < checkItems.length; count++) {
    if (checkItems[count] == pid) {
     checkItems.splice(count, 1);
     sendEvent(pid,'playitem',0);
     break;
    }
   }
  }
 }
}

function playPlaylist(id, playlist_path, url_hdss_1_l)
{
	document.getElementById('playersample_pic_' + id).style.visibility = "hidden";
    var vid = new SWFObject("/flash/mediaplayer.swf", "player" + id, "425", "320", "8");
    vid.useExpressInstall("/flash/expressinstall.swf");
    vid.addParam("allowscriptaccess", "always");
    vid.addParam("allowfullscreen", "true");
    vid.addVariable("width", "425");
    vid.addVariable("height", "320");
    vid.addVariable("file", playlist_path);
    vid.addVariable("image", url_hdss_1_l);
    vid.addVariable("bufferlength", "1");
    vid.addVariable("displayheight", "345");
    vid.addVariable("autostart", "true");
	vid.addVariable("controlbar", "none");
	vid.addVariable("stretching", "exactfit");
	vid.addVariable("shownavigation", "false");
    vid.addVariable("javascriptid", "player"+id);
    vid.addVariable("enablejs", "true");
    vid.addVariable("linkfromdisplay", "true");
	vid.addVariable("linktarget", "_self")
    vid.addVariable("shuffle", "false");
    vid.addVariable("repeat", "list");
    vid.write("player_"+id);
}

function showPlayersampleHover(id, value)
{
	var element = document.getElementById('playersample_hover_' + id);
	element.style.visibility = value;
}

