//Fonction standard pour les inputs
function input_select(nom, selected, autre, info, valeur) {
	//pour cette fonction répéter autant de fois qu'il y a de ligne dans le menu les arguments : info et valeur
	var option;
	var sel;
	for (var i=3; i < input_select.arguments.length; i=i+2) {
		select_info = arguments[i];
		select_valeur = arguments[i+1];
		if (select_valeur==selected){
			sel=1;
		}
		else{
			sel=0;
		}
		option = option + input_select_write_option(select_info, select_valeur, sel);
	}
	return '<select name="' + nom + '" ' + autre + '>' + option + '</select>';
}
function input_select_write_option(select_info, select_valeur, sel){
	var selected;
	if (sel==1){selected=' selected';}else{selected='';}
	return '<option value="' + select_valeur + '"' + selected + '>' + select_info + '</option>';
}

function input_little_texte(nom, valeur, autre){
	return '<input name="' + nom + '" type="text" class="normal" id="' + nom + '" lang="fr" value="' + valeur + '" size="20" maxlength="100" ' + autre + '>';
}

function input_numeric(nom, valeur, autre){
	return '<input name="' + nom + '" type="text" class="normal" id="' + nom + '" style="text-align:right" lang="fr" value="' + valeur + '" size="12" maxlength="100" ' + autre + '>';
}


function input_date(nom, valeur, afficher_calendrier, autre){
	//Pour le input date ne pas utiliser le onClick
	var input_html;
	input_html = '<input name="' + nom + '" type="text" class="normal" id="' + nom + '" lang="fr" value="' + valeur + '" size="10" maxlength="10" style="margin:0px; border:0px;" ' + autre + '>' ;
	if (afficher_calendrier) input_html = input_html + '<img src="imgCalendrier/cal.gif" width="16" height="16" border="0" alt="Cliquez ici pour obtenir la date." onClick="CalendarInput(' + nom + ');"  style="cursor:hand" align="absbottom">';
	//ajout d'un table autour
	input_html='<table border="0" cellspacing="0" cellpadding="0" style="border-top:solid 1px #abadb3; border-left:solid 1px #e2e3ea ; border-right:solid 1px #e3e9ef ; border-bottom:solid 1px #e3e9ef ;"><tr><td valign="middle">' + input_html + '</td></tr></table>';
	
	return input_html;
	
}

function input_checkbox(nom, check, autre){
	if (check==1)
		checked = ' checked="checked" ' ;
	else
		checked='' ;
	return '<input name="' + nom + '" type="checkbox" id="' + nom + '" value="1" ' + checked + ' ' + autre + '>'; 
}

function input_hidden(nom, valeur, autre){
	return '<input name="' + nom + '" type="hidden" id="' + nom + '" value="' + valeur + '" ' + autre + '>';
}


//Fonction personnalisées pour les inputs
function select_taux_tva(nom, selected, autre){
	return input_select(nom, selected, autre, '19,6%', '0.196', '8,5%', '0.085', '5,5%', '0.055', '0%', '0');
}

