function thisMovie(movieName) {
     if (navigator.appName.indexOf("Microsoft") != -1) {
          return window[movieName]
     }
     else {
          return document[movieName]
     }
}

// JavaScript Document
// Control SWF
// Control SWF -> JS
function sendControlCmdPlay() {
	callVideoPlay();
}
function sendControlCmdPause() {
	callVideoPause();
} 
function sendControlCmdStop() {
	callVideoStop();
}
function sendControlCmdSeekTimeCode(controlTc) {
	callVideoScrub(controlTc);
	callControlVideoPlay();
}
function sendControlCmdSoundOn() {
	callVideoSoundOn();
}
function sendControlCmdSoundOff() {
	callVideoSoundOff();
}
function sendControlCmdSoundChange(volumeValue) {
	callVideoSoundChange(volumeValue);
}
function sendControlCmdFullScreen(url) {
	eval(url);
}
function sendControlCmdNormalScreen(url) {
	eval(url);
}

// Player SWF -> JS
function sendVideoDuration(duration) {
	callControlVideoDuration(duration);
}
function sendPlayVideo() {
	callControlVideoPlay();
}
function sendPauseVideo() {
	callControlVideoPause();
} 
function sendStopVideo() {
	callControlVideoStop();
}
function sendTimeCode(timecode) {
	callControlVideoTimecode(timecode);
}
function sendShowHideControls(cmd) {
	callControlShowHideControls(cmd);
}


// ########## JS -> SWF ########## 

// JS -> Control SWF
function callControlVideoDuration(duration) {
	thisMovie("streamlikePlayerControls").receiveControlVideoDuration(duration);
}
function callControlVideoPlay() {
	thisMovie("streamlikePlayerControls").receiveControlVideoPlay();
}
function callControlVideoPause() {
	thisMovie("streamlikePlayerControls").receiveControlVideoPause();
}
function callControlVideoStop() {
	thisMovie("streamlikePlayerControls").receiveControlVideoStop();
}
function callControlVideoTimecode(tcode) {
	thisMovie("streamlikePlayerControls").receiveControlVideoScrub(tcode);
}
function callControlShowHideControls(cmd) {
	thisMovie("streamlikePlayerControls").receiveControlShowHideControls(cmd);
}


// JS -> Player SWF
function callVideoPlay() {
	thisMovie("streamlikePlayer").flashFunctionVideoPlay();
}
function callVideoPause() {
	thisMovie("streamlikePlayer").flashFunctionVideoPause();
}
function callVideoStop() {
	thisMovie("streamlikePlayer").flashFunctionVideoStop();
}
function callVideoScrub(newPosition) {
	thisMovie("streamlikePlayer").flashFunctionVideoScrub(newPosition);
}
function callVideoSoundOn() {
	thisMovie("streamlikePlayer").flashFunctionVideoSoundOn();
}
function callVideoSoundOff() {
	thisMovie("streamlikePlayer").flashFunctionVideoSoundOff();
}
function callVideoSoundChange(newValue) {
	thisMovie("streamlikePlayer").flashFunctionVideoSoundChange(newValue);
}

function callNewVideo(med_type, med_id, swf_id, lng, fsl, fsm, fsh, dlmh, med_autostart, imgStart, chapterFile, imgLogo, logoPosition, imgLogoAlpha, HD, redirect, cc, ad, xmlFP, swfFP) {
	callVideoStop();
	callControlVideoStop();
	thisMovie("streamlikePlayer").flashFunctionNewVideo(med_type, med_id, swf_id, lng, fsl, fsm, fsh, dlmh, med_autostart, imgStart, chapterFile, imgLogo, logoPosition, imgLogoAlpha, HD, redirect, cc, ad, xmlFP, swfFP);
	thisMovie("streamlikePlayerControls").receiveControlVideoNew(med_type, med_id, dlmh, lng);
}