

/**********************************************************/
/****              CREATION COMPTE                   ******/
/**********************************************************/

function creationCompte(produit)
{
	//if(typeof verifForm == 'function') 
	//{ 
	//	if(!verifForm()) return;
	//}
		
		//alert('coucou');
	
		jQuery('#myform_creationCompte').submit();
	
	//document.myform.action="/Site/MonCompte/receiveCreationCompte.php?PRODUIT="+produit;
	//document.myform.submit();
}

// on va y mettre le contenu html du bouton
var html_myboutonCreationCompte = "";

// pre-submit callback 
function hiddenBoutonCreationCompte()
{ 
	 html_myboutonCreationCompte = document.getElementById('BOUTON_CREATION_COMPTE').innerHTML;
	 document.getElementById('BOUTON_CREATION_COMPTE').innerHTML='<img src="/Site/images/ajax-loader-bouton-gris.gif">';
	 return true; 
} 

function processXmlCreationCompte(responseXML) 
{ 
    // 'responseXML' is the XML document returned by the server; we use 
    // jQuery to extract the content of the message node from the XML doc 
		//gestionErreurXML(responseXML);		
		
		url_retour = gestionErreurXML(responseXML);
		
		if(url_retour=="")	
		{
			document.getElementById('BOUTON_CREATION_COMPTE').innerHTML=html_myboutonCreationCompte;		
		}
		else
			document.location.href=url_retour;
		
}	 

jQuery(document).ready(function() { 
	    var options = { 
	        beforeSubmit:  hiddenBoutonCreationCompte,    // pre-submit callback 
	        success:       processXmlCreationCompte,      //showResponse,  // post-submit callback  
	        url:           '/Site/MonCompte/receiveCreationCompte.php?AJAX=OUI',
	        type:          'post'
	    }; 
	    // bind form using 'ajaxForm' 
	    jQuery('#myform_creationCompte').ajaxForm(options); 	   	    
});

function modificationCompte()
{	
	jQuery('#form_modif_client').submit();
}

/**********************************************************/
/****                  LOAD COMPTE                        */
/**********************************************************/
// on va y mettre le contenu html du bouton
var html_myboutonLoadCompte = "";

// pre-submit callback 
function hiddenBoutonLoadCompte()
{ 	
	html_myboutonLoadCompte = document.getElementById('BOUTON_LOAD_COMPTE').innerHTML;
	document.getElementById('BOUTON_LOAD_COMPTE').innerHTML='<img src="/Site/images/ajax-loader-bouton-gris.gif">';	
	return true; 
} 

function processXmlLoadCompte(responseXML) 
{ 
    // 'responseXML' is the XML document returned by the server; we use 
    // jQuery to extract the content of the message node from the XML doc 
		//gestionErreurXML(responseXML);		
		
		url_retour = gestionErreurXML(responseXML);
		
		if(url_retour=="")	
			document.getElementById('BOUTON_LOAD_COMPTE').innerHTML=html_myboutonLoadCompte;		
		else
			window.location.href=url_retour;
		
}	 

jQuery(document).ready(function() { 
	    var options = { 
	        beforeSubmit:  hiddenBoutonLoadCompte,    // pre-submit callback 
	        success:       processXmlLoadCompte,      //showResponse,  // post-submit callback  
	        url:           '/Site/MonCompte/receiveLoadCompte.php?AJAX=OUI',
	        type:          'post'
	    }; 
	    // bind form using 'ajaxForm' 
	    jQuery('#myform_loadCompte').ajaxForm(options); 	   	    
});

function loadCompte(produit)
{
	//document.myform.action="/Site/MonCompte/receiveLoadCompte.php?PRODUIT="+produit;
	//document.myform.submit();
	
	jQuery('#myform_loadCompte').submit();
	
}

/***********************************************************************************************/

function switch_devis(num_devis)
{
	var id_tr_ligne2     = 'LIGNE2_'+num_devis;	
	var id_bouton_editer = 'BOUTON_EDITER_'+num_devis;
	var tr_ligne2     = document.getElementById(id_tr_ligne2);       
	var bouton_editer = document.getElementById(id_bouton_editer);	
	
	if(tr_ligne2.style.display=="")
	{
		 tr_ligne2.style.display="none";
		 bouton_editer.className="editer";
	}
	else 
	{
		tr_ligne2.style.display="";
		bouton_editer.className="editer_deploye";
	}	
}

function action_sur_contrat(myform,mode,pol_num,univers,code_produit,date_effet)
{
	//alert(pol_num);
	
	myform.POL_NUM.value=pol_num;
	myform.UNIVERS.value=univers;
	myform.MODE.value=mode;
	myform.DATE_EFFET.value=date_effet;
	myform.CODE_PRODUIT.value=code_produit;
	myform.submit();
}


/***********************/
/*                     */
/* OUBLIE MOT DE PASSE */
/*                     */
/***********************/


function oublie_mdp()
{
	jQuery('#form_oublie_mot_de_passe').submit();
}

var html_myboutonOublieMDP = "";

// pre-submit callback 
function hiddenBoutonOublieMDP()
{ 	
	html_myboutonOublieMDP = document.getElementById('MY_BOUTON_OUBLIE_MDP').innerHTML;
	
	//document.getElementById('MY_BOUTON_OUBLIE_MDP').innerHTML='<img src="/Site/images/ajax-loader-bouton-gris.gif">';	
	jQuery('#MY_BOUTON_OUBLIE_MDP').html('<img src="/Site/images/ajax-loader-bouton-gris.gif">');
	return true; 
} 


function processXmlOublieMDP(responseXML) 
{ 
		gestionErreurXML(responseXML);		
		document.getElementById('MY_BOUTON_OUBLIE_MDP').innerHTML=html_myboutonOublieMDP;				
}	 

jQuery(document).ready(function() { 
	    var optionsMDP = { 
	        beforeSubmit:  hiddenBoutonOublieMDP,    // pre-submit callback 
	        success:       processXmlOublieMDP,      //showResponse,  // post-submit callback  
	        url:           '/Site/MonCompte/receiveOublieMDP.php?AJAX=OUI',
	        type:          'post'
	    }; 
	    // bind form using 'ajaxForm' 
	    jQuery('#form_oublie_mot_de_passe').ajaxForm(optionsMDP); 	   	    
});
