
function alterne_bgcolor(id, color1, color2)
{
  var bgcolor = document.getElementById(id).style.backgroundColor;
  document.getElementById(id).style.backgroundColor = bgcolor == color1?color2:color1;
}
/*
function show_menu(id)
{
  if(id != ''){
  document.all[id+'Div'].style.visibility = 'visible';
  document.all.fondDiv.style.visibility = 'visible';  
  }else{
  document.all['organiserDiv'].style.visibility = 'hidden';
  document.all['editerDiv'].style.visibility = 'hidden';  
  document.all.fondDiv.style.visibility = 'hidden';    
  }
}
*/
//provenance=ma_gal
function orderBy(num)
{
  location.href='?SiteID='+site_id+'&PageID=13&orderby='+num;
}
function change_nb_contacts(num)
{
  location.href = '?SiteID='+site_id+'&PageID=25&etape=ajouter_contacts&nb_contacts_ajout='+num;
}
function toggle_gerer_album(album_id)
{
  var albumLayer = document.getElementById('moreInfo_album' + album_id);
  var imagesLayer = document.getElementById('moreInfo_images' + album_id);  
  albumLayer.style.display       = albumLayer.style.display == 'none' ? 'inline' : 'none';
  imagesLayer.style.display       = 'none';  
}
function toggle_gerer_images(album_id)
{
  var albumLayer = document.getElementById('moreInfo_album' + album_id);
  var imagesLayer = document.getElementById('moreInfo_images' + album_id);  
  imagesLayer.style.display       = imagesLayer.style.display == 'none' ? 'inline' : 'none';
  albumLayer.style.display       = 'none';  
}

// Recharge la page avec un autre album
// id :: id de l'album
function change_album()
{
  //document.choix.etape.value = '';
  // Rq: id pointe vers la valeur. Si on sort de with(document.choix), id devient 'undefined'  
  with(document.entete){ 
	var album_id = albums.options[albums.selectedIndex].value;
    location.href = 'index.php?SiteID='+site_id+'&PageID='+(album_id == 0?13:page_id)+(album_id == 0?'':'&AlbumID='+album_id);
  }
}
//jjj
function action_albums(type)
{
  if(!verif_selected(document.choix, 'AlbumIDS[]')){
    alert(TEXT_INDEX_MAGAL);  
  	return;
  }
  if(type=='supprimer'){
    document.choix.PageID.value = 21;
	document.choix.etape.value = 'sup_album';
  }
  else if(type=='partager'){
    document.choix.PageID.value = 48;
	document.choix.from.value = 'index';
	document.choix.init.value = 1;
  }
  else if(type=='modifier') document.choix.PageID.value = 20;
  //document.choix.etape.value = '';
  soumettre();
}
function check_album(formObj, id)
{
  for (i=0; i<formObj.elements.length; i++){
    if (formObj.elements[i].name == 'AlbumIDS[]' && formObj.elements[i].value == id){
	  formObj.elements[i].checked = true;
	  return true;
	}
  }
  return false;
}
function partager_album(id)
{
  select_all(false);
  /*
  if(check_album(document.choix, id)) {
    document.choix.PageID.value = 48;
    soumettre();
  }
  else alert('Erreur');
  */
  document.choix.AlbumID.value = id;
  document.choix.PageID.value = 48;
  soumettre();  
}

/*
function supprime_favori(pseudo)
{
  //document.choix.supprime_favori.value = pseudo;
  document.choix.submit();
}
*/
// Recharge la page en changeant eventuellement l'orderby et la limit
function recharge (what,value)
{
  string='';
  if (what!='orderby'){
	string+='orderby='+order_by+'&offset=0&' ;
  }
  else if (what != 'limit'){
	string+='limit='+limit+'&offset=0&' ;  
  }
  location.href='index.php?SiteID='+site_id+'&PageID='+page_id+'&'+what+'='+value+'&'+string;
}  

var popuptransfert;


