// Procédures globales du projet
function Ajout_Playlist(slocation,simage,stitle,screator,sinfo,sid)
{
	try {
		// Instructions dans lesquelles des exceptions risquent d'être lancées
		fenetre3.document.getElementById("FLASH3").SetVariable("Ajout_location", slocation);
		fenetre3.document.getElementById("FLASH3").SetVariable("Ajout_image", simage);
		fenetre3.document.getElementById("FLASH3").SetVariable("Ajout_title", stitle);
		fenetre3.document.getElementById("FLASH3").SetVariable("Ajout_creator", screator);
		fenetre3.document.getElementById("FLASH3").SetVariable("Ajout_info", sinfo);
		fenetre3.document.getElementById("FLASH3").echo_2();
	} catch(error) {
		// Instructions qui s'exécutent en cas d'une exception
		fenetre3 = window.open("PLAYLIST.awp?Id="+sid+"&sLib="+stitle,"Playlist","width=400,height=175,location=no,status=no,toolbar=no,scrollbars=no");
	} finally {
		// Instructions qui s'exécutent après dans les deux cas
		fenetre3.focus()
	}
}

function getCookieVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1)
	endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function SetCookie(name, value) {
	var argv=SetCookie.arguments;
	var argc=SetCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+((expires==null) ? "" : ("; expires="+expires.toGMTString()))+((path==null) ? "" : ("; path="+path))+((domain==null) ? "" : ("; domain="+domain))+((secure==true) ? "; secure" : "");
}

// Résumé : <indiquez ici ce que fait la procédure>
// Syntaxe :
// SetCookie ()
//
// Paramètres :
//	Aucun
// Valeur de retour :
// 	Aucune
//
// Exemple :
// Indiquez ici un exemple d'utilisation.
//
//Procédure SetCookie()
//
//
function GetCookie(name) {
	var arg=name+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg)
		return getCookieVal (j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;}
	return "";
}

// Résumé : <indiquez ici ce que fait la procédure>
// Syntaxe :
// Nouvelle_Procédure ()
//
// Paramètres :
//	Aucun
// Valeur de retour :
// 	Aucune
//
// Exemple :
// Indiquez ici un exemple d'utilisation.
//
//Procédure GetCookie()
//
//
function Ajout()
{
var Playlist = GetCookie("Playlist");
alert(Playlist);
setTimeout("Ajout()",1000);
}
//Ajout();
// Résumé : <indiquez ici ce que fait la procédure>
// Syntaxe :
// test ()
//
// Paramètres :
//	Aucun
// Valeur de retour :
// 	Aucune
//
// Exemple :
// Indiquez ici un exemple d'utilisation.
//
//Procédure test()
//
//
function Lance_Player()
{
	var arg="Player_Etat"+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	var Etat;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg)
		Etat = getCookieVal (j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	if(Etat!=1) { 
	fenetre3 = window.open("PLAYLIST.awp","Playlist","width=400,height=195,location=no,status=no,toolbar=no,scrollbars=no,resizable=no"); }
}

function Verifie_New_MP3()
{
	var Playlist = GetCookie("Playlist");
	var NbArt = Playlist.split("<>" ).length-1;
	var i;
	var PosId=0;
	var PosArt=0;
	var IdArt;
	var LibArt;
	if(NbArt!=0){
		for(i=1; i<=NbArt; i++) {
			PosId = Playlist.indexOf(":",0);
			PosArt = Playlist.indexOf("<>",0);
			IdArt = Playlist.substr(0,PosId);
			LibArt = Playlist.substr(PosId+1,PosArt-PosId-1);
			Playlist = Playlist.substr(PosArt+2)
			try {
				// Instructions dans lesquelles des exceptions risquent d'être lancées
				window.document.FLASH3.SetVariable("Ajout_location", "http://www.audiorythme.com/FR/MP3/"+LibArt+".mp3");
				window.document.FLASH3.SetVariable("Ajout_image", "http://www.audiorythme.com/FR/Images/Photo2_"+IdArt+".jpg");
				window.document.FLASH3.SetVariable("Ajout_title", LibArt);
				window.document.FLASH3.SetVariable("Ajout_creator", "");
				window.document.FLASH3.SetVariable("Ajout_info", "http://www.audiorythme.com/FR/Page_Detail.awp?idarticle="+IdArt);
				window.document.FLASH3.echo_2();
				window.document.FLASH3.focus();
				SetCookie("Playlist","");
				//				document.PLAYLIST.LIB.value = NbArtTot;
				} catch(error) {
//				alert(error);
				// Instructions qui s'exécutent en cas d'une exception
				} finally {
				// Instructions qui s'exécutent après dans les deux cas
//				setTimeout("Verifie_New_MP3()",2000);
				}
			
			}
		Playlist =""
		};
	setTimeout("Verifie_New_MP3()",2000);
}
Verifie_New_MP3();

// Résumé : <indiquez ici ce que fait la procédure>
// Syntaxe :
// Verifie_New_MP3 ()
//
// Paramètres :
//	Aucun
// Valeur de retour :
// 	Aucune
//
// Exemple :
// Indiquez ici un exemple d'utilisation.
//
//Procédure Verifie_New_MP3()
//
//
function Focus(fen)
{
fen.focus();
}
// Résumé : <indiquez ici ce que fait la procédure>
// Syntaxe :
//Focus (<Fen>)
//
// Paramètres :
// 	Fen : <indiquez ici le rôle de Fen>
// Valeur de retour :
// 	Aucune
//
// Exemple :
// Indiquez ici un exemple d'utilisation.
//
//PROCEDURE Focus(Fen)
//fen.focus();
//
//
