
function activateField(videosListID,idData)
{
	document.getElementById('videosList0').className = '';
	document.getElementById('videosList1').className = '';
	document.getElementById('videosList2').className = '';
	document.getElementById('videosList3').className = '';
	document.getElementById('videosList4').className = '';
	document.getElementById(videosListID).className = 'active';
	document.getElementById('ListData').innerHTML = document.getElementById("Data"+idData).innerHTML;
}
function changeVideo (id , flv , image , fullscreen ){
		document.getElementById('PlayAgain').style.display = 'none';
		document.getElementById('player').style.display = 'block';
		var PlayerPath = "http://i1.makcdn.com/clipat/image/flowplayer.commercial-3.1.2.swf";
		$f("player").play({url:flv});
		playList(id)
}

function playList(id){
		var params = {
			bgcolor:"#000000",
			allowScriptAccess:'always',
			allowFullScreen: "true",
			wmode: "opaque"
		};
		
		var flashvars = {};
		var attributes = {};
		swfobject.embedSWF("http://cdn.maktoob.com/images/flvPlayer/playList2.swf?conf=http://clipat.maktoob.com/relatedVideos.php?videoId="+id, "playList" , "380", "120", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}

function replay(){
	document.getElementById('PlayAgain').style.display = 'none';
	document.getElementById('player').style.display = 'block';
	player( $f('player').getClip(0) , false);
}
			

function player(flv , ads){
	var clipPath = flv;
	if ( ads == true ){
		
		$f("player",  { src: PlayerPath, wmode: 'opaque'}  , {
						clip:{accelerated:true ,autoBuffering:true ,accelerated:true},
						key: '#$67c3ac88e68a747234d',
						playlist: [clipPath],
						play: { replayLabel: 'اعادة', fadeSpeed: 500, rotateSpeed: 50 },
						plugins: {controls: {fullscreen : true,playlist: false,all: false,play: true,volume:true,mute:true,time:true,scrubber: true }},
						logo:{url: '/clipat-icon.png',top:'83%',right:'15%',opacity: 0.8,displayTime: 0,fadeSpeed: 1,linkUrl:'',fullscreenOnly: false},
						onLoad : function() {OAS_AD('x65');},
						onFinish : function()
							{
								document.getElementById('PlayAgain').style.display = 'block';
								document.getElementById('player').style.display = 'none';
							}
					}
			);
			
	} else {
		
		$f("player", { src: PlayerPath, wmode: 'opaque'} , {
						clip:{accelerated:true ,autoBuffering:true ,accelerated:true},
						key: '#$67c3ac88e68a747234d',
						playlist: [clipPath],
						play: { replayLabel: 'اعادة', fadeSpeed: 500, rotateSpeed: 50 },
						plugins: {controls: {fullscreen : true,playlist: false,all: false,play: true,volume:true,mute:true,time:true,scrubber: true }},
						logo:{url: '/clipat-icon.png',top:'83%',right:'15%',opacity: 0.8,displayTime: 0,fadeSpeed: 1,linkUrl:'',fullscreenOnly: false},
						onFinish : function()
							{
								document.getElementById('PlayAgain').style.display = 'block';
								document.getElementById('player').style.display = 'none';
							}
					}
		);
	}
}

function OAS_AD1(position){
	playerAddCount();
  	var AdsPath = "http://i1.makcdn.com/images/adsnew/banners/Hyundai/Nov-Pre-roll/fo2.flv";
  	var AdsLink = "http://67.15.195.166/advertpro/servlet/click/media?mid=6295&pid=0&lookup=true&position=1";
  	$f(divName).setPlaylist([{url: AdsPath, linkUrl : AdsLink, linkWindow: '_blank'} ,{url: clipPath, linkUrl :''}] );
}

function playerAddCount() {
	ajaxCall('http://clipat.maktoob.com/updatePlayer.php',trackUser ,'post','&userLogin=1',trackUserRequest)
}
function trackUserRequest(){}
function trackUser(){}

