//*************************************************
//			webtv.rs player ver. 1.0.0.1
//			www.webtv.rs	www.webtelevizija.rs
//			abies.net
//*************************************************

//goPlay(server, klip, width, height, autoplay, prerol, midrol, postrol, textad)
//function fundur(){
//alert('asas')
//}
function goPlay(server, ClipId, ClipToPlay, w, h, autoPlayClip, preRoll, midRoll, postRoll, TextAd, ClipDuration, MediaId){
if (autoPlayClip == "false"){
	autoPlay = false;
}else{
	autoPlay = true;
}
//var order = 'oid='+ClipId;
//$.post("/player/scripting/gettime.asp", order, function(theResponse){
//ClipDuration = theResponse

//var t = new Date(1970,0,1);
//t.setSeconds(ClipDuration);
//var s = t.toTimeString().substr(0,8);
//if(ClipDuration > 86399)
//s = Math.floor((t - Date.parse("1/1/70")) / 3600000) + s.substr(2);
//return s;
//ClipDuration = s;
//alert(ClipDuration);





document.getElementById("fms").style.width=w+"px";
document.getElementById("fms").style.height=h+"px";
//$("#fms").animate({width: w, height: h}, 1000); 
$f("a.webtvplayer", "/player/fp/flowplayer.commercial-3.1.5.swf", {
	key: '#$2bea1bbd76f67832ed3',
	logo: {
		url: '/player/logos/'+MediaId+'.png',
		top: w*0.02,
		left: h*0.05,
		width: '95%',
		height: '95%',
		opacity: 0.7, 
		fullscreenOnly: false,
		displayTime: 0
		//linkUrl: 'http://www.webtv.rs' 
	},
	onStart: function(clip, isPreroll) {
		if (isPreroll.url == 'http://'+ server+'/'+ ClipToPlay){
			$("#info").load("/player/scripting/onplay.asp?oid=" + ClipId + "&mediaid="+ MediaId +"&servers="+ server);
		}
	},
	contextMenu: [
	{'About Web Televizija ...' : function() { 
	    window.open('http://www.webtv.rs/marketing.asp');
	}}, 
	'-', 
	'WebTV player 3.1.5',
	'-', 
	'Powered by Web Televizija',
	'-',
	{'Copyright © Abies Net' : function() { 
	    window.open('http://www.abies.net');
	}}
	],
	clip: {scaling: "fit"},
	playlist: [ 
	{ 
	   provider: 'lighttpd',
	   url: "http://"+server+"/"+ClipToPlay
	   //duration: ClipDuration
	}
	], 
    plugins: {
    	lighttpd: {
			url: 'http://www.webtv.rs/player/fp/flowplayer.pseudostreaming-3.1.3.swf'
		},
		liverail: {
		// load the LiveRail plugin
		url: 'http://vox-static.liverail.com/swf/v4/plugins/flowplayer/LiveRailPlugin315.swf',
		// LiveRail specific configuration:
		LR_VERSION: '4.1',
		LR_PUBLISHER_ID: '1921',
		LR_TAGS: preRoll, //preRoll, //+','+ midRoll +','+ postRoll
		PARTNER_ID: '1955'
		},
		gatracker: {
			url: "/player/fp/flowplayer.analytics-3.1.5.swf",
			labels: {
				start: "Start",	
				play: "Play",	
				pause: "Pause",	
				resume: "Resume",	
				seek: "Seek",	
				stop: "Stop",	
				finish: "Finish",	
				mute: "Mute",	
				unmute: "Unmute",	
				fullscreen: "Full Screen",	
				fullscreenexit: "Full Screen Exit"
			},
			debug: false,
			trackingMode: "AS3",
			googleId: "UA-6730923-2" // your Google Analytics id here
		},
		lighttpd: {
			url: '/player/fp/flowplayer.pseudostreaming-3.1.3.swf'
		},
		lighttpdInstream: {            
			url: '/player/fp/flowplayer.pseudostreaming-3.1.3.swf'         
		},
		controls: {
			height: 24,
			backgroundColor: 'transparent',
			backgroundGradient: '#000000',
			autoHide: 'always',
			volume: true,
			mute: false,
			borderRadius: '20',
			sliderColor: '#000000',
			bufferColor: '#000000',
			progressColor: '#669900',
			buttonColor: '#000000',
			timeColor: '#FFFFFF',
			fullscreen: true,
			buttonOverColor: '#111111',
			time: true
		}
        //controls: {
		//	licenceKey: 'demo',
		//	url: '/player/fp/controlbar.gm.vimeousplus-3.1.5.10.7.swf',
		//	trackingURL: 'http://www.webtv.rs',
		//	autoHide: 'always',
		//	hideDelay: 2000,
		//	embed: true,// the value of playerURL can alternatively be used in place of 'true'. 
		//	playerURL: 'http://www.webtv.rs/player/fp/flowplayer-3.1.5.swf',// this param can be omitted if it's value is placed within the 'embed' param.
		//	// ~~~~~~~~ LABELS FOR EMBED ~~~~~~~~
		//	embedPageTitle: 'Share',
		//	embedCodeTitle: 'Use the following code on your website or blog:',
		//	embedShareTitle: 'Share to the following social networks:',
		//	embedClicked: 'The code has been copied to your clipboard.',
		//	// ~~~ CONTENT SENT TO SHARE SITES ~~~
		//	shareURL: 'http://www.webtv.rs',
		//	shareTitle: 'An example of video sharing.',
		//	shareContent: 'Find more Flowplayer plugins at Goodings Media.',
		//	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		//	clipMode: false,
		//	playlist: true,
		//	cropLoop: false,
		//	//cropLabelStart: 'Drag to define clip start',
		//	//cropLabelEnd: 'Drag to define clip end',
		//	cropAutoPlay: false
		//	/*markers: [// markers (cuepoints) can still be added like so. if used this param will override any cuepoints in the playlist.
		//		{time: 5, label: 'Lipsum!'}
		//	],*/
		//},
    }
});




}







function PlayVideo(ClipId, ClipName, autoPlay, preRoll, midRoll, postRoll, TextAd, MediaId, ClipTime) { 
	var ClipTimes;
	ClipTimes = ClipTime;
	var flashMovie = getFlashMovieObject("cluster");
	//$f().stop()
    flashMovie.thisMethod(ClipId, ClipName, autoPlay, preRoll, midRoll, postRoll, TextAd, MediaId);
    //flashMovie.GotoFrame(2);
    //flashMovie.SetVariable("/:ClipToPlay", "9.flv");
    //var server=flashMovie.GetVariable("/:ServerConn");
    //fromFlash(server, ClipName)
} 






function getFlashMovieObject(movieName)
{
  if (window.document[movieName]){
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")== -1){
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    {
    return document.getElementById(movieName);
  }
}