

function trim (myString)
{
return myString.replace(/^\s+/g,'');
}


function afficherMenu(numMenu)
{
	document.getElementById('menuId').value=numMenu;
	document.frmMenu.submit();
}



function getExpertBlackList(UrlSite, strSocieteId, strClientId)
{
	
	
	
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}

	xhr_object.open("POST", UrlSite  + "inc/_getExpertBlackList.asp"  , true);

	xhr_object.onreadystatechange = function() {
	      if(xhr_object.readyState == 4)
	      {

	      		document.getElementById('divListeExpertBlackList').innerHTML=xhr_object.responseText;	      	     
	      }
	
		 
		 
		 
	   }
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send("societeId=" + strSocieteId  + "&clientId=" + strClientId );
}




function getVille(UrlSite, strCp, strVille)
{
	
	
	
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}

	xhr_object.open("POST", UrlSite  + "inc/_getVille.asp"  , true);

	xhr_object.onreadystatechange = function() {
	      if(xhr_object.readyState == 4)
	      {

	      		document.getElementById('divListeVille').innerHTML=xhr_object.responseText;	      	     
	      }
	
		 
		 
		 
	   }
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send("cp=" + strCp  + "&txtVilleClient=" + strVille );
}




function getExistanceLogin(UrlSite, strLogin, strContactId)
{
	
	
	
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return ;
	}

	xhr_object.open("POST", UrlSite  + "inc/_getExistanceLogin.asp"  , true);

	xhr_object.onreadystatechange = function() {
	      if(xhr_object.readyState == 4)
	      {

	      		if(parseInt(xhr_object.responseText)> 0 )
	      		{
		      		document.getElementById('divVerifLogin').className="clsIconeErreur"
				document.getElementById('divVerifLogin').title = 'Login déjà attribué';		
	      		}
	      		else
	      		{
	      			document.getElementById('divVerifLogin').className="clsIconeOk"
				document.getElementById('divVerifLogin').title = '';
      		
	      		}
	      		
	      		
	      	

	      		
	      }
	
		 
		 
		 
	   }
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send("strLogin=" + strLogin  + "&contactId=" + strContactId );
}





function addExpertVille(UrlSite,  strExpertId, strVilleId)
{
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}

	xhr_object.open("POST", UrlSite  + "inc/__addExpertZone.asp"  , true);

	xhr_object.onreadystatechange = function() {
	      if(xhr_object.readyState == 4)
	      {

	      		document.getElementById('listeExpertZoneDeTravail').innerHTML=xhr_object.responseText;	
	      		
	      		var strNodeDel = document.getElementById('cboEl' + strVilleId);
			strNodeDel.parentNode.removeChild(strNodeDel);
			document.getElementById('cboExpertVille').value='0';
			document.getElementById('imgAjouterExpertVille').style.display='none';
	      }
	
		 
		 
		 
	   }
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send("expertId=" + strExpertId  + "&codeVille=" + strVilleId );
}












function getContactClient(UrlSite,  strClientId, strContactId, strTdCboId)
{
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}

	xhr_object.open("POST", UrlSite  + "inc/__getContactClient.asp"  , true);

	xhr_object.onreadystatechange = function() {
	      if(xhr_object.readyState == 4)
	      {
	      		document.getElementById(strTdCboId).innerHTML=xhr_object.responseText;	
	      }
	
		 
		 
		 
	   }
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send("clientId=" + strClientId  + "&contactId=" + strContactId );
}














function delExpertVille(UrlSite,  strExpertId, strVilleId)
{

	if (confirm('Voulez-vous désaffecter cette ville?'))
	{
		var xhr_object = null;
		if(window.XMLHttpRequest) // Firefox
		      xhr_object = new XMLHttpRequest();
		else if(window.ActiveXObject) // Internet Explorer
		      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		else { // XMLHttpRequest non supporté par le navigateur
		      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		      return;
		}

		xhr_object.open("POST", UrlSite  + "inc/__delExpertZone.asp"  , true);

		xhr_object.onreadystatechange = function() {
		      if(xhr_object.readyState == 4)
		      {
				document.getElementById('listeExpertZoneDeTravail').innerHTML=xhr_object.responseText;	
		      }




		   }
		xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xhr_object.send("expertId=" + strExpertId  + "&codeVille=" + strVilleId );
	}
}


