function PopUpView(url)
{
	var height = screen.availHeight ;
	var width = screen.availWidth;
	//url = url+'&width='+(width-150)+'&height='+(height-100);
	window.open(url,"_blank","toolbar=no, location=0, directories=no, status=no, menubar=no, titlebar=no, scrollbars=yes, resizable=yes, copyhistory=no, width="+width+", height="+height);
}

function degrise(quoi){
	$('acteur1').disabled= true;
	$('real1').disabled= true;
	$('genre1').disabled= true;
	$(quoi).disabled= false;
}

var lien_user = 1;
function ajoute_ligne(){
	lien_user++;
	var input = document.createElement("input");
	input.setAttribute("type","text");
	input.setAttribute("name","lien"+lien_user);
	
	var br = document.createElement("br");
	
	$('lien_user').appendChild(br);
	$('lien_user').appendChild(input);
}

function supprime_ligne(){
	if(lien_user>1){
		$('lien_user').removeChild($('lien_user').lastChild);
		$('lien_user').removeChild($('lien_user').lastChild);
		lien_user--;
	}
}

function ouvrirPopUp(url){
	if(document.all){window.open(url);}
	else{window.open(url,'Choix de l image','width=700,height=500,menubar=no,scrollbars=yes,status=no');}
}

var old_id = 'home';
function affiche(id){
	if($(old_id)){
		$(old_id).style.display = 'none';
		$(id).style.display = 'block';
		old_id = id;
	}
}

function lien(url){
	location.href = url;
}

function select_all(quoi){
	var input = document.getElementsByTagName('input');
	if(quoi.checked){
		for(var i=0;i<input.length;i++){
			input[i].checked = true;
		}
	}else{
		for(var i=0;i<input.length;i++){
			input[i].checked = false;
		}
	}
}

function lance_download(id){
	var input = document.getElementsByTagName('input');
	for(var i=0;i<input.length;i++){
		if(input[i].checked){
			location.href = input[i].value;
			new Ajax.Request('index.php?page=incNbDwn&id='+id+'', {onSuccess:ajoute_categorie, onFailure:errFunc});
		}
	}
}

var estAffiche = true;
function select_categorie(valeur){
	var i=1;
	while($('categorie'+i)){
		new Ajax.Request('index.php?page=admin&menu=get_categorie&type='+valeur+'&ou='+i+'', {onSuccess:ajoute_categorie, onFailure:errFunc});
		i++;
	}
	if(valeur == 1 ||valeur == 5 ||valeur == 2){
		if(!estAffiche){
			var div = document.createElement("div");
			div.setAttribute("class","left");
			
			var label = document.createTextNode("A l'affiche: ");
			div.appendChild(label);
			
			var div2 = document.createElement("div");
			div2.setAttribute("class","left");
			var input = document.createElement("input");
			input.setAttribute("type","checkbox");
			input.setAttribute("name","aLaffiche");
			div2.appendChild(input);
			
			$('aLaffiche_fiche').appendChild(div);
			$('aLaffiche_fiche').appendChild(div2);
			estAffiche = true;
		}
	}else{
		if(estAffiche){
			$('aLaffiche_fiche').innerHTML = "";
			estAffiche = false;
		}
	}
}
var errFunc = function(){alert('Erreur');}

var ajoute_categorie = function(xmlDoc){
	xml = xmlDoc.responseXML;
	var select = xml.getElementsByTagName('categories');
	select = $('categorie'+select[0].attributes[0].firstChild.data);
	select.innerHTML = ''
	option = document.createElement("option");
	text_option = document.createTextNode("Choisir la categorie");
	option.appendChild(text_option);
	option.setAttribute("value",0);
	select.appendChild(option);
	var role = xml.getElementsByTagName('categorie');
	for (var i=0; i < role.length; i++) {
		option = document.createElement("option");
		option.setAttribute("value",role[i].attributes[0].firstChild.data);
		text_option = document.createTextNode(role[i].firstChild.data);
		option.appendChild(text_option);
		select.appendChild(option);
	}
}



function ejs_img_fx(img)
	{
	if(img && img.filters && img.filters[0])
		{
		img.filters[0].apply();
		img.filters[0].play();
		}
	}

function startAnim(nbsec,taille)
	{
	if (document.images)
		{
		document.write('<A HREF="#" onClick="ImgDest();return(false)"><IMG width="150" height="200" SRC="http://a69.g.akamai.net/n/69/10688/v1/img5.allocine.fr/acmedia/rsz/434/x/x/x/medias/nmedia/18/64/50/01/18900175.jpg" BORDER=0 ALT=Menu NAME=defil style="filter:progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=100,Duration=1)"></A>');
		defilimg(nbsec,taille)
		}
	else
		{
		document.write('<A HREF=""><IMG width="150" height="200" SRC="http://a69.g.akamai.net/n/69/10688/v1/img5.allocine.fr/acmedia/rsz/434/x/x/x/medias/nmedia/18/64/50/01/18900175.jpg" BORDER=0></A>')
		}
	}
function ImgDest()
	{
	document.location.href = SiClickGoTo[a-1];
	}
function defilimg(nbsec,taille)
	{
	if (a == taille)
		{
		a = 0;
		}
	if (document.images)
		{
		
		ejs_img_fx(document.defil)
		//alert(document.defil.src);
		document.defil.src = imgPath[a];
		//alert(document.defil.src);
		tempo3 = setTimeout("defilimg("+nbsec+","+taille+")",nbsec);
		a++;
		}
	}


