function show_form(){
	
	var o = document.getElementById('formulaire');
	if (o!='') o.style.display = 'block';

	o = document.getElementById('liste_formulaire');
	if (o!='') o.style.display = 'none';

	return false;
}
function verif_date() {
	if (document.F_search.form_search_unitdate1.value != '' && document.F_search.form_search_unitdate2.value != '') {
		document.F_search.form_search_unitdate.value = document.F_search.form_search_unitdate1.value;
	}
	else if (document.F_search.form_search_unitdate1.value != '' && document.F_search.form_search_unitdate3.value == '') {
		document.F_search.form_search_unitdate3.value = document.F_search.form_search_unitdate1.value;
		document.F_search.form_search_unitdate.value = document.F_search.form_search_unitdate1.value;
		document.F_search.form_search_unitdate1.value = '';
	}
	else if (document.F_search.form_search_unitdate1.value == '' && document.F_search.form_search_unitdate3.value != '') {
			document.F_search.form_search_unitdate.value = document.F_search.form_search_unitdate3.value;
	}
	else if (document.F_search.form_search_unitdate1.value != '' && document.F_search.form_search_unitdate3.value != '') {
		alert('Attention : la recherche par date doit obligatoirement se faire soit par date exacte, soit par période');
		return false;
	}
	document.F_search.submit();
	return false;
}
function get_normal_cote(user_cote, last_cote)
{
	if (user_cote == '') return '';
	var normal = '';
	var parts;
	user_cote = user_cote.replace(/\s*:\s*/,' ');
//	user_cote = user_cote.replace(/H(\s*)dépôt/i,'Hdepot');
	user_cote = user_cote.replace(/art\.?/, '/');
	/* un seul nombre */
	parts = user_cote.match(/^\s*(\d*)\s*$/i);
	if (parts) {
		if (last_cote != '') {
			return last_cote.replace(/(\/|^)(\d+)([^\d]*)$/, '$1' + parts[1]);
		}
		else return parts[1];
	}
	/* un nombre avec une lettre minuscule */
	parts = user_cote.match(/^\s*(\d+)([a-z])\s*$/);
	if (parts) {
		if (last_cote != '') {
			return last_cote.replace(/\/(\d+)([^\d]*)$/, '/' + parts[1] + '/' + parts[2]);
		}
		else return parts[1] +  parts[2]; // modif GL 26/02/2009  // '/' +
	}
	/* deux nombres séparés par un /  */
	parts = user_cote.match(/^\s*(\d+)([a-z]*)\s*\/\s*(\d+)([a-z]*)\s*$/);
	if (parts && last_cote != '') {
		if (last_cote != '') return last_cote.replace(/(\d+)([a-z]*)\/?(\d*)([a-z]*)$/, parts[1] + parts[2] + '/' + parts[3] + parts[4]);
		else return parts[1] + parts[2] + '/' + parts[3] + parts[4];
	}
	/* cote complète */
	/* new methode - GL - 04/11/2010 */
	var first_alpha = false;
	var last_type = '';
	user_cote = user_cote.replace('/\/+/', '/');
	user_cote = user_cote.replace('/\s+/', ' ');
	normal = '';
	for (i = 0; i < user_cote.length; i++) {
//	for (i in user_cote) {
		var c = user_cote.charAt(i);
//		alert(c);
		if (c.match(/\//)) {
			if (normal != '' && last_type != '') normal += '/';
			last_type = '';
			first_alpha = true;
		}
		else if (c.match(/\s/)) {
			if (normal != '' && last_type != '' && (last_type == 'alpha' || first_alpha)) normal += '/';
			last_type = '';
		}
		else if (c.match(/\d/)) {
			mytype = 'num';
			if (mytype != last_type && last_type != '') normal += '/';
			normal += c;
			last_type = mytype;
		}
		else {
			mytype = 'alpha';
			if (mytype != last_type && last_type != '' && first_alpha) normal += '/';
			normal += c;
			last_type = mytype;
			first_alpha = true;
		}
	}
	normal = normal.replace('/\/+/', '/');
	return normal;
}
function user_cote_to_normal_cote(user_cote)
{
	if (user_cote == '') return '';
	var normal = '';
	/* Fractionnement selon le point virgule ou la virgule */
	user_cote = user_cote.replace(/H(\s*-?\s*)d(é|e)p(ô|o)t/i,'HDEPOT');
	var cotes = user_cote.split(/\s*[;,]\s*/ig);
	var last_cote = '';
//	document.title = '';
	for (var i = 0; i < cotes.length; i++) {
		var correct_cote = '';
		cotes[i] = cotes[i].replace(/\[|\]|\(|\)|\.|\,|\<\/?[^\>]*\>/ig,' ');
		/* Fractionnement selon le - ou le */
		var parts = cotes[i].split(/\s*-\s*/ig);
		for (var j = 0; j < parts.length; j++) {
			var normal_cote = get_normal_cote(parts[j], last_cote);
			if (normal_cote != '') {
				if (j == 0) {
					if (i > 0) {
						a = last_cote.split(/\//i);
						b = normal_cote.split(/\//i);
						if (a[0] != b[0] && b.length < a.length) {
							/*
							 *  test supplémentaire GL 20/11/2009
							 */
							var ok = false;
							if (!normal_cote.match(/[a-zA-Z]/)) ok = true;
							else if (normal_cote.match(/^\s*(\d+)\s*(bis|ter)\s*$/i)) ok = true;
							/* */
							if (ok) {
								for (k = (a.length - b.length - 1); k >= 0; k--) {
									normal_cote = a[k] + '/' + normal_cote;
								}
							}
						}
					}
					last_cote = normal_cote;
				}
//				document.title += parts[j] + '=>' + normal_cote + ", ";
				if (correct_cote != '') correct_cote += '-';
				correct_cote += normal_cote;
			}
		}
		if (normal != '') normal += ';';
		normal += correct_cote.toUpperCase();
	}
//	alert(normal);
	return normal;
}
function synchro_cote(field_src, field_dest)
{
	eval('document.F_search.' + field_dest + '.value = user_cote_to_normal_cote(document.F_search.' + field_src + '.value);');
}