function getBienType(UrlSite, strCboBienId,  strCboBienTypeId, strFctExecute)
{
	
	
	
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}

	xhr_object.open("POST", UrlSite  + "inc/_getBienType.asp"  , true);

	xhr_object.onreadystatechange = function() {
	      if(xhr_object.readyState == 4)
	      {
	      
	      		document.getElementById('divCboBienType').innerHTML=xhr_object.responseText;
	      		
	      		
	      }
	
		 
		 
		 
	   }
	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send("cboBienId=" + strCboBienId +"&cboBienTypeId=" + strCboBienTypeId  + "&fctExecute="  + strFctExecute );
}








function getExpertDisponibilte(UrlSite, strMissionId,  strDateRdvSouhaitee,strListeService,strTypeBien, strCpBien )
{
	
	
	
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}

	xhr_object.open("POST", UrlSite  + "inc/_getExpertDisponibilte.asp"  , true);

	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4)
	      	{	      
	      		document.getElementById('divListeExpertDisponibilite').innerHTML=xhr_object.responseText;	      	     
	      	}					 
	}	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
	xhr_object.send("missionId=" + strMissionId +"&dateRdvSouhaitee=" + strDateRdvSouhaitee + "&listeService="  + strListeService + "&typeBien=" +   strTypeBien + "&cpBien="  +  strCpBien  );
}





function getMontantMission(UrlSite, strListeService,strTypeBien, strClientId, strModifierTxt)
{	
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}

	xhr_object.open("POST", UrlSite  + "inc/_getMissionMontant.asp"  , true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4)
	      	{	      
	      		
	      		
	      		if (strModifierTxt)
	      			{document.getElementById('txtMontantMission').value=xhr_object.responseText}
	      		else
	      			{document.getElementById('divMtantEstimeMission').innerHTML=xhr_object.responseText;}
	      	}					 
	}	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
	xhr_object.send("listeService="  + strListeService + "&typeBien=" +   strTypeBien + "&clientId=" +   strClientId  );
}


function getInfoContactMission(UrlSite, contactId,divRelaod, optId, optLibelle)
{	
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}

	xhr_object.open("POST", UrlSite  + "inc/_getInfoContact.asp"  , true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4)
	      	{	
	      		document.getElementById(divRelaod).innerHTML=xhr_object.responseText;
			document.getElementById(optId).innerHTML=optLibelle  + xhr_object.responseText;
	      			
	      	}					 
	}	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
	xhr_object.send("contactId="  + contactId);
}




function prospecterAffDateRappel(UrlSite,  strDateRappelSouhaitee,strTeleproId,strProspectId, strTypeTeleproId )
{
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}
	xhr_object.open("POST", UrlSite  + "inc/_getListeRappelPossible.asp"  , true);

	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4)
		{	      
			document.getElementById('divListeRappelPossible').innerHTML=xhr_object.responseText;	      	     
		}					 
	}	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send("dateRappelSouhaitee=" + strDateRappelSouhaitee + "&teleproId="  + strTeleproId + "&prospectId=" +   strProspectId  + "&typeTeleproId=" +  strTypeTeleproId );
}


function envoyerEmailDevis(UrlSite,  devisId, emailClient)
{
	var xhr_object = null;
	if(window.XMLHttpRequest) // Firefox
	      xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	      return;
	}
	xhr_object.open("POST", UrlSite  + "Devis/envoyerMail.asp"  , true);

	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4)
		{	      
			document.getElementById('tdChargementMail').innerHTML="Email envoyée";	      	     
		}					 
	}	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xhr_object.send("devisId=" + devisId + "&email="  + emailClient );
}
