<!--//

/*
*		CHECKBOX FUNCTIONS
*/


function reset_checkbox (el) {
	ar = document.getElementsByName (el);
	for (i=0;i<ar.length;i++) {
		e = ar[i];
		e.checked = false;
	}
}

function check_only(id) {
	a = document.getElementById(id);
	reset_checkbox(a.name);
	a.checked = true;
}



/*
*		BUTTON FUNCTIONS
*/

function set_form_action (form_id, action, button) {
	s = 'FORM'+form_id+'ACTION';
	e = button.form[s];
	e.value = action;
}

function link_button (button_id) {
	e = document.getElementById (button_id);
	e.click();
}

/*
*		LIST FUNCTIONS
*/


/*
	Select in a selectlist the first matching value 
*/
function select_in_list(listName,val){
	list=document.getElementById(listName);
	i=0;
	trv=false;
	while(i<list.options.length && !trv){
		if(list.options[i].text.toLowerCase().match(val.toLowerCase()+'.*')){
			list.options[i].selected=true;
			trv=true;
		}
		i++;
	}
}

/*
*		INPUT FUNCTIONS
*/

// Si aucune valeur n'est rentrée, on place la valeur par défaut
function put_default(inputName,def){
	o=document.getElementById(inputName);
	if(o.value=="")
		o.value=def;
}


/*
*		OTHER FUNCTIONS
*/

/*
	Lors du login, cette fonction va crypter le mot de passe à envoyer
*/
function cryptage(){
	pass=document.getElementById('PASS').value;
	random=document.getElementById('RANDOM').value;
	c_pass=MD5(random+MD5(pass));
	document.getElementById('CPASS').value=c_pass;
	document.getElementById('PASS').value="";
}
//-->