
/****************************************************************************/
/*                          FONCTIONS COMMUNES :                            */
/****************************************************************************/

/* Cache le composant s */
function hide(s) {
  if (document.all) {
    if (document.all[s]) {
      document.all[s].visibility="invisible";
      eval("document.all."+s+".style.display=\"none\"");
    }
  } else {
    if (document.getElementById(s)) {
      document.getElementById(s).visibility="invisible";
      document.getElementById(s).style.display="none";
    }
  }
}

/* Affiche le composant s */
function show(s,shm) {
  if (!shm) shm="block";
  if (document.all) {
    if (document.all[s]) {
      document.all[s].visibility="visible";
      eval("document.all."+s+".style.display=\""+shm+"\"");
    }
  } else {
    if (document.getElementById(s)) {
      document.getElementById(s).visibility="visible";
      document.getElementById(s).style.display=shm;
    }
  }
}

/* Affiche / Cache le composant s */
function swap(s,shm) {
    if (document.all) {
	if (document.all[s]) {
	    if (document.all[s].visibility=="visible") {
		hide(s);
	    } else {
		show(s,shm);
	    }
	}
    } else {
	if (document.getElementById(s)) {
	    if (document.getElementById(s).visibility=="visible") {
		hide(s);
	    } else {
		show(s,shm);
	    }
	}
    }
}

function checkdon() {
  var don=0;
  if (document.forms['f1'].sum5.checked) {   don=5;  }
  if (document.forms['f1'].sum25.checked) {    don=25;  }
  if (document.forms['f1'].sum50.checked) {    don=50;  }
  if (document.forms['f1'].sum100.checked) {    don=100;  }
  if (document.forms['f1'].sum200.checked) {    don=200;  }
  if (document.forms['f1'].sum1.checked) {
    don=parseInt(document.forms['f1'].othersum.value,10);
  }
  if (don<5) {
    hide("divdon5"); hide("divdon50"); hide("divdon100"); hide("divdon200");
    //hide('lnom'); 
    hide('ladr');
    //hide('lnom2'); 
    hide('ladr2');
    show('divdon0');
  }
  if (don>=5 && don<50) { 
    hide('divdon0');
    show("divdon5"); hide("divdon50"); hide("divdon100");  hide("divdon200"); 
    //show('lnom'); 
    hide('ladr');
    hide('ladr2'); 
    /*
    if(document.forms['f1'].perso.checked) {
      show('lnom2');
    } else {
      hide('lnom2');
    }
    */
  }
  if (don>=50 && don<100) {
    hide('divdon0');
    hide("divdon5"); show("divdon50"); hide("divdon100");  hide("divdon200"); 
  }
  if (don>=100 && don<200) {
    hide('divdon0');
    hide("divdon5"); hide("divdon50"); show("divdon100");  hide("divdon200"); 
  }
  if (don>=200) {
    hide('divdon0');
    hide("divdon5"); hide("divdon50"); hide("divdon100");  show("divdon200"); 
  }

  if (don>=50) { // on propose l'adresse : 
      //hide('lnom'); 
    show('ladr');
    if (document.forms['f1'].send.checked) {
      show('ladr2');
      //      show('lnom2');
    } else {
      hide('ladr2');
      //      hide('lnom2');
    }
  }
}

function clickautre() {
  if (document.forms['f1'].othersum.value=="") {
    document.forms['f1'].othersum.value="100";
  }
  document.forms['f1'].othersum.focus(); 
}


function popupdon() {
    window.open('don2010_retour.php');
    return false;
}
