function categorie_active_desactive(obj, id){
    var img = obj.getElementsByTagName('img');
    if(img.length <= 0){
         var img = obj.getElementsByTagName('span');
         disp = ( obj.title == 'actif')? 'inactif' : 'actif';
         img[0].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader"
                                + "(src=\'../_admin/_images/"+disp+".png'\', sizingMethod='scale')";
           obj.title = disp;
    }else{ 
        img = img[0]
        disp = (img.alt == 'actif')? 'inactif' : 'actif';
        img.src = '../_admin/_images/'+disp+'.png';
        img.alt = disp;
        obj.title = disp;
    }

    var url = 'etat-categorie.php?categorie_id='+id+'&status='+disp;
    new Ajax.Request(url,
    {
          method:'get'
    });

}

function film_active_desactive(obj, permalien){
    var img = obj.getElementsByTagName('img');
    if(img.length <= 0){
         var img = obj.getElementsByTagName('span');
         disp = ( obj.title == 'actif')? 'inactif' : 'actif';
         img[0].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader"
                                + "(src=\'../_admin/_images/"+disp+".png'\', sizingMethod='scale')";
           obj.title = disp;
    }else{
        img = img[0]
        disp = (img.alt == 'actif')? 'inactif' : 'actif';
        img.src = '../_admin/_images/'+disp+'.png';
        img.alt = disp;
        obj.title = disp;
    }

    var url = 'etat-film.php?permalien='+permalien+'&status='+disp;
    new Ajax.Request(url,
    {
          method:'get'
    });

}

function update_vote(url,id){
var requete = new Ajax.Request(url, 
                          { 
                          method: 'get',
                          onSuccess: function(transport) {
                             var response = transport.responseText;
                             if (response != '-'){   
                              $('current-rating'+id).style.width = response+'0%';   
                              $('star-rating'+id).innerHTML = '<li id="current-rating'+id+'" class="current-rating2" style="width:'+response+'0%;">Note actuelle</li>';                      
                             }
                          },
                          onFailure: function(){ $('result_vote'+id).innerHTML = '-'; }
                          }
                    );

}

function ChangeListPage(){
  var valeur = document.getElementById('listepage').options[document.getElementById('listepage').selectedIndex].value;
  if (valeur != "0"){
     window.location = valeur;
  }   
}

function ChangeListPageBottom(){
  var valeur = document.getElementById('listepagebottom').options[document.getElementById('listepagebottom').selectedIndex].value;
  if (valeur != "0"){
     window.location = valeur;
  }
}

function send()
{
	testmail= /^[a-zA-Z0-9._~-]+@[a-zA-Z0-9._~-]+\.[a-zA-Z0-9]{2,4}$/;
	if (document.form_abo.nom.value=="")
	{
		alert("Nom : champ obligatoire.");
	}
	else if (document.form_abo.prenom.value=="")
	{
		alert ("Prénom : champ obligatoire.");
	}
	else if (document.form_abo.email.value=="")
	{
		alert ("Email : champ obligatoire");
	}
	else if(!testmail.test(document.form_abo.email.value))
	{
		alert('Vous devez indiquer un email valide');
	}
	else
	{
		document.form_abo.submit();
	}
}

function Valider()
{
	testmail= /^[a-zA-Z0-9._~-]+@[a-zA-Z0-9._~-]+\.[a-zA-Z0-9]{2,4}$/;
	if (form_achat_cb.nom.value=="")
	{
		alert("Nom : champ obligatoire.");
	}
	else if (form_achat_cb.prenom.value=="")
	{
		alert ("Prénom : champ obligatoire.");
	}
	else if (form_achat_cb.email.value=="")
	{
		alert ("Email : champ obligatoire");
	}
	else if(!testmail.test(form_achat_cb.email.value))
	{
		alert('Vous devez indiquer un email valide');
	}
	else
	{
		return true;
	}
	return false;
}

