var playerH = null;
var playerL = null;

function playerReadyforcecall(thePlayer) {
//	alert(1);
	if (thePlayer.id=='playerH'){
		if (!playerH ){
			playerH = window.document[thePlayer.id];
		}
		if (!playerH ){
			playerH = document.getElementById(thePlayer.id);
		}
	}
	if (thePlayer.id=='playerL'){
		if (!playerL ){
			playerL = window.document[thePlayer.id];
		}
		if (!playerL ){
			playerL = document.getElementById(thePlayer.id);
		}
	}
}

function playerReady(thePlayer) {
//	alert(1);
    playerReadyforcecall(thePlayer);
}

function createPlayer(plid,placeholer) {
	var flashvars;
	var params;
	var attributes;

	params = {allowfullscreen:"true", allowscriptaccess:"always", wmode:"opaque", quality:"high"}

	if (plid=='playerH')
	{
        if (programvideolist==1){  //An einai gia Stereostatika
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/streamlisten.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",streamer:"http://www.pi.gr/vstreamer.php",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"false"}
		attributes = {id:"playerH",  name:"playerH"	};
		}else if (programvideolist==2){ //An einai gia PANOPLIA
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/streamlistPANen.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",streamer:"http://www.pi.gr/vstreamer.php",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"false"}
		attributes = {id:"playerH",  name:"playerH"	};
		}else if (programvideolist==3){ //An einai gia tis trial
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/streamlistTrialen.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",streamer:"http://www.pi.gr/vstreamer.php",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"false"}
		attributes = {id:"playerH",  name:"playerH"	};
		}else if (programvideolist==4){ //An einai gia HoloMETRICA
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/streamlistHoloen.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",streamer:"http://www.pi.gr/vstreamer.php",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"false"}
		attributes = {id:"playerH",  name:"playerH"	};
		}else{ //An de dilwnetai pali na doulevei...
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/streamlistPANen.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",streamer:"http://www.pi.gr/vstreamer.php",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"false"}
		attributes = {id:"playerH",  name:"playerH"	};}
	}
	else
	{
        //plugins:"googlytics-1",
        if (programvideolist==1){  //An einai gia Stereostatika
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/httplisten.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"true"}
		params = {allowfullscreen:"true", allowscriptaccess:"always"}
		attributes = {id:"playerL",  name:"playerL"	};
		}else if (programvideolist==2){ //An einai gia PANOPLIA
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/httplistPANen.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"true"}
		params = {allowfullscreen:"true", allowscriptaccess:"always"}
		attributes = {id:"playerL",  name:"playerL"	};
		}else if (programvideolist==3){ //An einai gia tis trial
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/httplistTrialen.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"true"}
		params = {allowfullscreen:"true", allowscriptaccess:"always"}
		attributes = {id:"playerL",  name:"playerL"	};
		}else if (programvideolist==4){ //An einai gia HoloMETRICA
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/httplistHoloen.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"true"}
		params = {allowfullscreen:"true", allowscriptaccess:"always"}
		attributes = {id:"playerL",  name:"playerL"	};
		}else{ //An de dilwnetai pali na doulevei...
    		flashvars = {file:"http://www.pi.gr/CMSnew/images/media/httplistPANen.xml",logo:"http://www.pi.gr/CMSnew/images/media/images/logo.png",linktarget:"_self",bufferlength:"8",autoscroll:"false",width:"512",height:"400",playlist:"over",playlistsize:"208",autostart:"false",searchbar:"false",stretching:"uniform",quality:"true",old_machine:"true"}
		params = {allowfullscreen:"true", allowscriptaccess:"always"}
		attributes = {id:"playerL",  name:"playerL"	};}
	}

	swfobject.embedSWF("http://www.pi.gr/CMSnew/images/media/player_newparamif.swf", placeholer, "512", "400", "9.0.0", false, flashvars, params, attributes);
}

  function toggleLayer( whichLayer ){
  	var elem, vis;
  	if( document.getElementById ) // this is the way the standards work
  		elem = document.getElementById( whichLayer );
  	else if( document.all ) // this is the way old msie versions work
  		elem = document.all[whichLayer];
  	else if( document.layers ) // this is the way nn4 works
  		elem = document.layers[whichLayer];
  	vis = elem.style;  // if the style.display value is blank we try to figure it out here

  	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
  		vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  	vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  	}

  function HideLayer( whichLayer ){
  	var elem, vis;
  	if( document.getElementById ) // this is the way the standards work
  		elem = document.getElementById( whichLayer );
  	else if( document.all ) // this is the way old msie versions work
  		elem = document.all[whichLayer];
  	else if( document.layers ) // this is the way nn4 works
  		elem = document.layers[whichLayer];
  	vis = elem.style;  // if the style.display value is blank we try to figure it out here

  	vis.display = 'none';
  	}

  function ShowLayer( whichLayer ){
  	var elem, vis;
  	if( document.getElementById ) // this is the way the standards work
  		elem = document.getElementById( whichLayer );
  	else if( document.all ) // this is the way old msie versions work
  		elem = document.all[whichLayer];
  	else if( document.layers ) // this is the way nn4 works
  		elem = document.layers[whichLayer];
  	vis = elem.style;  // if the style.display value is blank we try to figure it out here

  	vis.display = 'block';
  	}

  function ShowPlayer( player ){

	if (player =='playerL'){  	//Show Light Player
		HideLayer('VNewParent');
		ShowLayer('VOldParent');
	if (playerH) playerH.sendEvent('STOP');
	}

	if (player =='playerH'){	//Show HD Player
		HideLayer('VOldParent');
		ShowLayer('VNewParent');
	if (playerL) playerL.sendEvent('STOP');
	}
   }

function showPlayerModal() {
	document.getElementById("ff-default").style.overflow = "hidden";
	document.getElementById("matteLayer").style.width = 100+"%";
	document.getElementById("matteLayer").style.height = 100+"%";

	document.getElementById("Videowrapper").style.top = 75+"px";
}

function hidePlayerModal() {
	if (playerH){
	if (playerH.sendEvent){ playerH.sendEvent('STOP');}}
	if (playerL){
	if (playerL.sendEvent){ playerL.sendEvent('STOP');}}
//	document.getElementById("Videowrapper").innerHTML = "<div id='placeholder1'></div>";

	document.getElementById("ff-default").style.overflow = "auto";
	document.getElementById("matteLayer").style.width = 0+"%";
	document.getElementById("matteLayer").style.height = 0+"%";

	document.getElementById("Videowrapper").style.top = -9999+"px";
}

createPlayer('playerH','VcontainerH');
createPlayer('playerL','VcontainerL');

