
function verif_login(theForm) {
	strerreurs='';
	if (theForm.up.value=='') { strerreurs+='- Le mot de passe est un champ obligatoire.\n'; }
	if (theForm.ul.value=='') { strerreurs+='- L\'email est obligatoire.\n'; }
	else {
		re = /^[\+\w._-]+@[\w.-]{2,}[.][a-zA-Z]{2,4}$/;
		if (! re.test(theForm.ul.value)) {
			strerreurs+='- L\'email est mal saisi ou invalide.\n';
		}
		else {
			re = /(@\.)|(\.@)|(\.\.)/;
			if ( re.test(theForm.ul.value)) {
				strerreurs+='- L\'email est mal saisi ou invalide.\n';
			}
		}
	}
	if (strerreurs.length>0) {
		alert('Erreurs : \n'+strerreurs);
		return false;
	} else {	
		return true;
	}
}

function delete_file2(myLinks) {
	url = myLinks[document.getElementById("idcours").value];
	if(confirm('Voulez-vous vraiment supprimer ce fichier ?')) {
		document.location.href=url;
	}else{
		return false;
	}
}

function delete_file(url) {
	//alert(id);
	//document.fichier_delete.fid.value=id;
	if(confirm('Voulez-vous vraiment supprimer ce fichier ?')) {
		//document.fichier_delete.submit();
		document.location.href=url;
	}else{
		return false;
	}
}

function delete_img(url) {
	if(confirm('Etes-vous sur de vouloir supprimer l\'image?')){
		document.location.href=url;
	}else{
		return false;
	}
}
function confirm_delete(url){
	//alert(url);
	if(confirm('Voulez-vous vraiment supprimer cette information ?')) {
		document.location.href=url;
	}else{
		return false;
	}
}
function confirm_delete_fichier(){
	if(confirm('Voulez-vous vraiment supprimer ce fichier ?')) {
		return true;
	}else{
		return false;
	}
}
function changeimg( sens ) { //sens -> 1 ou -1
	img_encours += sens;
	objDiv1.style.display = "block";
	objDiv2.style.display = "block";
	if (img_encours == 0) {
	objDiv1.style.display = "none";
	}
	if (img_encours == myImages.length-1) {
	objDiv2.style.display = "none";
	}
	document.getElementById("idcours").value = img_encours;
	document.photo.src=myImages[img_encours].src;
	//document.form_suppr.fichiers_nom.value=myImages[img_encours].value;
	document.photo.width=myImages[img_encours].width;
	document.photo.height=myImages[img_encours].height;
}
function lignes_affiche(d, f) {
	//alert("d : "+d+" - f : "+f);
	var debut = d*1;
	var fin = f*1;
	while (debut <= fin) {
		//alert("ligne : "+debut+" - f : "+fin);
		objNav_to_open = document.getElementById("L_"+debut);
		//alert(objNav_to_open);
		if (objNav_to_open != null) {
			if (objNav_to_open.style.display=="none") {
				objNav_to_open.style.display="";
			} else {
				objNav_to_open.style.display="none";
			}
		}
		debut++;
	}
}


function change_transporteurs(pay_l_id, type){
	var url="p_transporteurs.php";
	
	var _url = url+"?pays_id="+pay_l_id.value;
	call_infos_transporteurs(_url, type);
}

function call_infos_transporteurs(url,type){
	if(_xmlHttp && _xmlHttp.readyState!=0){
		_xmlHttp.abort()
	}	
	
	_xmlHttp=getXMLHTTP();
	
	if(_xmlHttp){
		//appel à l'url distante
		_xmlHttp.open("GET",url,true);
		_xmlHttp.onreadystatechange=function() {
			if(_xmlHttp.readyState==4 && _xmlHttp.responseXML) {
				while (document.modif.documents_transporteurs_id.options.length>0){
					document.modif.documents_transporteurs_id.options[0] = null;
				}
				var liste = traiteXmlSuggestions(_xmlHttp.responseXML);
				
				document.modif.documents_transporteurs_id.options.length = liste.length;
				
				for(var f=0; f<liste.length; ++f){
					document.modif.documents_transporteurs_id.options[f].value = _resultListeID[liste[f]];
					document.modif.documents_transporteurs_id.options[f].text = liste[f];
				}
				
				
			}
		};
		// envoi de la requete
		_xmlHttp.send(null);
	}
}
