﻿function ChangeSizeWidget(Url,IdVideo,Size)
{
	document.getElementById("widget_js").value = "<script language='javascript' src='" + Url + "?NUM_VIDEO=" + IdVideo + "&SIZE=" + Size + "'></script>";
}


function ShowWidgetVideo()
{
	var target = $('WidgetJs');
	var fx = new Fx.Styles(target, {duration: 1000, wait: false});
	fx.options.transition = Fx.Transitions['Expo']['easeOut'];
	fx.options.duration = 1000;
	if (parseInt(document.getElementById("WidgetJs").style.height) == 0)
		fx.start({'height': 40});
	else
		fx.start({'height': 0});
	
}

function ShowWidgetPlaylist()
{
	var target = $('WidgetJs');
	var fx = new Fx.Styles(target, {duration: 1000, wait: false});
	fx.options.transition = Fx.Transitions['Expo']['easeOut'];
	fx.options.duration = 1000;
	if (parseInt(document.getElementById("WidgetJs").style.height) == 0)
		fx.start({'height': 40});
	else
		fx.start({'height': 0});
	
}


var LeftListeDeclinaisons = 0;

function DefilePlaylist(Action,NbDeclinaisons,aNbPix,aNbDisplays)
{
	var target = $('Liste');
	var fx = new Fx.Styles(target, {duration: 1000, wait: false});
	var NbDisplays = aNbDisplays;
	var NbPix = aNbPix;
	//target.setStyles({'height': 0});

	fx.options.transition = Fx.Transitions['Expo']['easeOut'];
	fx.options.duration = 1000;
	MinLeftListeDeclinaisons = -NbPix * Math.ceil((NbDeclinaisons-NbDisplays)/NbDisplays);
	MaxLeftListeDeclinaisons = NbPix * Math.ceil((NbDeclinaisons-NbDisplays)/NbDisplays);
	if (Action == "droite" )
	{
		if ((LeftListeDeclinaisons - NbPix >= MinLeftListeDeclinaisons))
			LeftListeDeclinaisons = LeftListeDeclinaisons - NbPix; 
	}
	if (Action == "gauche")
	{
		if ((LeftListeDeclinaisons + NbPix <= MaxLeftListeDeclinaisons))
			LeftListeDeclinaisons = LeftListeDeclinaisons + NbPix; 	
	}
	
	if ((LeftListeDeclinaisons - NbPix < MinLeftListeDeclinaisons))
		document.getElementById("fleched").style.visibility = "hidden";
	else
		document.getElementById("fleched").style.visibility = "";	
		
	
	
	if ((LeftListeDeclinaisons + NbPix >= MaxLeftListeDeclinaisons) || (LeftListeDeclinaisons == 0 ))
		document.getElementById("flecheg").style.visibility = "hidden";
	else
		document.getElementById("flecheg").style.visibility = "";	
	
	
	fx.start({'left': LeftListeDeclinaisons});

}