
function imprimer_document()
{
	
	window.open('select_print_models.php?popup=true&prod=selection', 'popupPropertiesWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=1000,height=600,screenX=0,screenY=0,top=0,left=0');
}

function CheckAllINBOX2() {

	
   for (var i = 0; i < document.products_lock.elements.length; i++) {
	
	  if(document.products_lock.check_tout.checked == true)
      {document.products_lock.elements[i].checked = false;}
      else
      {document.products_lock.elements[i].checked = true;}
  }


  document.products_lock.check_tout.checked = !(document.products_lock.check_tout.checked);
}

function SetFocus() {
  if (document.forms.length > 0) {
    var field = document.forms[0];
    for (i=0; i<field.length; i++) {
      if ( (field.elements[i].type != "image") &&
           (field.elements[i].type != "hidden") &&
           (field.elements[i].type != "reset") &&
           (field.elements[i].type != "submit") ) {

        document.forms[0].elements[i].focus();

        if ( (field.elements[i].type == "text") ||
             (field.elements[i].type == "password") )
          document.forms[0].elements[i].select();

        break;
      }
    }
  }
}

function rowOverEffect(object) {
  if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
}
function popupWindow(page_name,width,height,left,top,title,toolbar,menubar, scrollbars, resizable, location, directories, status) {
// Mettre left et top à -1 pour centrer la fenetre
popup_scrollbars='yes';

if ((left==-1) || (top==-1))
{
left=(screen.width-width)/2;
top=(screen.height-height)/2;
}
option="height="+height+", width="+width+", left="+left+", top="+top+" ,toolbar="+toolbar+", menubar="+menubar+", scrollbars="+popup_scrollbars+", resizable="+resizable+", location="+location+", directories="+directories+", status="+status;
window.open (page_name, '',option);

}


function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function MM_showHideLayers() { //v3.0 actif, début, fin
  var i,p,v,a,d,f,j,obj,args=MM_showHideLayers.arguments;
	
  for (i=0; i<(args.length-2); i+=4)
  	{
  	ad=args[i];
	af=args[i+1];
	d=args[i+2];
	f=args[i+3];
	for (j=d; j<=f;j++)
	   {
	   if ((j>=ad)&&(j<=af)) v='show'; else v='hide';
	   jt = 'calque_' + j;
	   if ( (window.jt != "undefined") && ((obj=MM_findObj(jt)) !=null))
    	  {
	   	  if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    	  obj.visibility=v;
		  }
	   }
	}
}
function MM_showHideLayers2() { //v3.0 actif, début, fin
  var i,p,v,a,d,f,j,obj,args=MM_showHideLayers2.arguments;
  for (i=0; i<(args.length-2); i+=4)
  	{
  	ad=args[i];
	af=args[i+1];
	d=args[i+2];
	f=args[i+3];
	for (j=d; j<=f;j++)
	   {
	   if ((j>=ad)&&(j<=af)) v='show'; else v='hide';
	   jt = 'calque_' + j;
	   if ( (window.jt != "undefined") && ((obj=MM_findObj(jt)) !=null))
    	  {
		  document.getElementById('a_'+j).style.color= (v=='show')?'red' : (v='hide')?'black':v; 
	   	  if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    	  obj.visibility=v;
		  }
	   }
	}
}
function showhide(id,id2,id3)
	{
	if (document.getElementById(id).style.display=='block')
	document.getElementById(id).style.display='none';
	else
	document.getElementById(id).style.display='block';
	if (document.getElementById(id2).style.display=='block')
	document.getElementById(id2).style.display='none';
	else
	document.getElementById(id2).style.display='block';
	if (document.getElementById(id3).style.display=='block')
	document.getElementById(id3).style.display='none';
	else
	document.getElementById(id3).style.display='block';
	}
function popupPropertiesWindow(url) {
  window.open(url,'popupPropertiesWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600,screenX=112,screenY=112,top=70,left=112')
}

function textLimit(field, maxlen) {
   if (field.value.length > maxlen) {
      field.value = field.value.substring(0, maxlen);
      alert('Votre texte est trop long!');
   }
}

  function lock_customers()
  	  {
      	var cid  = new Array();
		var selection  = new Array();
      for (var l = 1; l < document.customers_lock.elements.length; l++) 
			{
      		if (document.customers_lock.elements[l].value == 'on' )
	  			{
				cid.push(document.customers_lock.elements[l-1].value);
				selection.push(document.customers_lock.elements[l].checked);
				//data += "$"+document.customers_lock.elements[l].name+"='"+document.customers_lock.elements[l].checked+"';";
				}
			}
      agent.call('','lock_customers','lock_customers_return', cid,selection);
	  }
	  
	function lock_customers_bdv()
  	  {
       var cid  = new Array();
		var selection  = new Array();
      for (var l = 1; l < document.customers_lock.elements.length; l++) 
			{
      		if (document.customers_lock.elements[l].value == 'on')
	  			{				
				cid.push(document.customers_lock.elements[l-1].value);
				selection.push(document.customers_lock.elements[l].checked);
				}
			}
      
      agent.call('','lock_customers','lock_customers_bdv_return', cid,selection);
	  }
	  
	  
	  
	function lock_customers_bdv_return(str) {
		document.getElementById('selected_customers').innerHTML = str;
		window.open('select_print_visite.php?popup=true','popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=710,height=350,screenX=150,screenY=150,top=150,left=150');
	}

  function lock_customers_id(cid)
  	  {
      agent.call('','lock_customers_id','lock_customers_return', cid);
	  }
	  
	function opener_lock_customers_id(cid)
  	  {
      agent.call('','lock_customers_id','opener_lock_customers_return', cid);
	  }
	  
	  function opener_lock_customers_return(str) {
		window.opener.document.getElementById('selected_customers').innerHTML = str;
		}


  function change_customers()
  	  {
  	  var cid = document.login_customers.login_customers_id.value;
      agent.call('','change_customers','lock_customers_return', cid);
	  }
	  
	function vide_customers()
  	  {
  	  agent.call('','change_customers','opener_lock_customers_return', '-1');
	  }
	  

  function unlock_customers_id(cid)
  	  {
      agent.call('','unlock_customers_id','lock_customers_return', cid);
	  }

  function lock_customers_return(str) {
	document.getElementById('selected_customers').innerHTML = str;
	}	



	function lock_products_bdv()
  	  {
            	var pid  = new Array();
		var selection  = new Array();
      for (var l = 1; l < document.products_lock.elements.length; l++) {
      		if (document.products_lock.elements[l].value == 'on')
	  			{
				pid.push(document.products_lock.elements[l-1].value);
				selection.push(document.products_lock.elements[l].checked);
				}
      }
      agent.call('','lock_products','lock_products_bdv_return', pid,selection);
	  }
	  
	  
	  
	function lock_products_bdv_return(str) {
		document.getElementById('selected_products').innerHTML = str;
		window.open('select_print_visite.php?popup=true','popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=710,height=350,screenX=150,screenY=150,top=150,left=150');
	}
	
  function lock_products()
  	  {
            	var pid  = new Array();
		var selection  = new Array();
      for (var l = 1; l < document.products_lock.elements.length; l++) {
      		if (document.products_lock.elements[l].value == 'on')
	  			{				
				pid.push(document.products_lock.elements[l-1].value);
				selection.push(document.products_lock.elements[l].checked);
				}
      }
      agent.call('','lock_products','lock_products_return', pid,selection);
	  }
	  

	function lock_products_one(pid)
  	  {
      agent.call('','lock_products_id','lock_products_one_return', pid);
	  }
	  
	 function lock_products_one_return(str) {
		window.opener.document.getElementById('selected_products').innerHTML = str ;
		
	}

	function lock_customers_one(cid)
  	  {
      agent.call('','lock_customers_id','lock_customers_one_return', cid);
	  }
	  
	 function lock_customers_one_return(str) {
		window.opener.document.getElementById('selected_customers').innerHTML = str ;
		
	}	
	  
  function lock_products_id(pid)
  	  {
      agent.call('','lock_products_id','lock_products_return', pid);
	  }

  function change_products()
  	  {
  	  var pid = document.login_products.login_products_id.value;
      agent.call('','change_products','lock_products_return', pid);
	  }

  function unlock_products_id(pid)
  	  {
      agent.call('','unlock_products_id','lock_products_return', pid);
	  }

  function lock_products_return(str) {
    document.getElementById('selected_products').innerHTML = str;
	}	



  function update_cart_product(pid, cid, action)
  	  {
      	agent.call('','add_products_cart','add_products_cart_return', pid, cid, action);
	  }

  function add_products_cart_return(str)
	  {
	    var pid = str.substr(0,12);
		pid = parseInt(pid);
		document.getElementById('show_favoris_' + pid).innerHTML = str.substr(12,str.length-12);
	  }	

  function update_status_web(pid, status)
  	  {
      	agent.call('','update_status_web','update_status_web_return', pid, status);
	  }
	  
  function update_status_intercabinet(pid, status)
  	  {
      	agent.call('','update_status_intercabinet','update_status_intercabinet_return', pid, status);
	  }

  function update_status_web_return(str)
	  {
		var pid = str.substr(0,12);
		pid = parseInt(pid);
		document.getElementById('show_status_web_' + pid).innerHTML = str.substr(12,str.length-12);
	  }	
	  
  function update_status_intercabinet_return(str)
	  {
		var pid = str.substr(0,12);
		pid = parseInt(pid);
		document.getElementById('show_status_intercabinet_' + pid).innerHTML = str.substr(12,str.length-12);
	  }	
	
  function update_next_contact(pid, date)
  	  {
		agent.call('','update_next_contact','update_next_contact_return', pid, date);
	  }

  function update_next_contact_return(str)
  	  {
		alert(str);
	  }

  function update_products_next_contact(pid, date)
  	  {
		agent.call('','update_products_next_contact','update_products_next_contact_return', pid, date);
	  }

  function update_products_next_contact_return(str)
  	  {
		alert(str);
	  }

  function update_next_contact_manufacturers(pid, date)
  	  {
		agent.call('','update_next_contact_manufacturers','update_next_contact_manufacturers_return', pid, date);
	  }

  function update_next_contact_manufacturers_return(str)
  	  {
		alert(str);
	  }

  function update_customers_next_contact(cid, date)
  	  {
		agent.call('','update_customers_next_contact','update_customers_next_contact_return', cid, date);
	  }

  function update_customers_next_contact_return(str)
  	  {
		alert(str);
	  }

//////////////// PARTIE CATEGORIE OFFICE ///////////////////////	
	
  function update_models_advanced_search(cpath, form)
  	  {
      agent.call('','get_models_auto_array','update_models_return_advanced_search', cpath);
	  }

  function update_models_return_advanced_search(str)
	  {
		document.getElementById('show_model_advanced_search').innerHTML = str;
	  }	

  function update_models_goto(cpath, form)
  	  {
      agent.call('','get_models_auto_array','update_models_return_goto', cpath, 'false');
	  }

  function update_models_return_goto(str)
	  {
		document.getElementById('show_model_goto').innerHTML = str;
	  }	
	  
	  
///////////////// PARTIE MOTEUR DE RECHERCHE CUSTOMERS OFFICE ////////////////	
	
	
  function update_models_search_form(cpath,form)
  	  {
      agent.call('','get_models_auto_array','update_models_return_search_form', cpath);
	  }

  function update_models_return_search_form(str)
	  {
		document.getElementById('show_model_search_form').innerHTML = str;
	  }	
	  
	  
///////////////// PARTIE CALENDRIER DES DISPONIBILITES ////////////////	

/*******************************************************************************
Fonction appelant la fonction php pour la creation du calendrier
des disponibilites pour un mois de d'une annee pour un produit donnee
********************************************************************************/
function calendrier_disponibilite(annee, mois)
{
    if (document.period_search.list_biens.value !=0)
		{
		if (document.period_search.oID.value ==0)
		{
			debut_location();
			duree_location();
			fin_location();
		}
		
		document.getElementById('calendrier_disponibilite').innerHTML = 'Chargement en cours...';
		}else{
	
    	debut_location_return("");
    	duree_location_return("");
    	fin_location_return("");
		verif_dispo_return("");	
		}
	
agent.call('','calendrier_disponibilite','update_calendrier_disponibilite', annee, mois, document.period_search.list_biens.value,document.period_search.oID.value);
}
/*******************************************************************************
Fonction appelant la fonction php pour la creation du calendrier
des disponibilites pour un mois de d'une annee pour un produit donnee
********************************************************************************/
  	function calendrier_disponibilite_autre()
  	{
  		liste_annee=document.period_search.liste_annee.value;
		liste_mois=document.period_search.liste_mois.value;
		list_biens=document.period_search.list_biens.value;
		document.getElementById('calendrier_disponibilite').innerHTML = 'Chargement en cours...';
		agent.call('','calendrier_disponibilite','update_calendrier_disponibilite', liste_annee,liste_mois , list_biens);
		verif_dispo();
	}
/*******************************************************************************
Fonction retour de la fonction php pour la creation du calendrier
des disponibilites pour un mois de d'une annee pour un produit donnee
********************************************************************************/
function update_calendrier_disponibilite(str)
	{
		if (document.period_search.list_biens.value !=0)
		{	document.getElementById('calendrier_disponibilite').innerHTML = str;
			verif_dispo_duree();
		
		}
		else
		document.getElementById('calendrier_disponibilite').innerHTML = "";
	}
	
	function update_liste_period_location()
	{
		agent.call('','AfterUpdate_liste_period_location','AfterUpdate_liste_period_location_return', document.new_product.choix_period_location.value);
		
	}
		
	function AfterUpdate_liste_period_location_return(str)
	{
		if(document.new_product.choix_period_location.value == '0')
		{
			document.getElementById('tableau_tarif').innerHTML = "";
			affiche_nv_period_return("");
			affiche_liste_forfait_return("");
			affiche_prix_ht_return("");
			affiche_periodicite_return("");
			affiche_nv_forfait_return("");
			affiche_km_forfait_return("");
			
			
		}else{
			affiche_nv_period_return("");
			agent.call('','affiche_liste_forfait','affiche_liste_forfait_return');
			agent.call('','affiche_prix_ht','affiche_prix_ht_return');
			agent.call('','affiche_periodicite','affiche_periodicite_return');
			agent.call('','affiche_nv_forfait','affiche_nv_forfait_return');
			agent.call('','affiche_km_forfait','affiche_km_forfait_return');
			document.getElementById('tableau_tarif').innerHTML = str;
		}
	}	
	
	
	
	function modifier_tarif(ppid)
	{
		agent.call('','modifier_tarif','modifier_tarif_return', ppid);
		
	}
	
	
	function modifier_tarif_return(str)
	{
		affiche_nv_period_return("");
		affiche_liste_forfait_return("");
		affiche_prix_ht_return(str);
		affiche_periodicite_return("");
		affiche_nv_forfait_return("");
		affiche_km_forfait_return("");
	}
	
	
	function valid_modifier_tarif(ppid)
	{
		agent.call('','valid_modifier_tarif','valid_modifier_tarif_return', ppid, document.new_product.prix_tarif.value, document.new_product.deb_lundi.checked, document.new_product.deb_mardi.checked, document.new_product.deb_mercredi.checked, document.new_product.deb_jeudi.checked, document.new_product.deb_vendredi.checked, document.new_product.deb_samedi.checked, document.new_product.deb_dimanche.checked, document.new_product.fin_lundi.checked, document.new_product.fin_mardi.checked, document.new_product.fin_mercredi.checked, document.new_product.fin_jeudi.checked, document.new_product.fin_vendredi.checked, document.new_product.fin_samedi.checked, document.new_product.fin_dimanche.checked);
		
	}
	
	function valid_modifier_tarif_return(str)
	{
		var pid = parseInt(str);
		
		agent.call('','AfterUpdate_liste_period_location','AfterUpdate_liste_period_location_return', pid);
	}
	
	
	function ajouter_period(pid)
	{
		agent.call('','ajouter_period_location','ajouter_period_return', document.new_product.date_debut_nv_period.value, document.new_product.date_fin_nv_period.value,pid, document.new_product.ajout_nb_qte_min.value, document.new_product.ajout_period_qte_min.value, document.new_product.ajout_nb_qte_max.value, document.new_product.ajout_period_qte_max.value);
		
	}
	
	function ajouter_period_return(str)
	{
		document.getElementById('liste_periode_location').innerHTML = str;
		AfterUpdate_liste_period_location_return("");
	}
	
	
	function ajouter_period_permanente(pid)
	{
		agent.call('','ajouter_period_permanente','ajouter_period_permanente_return', pid);
		
	}
	
	function ajouter_period_permanente_return(str)
	{
		document.getElementById('liste_periode_location').innerHTML = str;
		AfterUpdate_liste_period_location_return("");
	}
	
	
	
	
	function modifier_period(period)
	{
		agent.call('','modifier_period_location','modifier_period_return', period, document.new_product.date_debut_modif_period.value, document.new_product.date_fin_modif_period.value, document.new_product.modif_nb_qte_min.value, document.new_product.modif_period_qte_min.value, document.new_product.modif_nb_qte_max.value, document.new_product.modif_period_qte_max.value);
		
	}
	
	function modifier_period_return(str)
	{
		
		document.getElementById('liste_periode_location').innerHTML = str;
		AfterUpdate_liste_period_location_return("");
	}
	
	function recuperer_period(pid)
	{
		agent.call('','recuperer_period','recuperer_period_return', document.new_product.list_bien_recup.value,pid);
		
	}
	
	
	function recuperer_period_return(str)
	{
		document.getElementById('liste_periode_location').innerHTML = str;
		AfterUpdate_liste_period_location_return("");
	}
	
	
	function recuperer_period_n(pid)
	{
		agent.call('','recuperer_period_n','recuperer_period_n_return', pid);
		
	}
	
	
	function recuperer_period_n_return(str)
	{
		document.getElementById('liste_periode_location').innerHTML = str;
		AfterUpdate_liste_period_location_return("");
	}
	
	
	function suppression_period(pid)
	{
		if(document.new_product.choix_period_location.value!=0)
		{	
			
			if (confirm("Voulez vous définitivement supprimer cette période ?")) 
			{
				agent.call('','suppression_period_location','suppression_period_return', document.new_product.choix_period_location.value, pid);
				document.getElementById('tableau_tarif').innerHTML = "";
				affiche_nv_period_return("");
				affiche_liste_forfait_return("");
				affiche_prix_ht_return("");
				affiche_periodicite_return("");
				affiche_nv_forfait_return("");
			}
		}
	}
	
	
	function suppression_period_return(str)
	{
		document.getElementById('liste_periode_location').innerHTML = str;
	
	}

	function supprimer_tarif(products_planning_prices_id)
	{
		agent.call('','supprimer_tarif_location','supprimer_tarif_return', products_planning_prices_id,document.new_product.choix_period_location.value);
	}
	
	
	function suppression_period_return(str)
	{
		document.getElementById('liste_periode_location').innerHTML = str;
	}
	
	function affiche_liste_forfait_return(str)
	{
		document.getElementById('liste_forfait').innerHTML = str;
	}
	
	
	
	function affiche_prix_ht_return(str)
	{
		document.getElementById('prix_ht').innerHTML = str;
	}
	
	function affiche_periodicite_return(str)
	{
		document.getElementById('periodicite').innerHTML = str;
	}
	
	function affiche_nv_forfait_return(str)
	{
		document.getElementById('nv_forfait').innerHTML = str;
	}
	
	function affiche_km_forfait_return(str)
	{
		document.getElementById('km_forfait').innerHTML = str;
	}
	
	function ajouter_forfait()
	{
			/*alert("lundi "+document.new_product.deb_lundi.checked);
			alert("mardi "+document.new_product.deb_mardi.checked);
			alert("mercredi "+document.new_product.deb_mercredi.checked);
			alert("jeudi "+document.new_product.deb_jeudi.checked);
			alert("vendredi "+document.new_product.deb_vendredi.checked);
			alert("samedi "+document.new_product.deb_samedi.checked);
			alert("dimanche "+document.new_product.deb_dimanche.checked);
			alert("lundi "+document.new_product.fin_lundi.checked);
			alert("mardi "+document.new_product.fin_mardi.checked);
			alert("mercredi "+document.new_product.fin_mercredi.checked);
			alert("jeudi "+document.new_product.fin_jeudi.checked);
			alert("vendredi "+document.new_product.fin_vendredi.checked);
			alert("samedi "+document.new_product.fin_samedi.checked);
			alert("dimanche "+document.new_product.fin_dimanche.checked);
			*/
			
			
			
			if(document.new_product.prix_tarif.value=="")
				alert("Veuillez saisir un prix.");
			else
				agent.call('','ajouter_forfait_location','ajouter_forfait_location_return', document.new_product.choix_period_location.value,document.new_product.choix_list_forfait.value, document.new_product.prix_tarif.value, document.new_product.deb_lundi.checked, document.new_product.deb_mardi.checked, document.new_product.deb_mercredi.checked, document.new_product.deb_jeudi.checked, document.new_product.deb_vendredi.checked, document.new_product.deb_samedi.checked, document.new_product.deb_dimanche.checked, document.new_product.fin_lundi.checked, document.new_product.fin_mardi.checked, document.new_product.fin_mercredi.checked, document.new_product.fin_jeudi.checked, document.new_product.fin_vendredi.checked, document.new_product.fin_samedi.checked, document.new_product.fin_dimanche.checked);
		
	}
	
	
	function ajouter_forfait_location_return(str)
	{
		document.new_product.prix_tarif.value="";
		update_liste_period_location();
	}
	
	
	function supprimer_tarif(products_planning_prices_id)
	{
		agent.call('','supprimer_tarif_location','supprimer_tarif_location_return', products_planning_prices_id);
	}
	
	function supprimer_tarif_location_return(str)
	{
		update_liste_period_location();
	}
	
	
	function supprimer_forfait()
	{
		agent.call('','supprimer_forfait_location','supprimer_forfait_location_return', document.new_product.choix_list_forfait.value);
	}
	
	function supprimer_forfait_location_return(str)
	{
		update_liste_period_location();
	}
	
	
	function affiche_nv_period(pid)
	{
		agent.call('','affiche_nv_period','affiche_nv_period_return', pid);
	}
	
	function affiche_nv_period_return(str)
	{
		document.getElementById('nv_period').innerHTML = str;
	}
	
	function affiche_modifier_period()
	{
		if( document.new_product.choix_period_location.value==0)
			alert("Veuillez sélectionner une période.");
		else
			agent.call('','affiche_modifier_period','affiche_modifier_period_return', document.new_product.choix_period_location.value);
	}
	
	function affiche_modifier_period_return(str)
	{
		document.getElementById('nv_period').innerHTML = str;
	}
	
	
	
	function repetitiveOui()
	{
		agent.call('','repetitive_periodicite','repetitive_periodicite_return');
		
	}
	
	function repetitive_periodicite_return(str)
	{
		document.getElementById('repetitive_periodicite').innerHTML = str;
		agent.call('','repetitive_dateend','repetitive_dateend_return');
	}
	
	function repetitive_dateend_return(str)
	{
		document.getElementById('repetitive_dateend').innerHTML = str;
	}
	
	function repetitiveNon()
	{
		document.getElementById('repetitive_periodicite').innerHTML = "";
		document.getElementById('repetitive_dateend').innerHTML = "";
		
	}
	
	function debut_location()
	{
		agent.call('','debut_location','debut_location_return');
	}
	
	function debut_location_return(str)
	{
		document.getElementById('debut_location').innerHTML = str;
		
	}
	
	function duree_location()
	{
		//agent.call('','duree_location','duree_location_return');
	}
	
	function duree_location_return(str)
	{
		//document.getElementById('duree_location').innerHTML = str;
		
	}
	
	function fin_location()
	{
		agent.call('','fin_location','fin_location_return');
	}
	
	function fin_location_return(str)
	{
		document.getElementById('fin_location').innerHTML = str;
		
	}
	
	
	function verif_dispo()
	{
		
		agent.call('','verif_dispo','verif_dispo_return',document.period_search.news_date_debut_location.value, document.period_search.news_date_fin_location.value, document.period_search.h_debut.value, document.period_search.h_fin.value, document.period_search.list_biens.value);
		
	}
	
	function verif_dispo_return(str)
	{
		if (str==0)
		{
			document.getElementById('reserver_location').innerHTML = "";
			autre_dispo();
		}
		else
		{
			autre_dispo_return("");
			document.getElementById('reserver_location').innerHTML = str;
		}
		
	}
	
	function verif_dispo_duree(exclude_location)
	{
		var type_resa='';
		if(exclude_location == undefined)
		{
			exclude_location=0;
		}
		
		
		//alert(document.period_search.list_type_resa.value);
		
		if(document.getElementsByName("list_type_resa")[0].value==1)
			type_resa='1';
		else
			type_resa='3';
		
		//agent.call('','verif_dispo_duree','verif_dispo_return',document.period_search.news_date_debut_location.value, document.period_search.news_date_fin_location.value, document.period_search.h_debut.value, document.period_search.h_fin.value, document.period_search.list_biens.value,exclude_location,type_resa);
		
		agent.call('','verif_dispo_duree','verif_dispo_return',document.getElementsByName("news_date_debut_location")[0].value, document.getElementsByName("news_date_fin_location")[0].value, document.getElementsByName("h_debut")[0].value, document.getElementsByName("h_fin")[0].value, document.getElementsByName("list_biens")[0].value, exclude_location,type_resa);
		
	}
	
	
	function autre_dispo()
	{
		agent.call('','autre_dispo','autre_dispo_return',document.period_search.news_date_debut_location.value, document.period_search.news_date_fin_location.value, document.period_search.h_debut.value, document.period_search.h_fin.value,document.period_search.list_magasins.value);
		
	}
	
	function autre_dispo_return(str)
	{
		document.getElementById('tableau_autre_dispo').innerHTML = str;
		
	}
	
	
	function update_magasin()
	{
		agent.call('','update_magasin','update_magasin_return',document.period_search.list_magasins.value);
		debut_location_return("");
    	duree_location_return("");
    	fin_location_return("");
		verif_dispo_return("");	
		
		
	}
	
	function update_magasin_return(str)
	{
		document.getElementById('biens_location').innerHTML = str;
		
	}
	
	function update_magasin1()
	{
		agent.call('','update_magasin','update_magasin_return1',document.period.list_manufacturers.value);
		
	}
	
	function update_magasin_return1(str)
	{
		document.getElementById('biens_location').innerHTML = str;
		
	}
	
	function update_magasin2()
	{
		agent.call('','update_magasin','update_magasin_return1',document.search.list_manufacturers.value);
		
	}
	
	function update_magasin_return2(str)
	{
		document.getElementById('biens_location').innerHTML = str;
		
	}
	
	/******suivi des charges de location******/
	
	
	function prix_charge(products_cost_type_id, id)
	{
		
		if ((document.getElementsByName("charge_reccurente"+id)[0].checked == true)&&(document.getElementsByName("prix_charges"+id)[0].value ==""))
		agent.call('','prix_charge','prix_charge_return', products_cost_type_id,  document.ajout_charge.ajout_charge_products_id.value, id);
		
	}
	
	function prix_charge_return(str1)
	{
		var pos = str1.indexOf('a', 0);
		var str = str1.substr(pos,str1.length-pos);
	
		var pid = str.substr(1,12);
		pid = parseInt(pid);
		
		var prix = str.substr(12,24);
		prix=parseFloat(prix); 
		prix=prix.toFixed(2); 
		
	
		document.getElementsByName("prix_charges"+pid)[0].value=prix;
	}
	
	
	function valide_charge_return(str)
	{
		document.getElementById('valide_charge').innerHTML = str;
	}
	
	function recherche_km(segment)
	{	if(document.ajout_charge.ajout_charge_products_id.value==0)
		{
			type_charge_return("");
			recherche_km_return("");
			valide_charge_return("");
			
		}else{
			
			if(segment="auto")
			agent.call('','recherche_km','recherche_km_return',document.ajout_charge.ajout_charge_products_id.value);
			
			agent.call('','type_charge','type_charge_return');
			agent.call('','valide_charge','valide_charge_return');
			valide_charge_return("");
			
		}
	
	}
	
	function type_charge_return(str)
		{
		document.getElementById('type_charge').innerHTML = str;
		}
	
	function recherche_km_return(str)
		{
		document.getElementById('km_charge').innerHTML = str;
		}
	
	function check_answers_global_search(check)
		{
		if ( (document.global_search.content_search.value.length > 4) || (check== '1') )
			{
			document.getElementById('results_global_search').innerHTML = "<div class=main>Recherche en cours</div>";
			check_answers_global_encours = 1;
			agent.call('','check_answers_global_search','check_answers_global_search_return',
						  document.global_search.type_content.value,
						  document.global_search.content_search.value,
						  document.global_search.type_base.value);
			}
		else 
			document.getElementById('results_global_search').innerHTML = "";
		}
	
	function check_answers_global_search_return(str)
		{
		check_answers_global_encours = 0;
		//alert(str);
		document.getElementById('results_global_search').innerHTML = str;
		}
	  

	function add_criteres_search()
		{
		agent.call('','add_criteres_search','add_criteres_search_return', 
						document.add_criteres.add_criteres_id.value,
						document.add_criteres.id.value,
						document.add_criteres.type.value,
						document.add_criteres.priority.value,
						document.add_criteres.search_id.value 
					);
		
		document.add_criteres.add_criteres_id.value = "";
		}
	
	function add_criteres_search_return(str)
		{
		document.getElementById('search_criteres').innerHTML += str;
		}



	
/*PARTIE IMPRESSION FLYDOC*/

function start_generation(login)
{
	agent.call('','generate_doc','generate_doc_return', login);
	
	
	
	
}

function generate_doc_return(str)
{
	
	var login = str.substr(0,12);
		login = parseInt(login);
	
	var pid = str.substr(12,24);
		pid = parseInt(pid);
		
	
	
	
	
	
	if(pid!=0)
	{
		
		if(document.getElementById('file_'+pid)!=null)
		document.getElementById('file_'+pid).innerHTML = str.substr(24,str.length-24);
		
		agent.call('','generate_button_modifier','generate_button_modifier_return', pid);
		agent.call('','generate_button_imprimer','generate_button_imprimer_return', pid);
		agent.call('','generate_media_send','generate_media_send_return', pid);
		agent.call('','generate_doc','generate_doc_return', login, pid);
		creation_pdf_ac3(pid);
	}else{
		agent.call('','generate_buttons_doc','generate_buttons_doc_return',login);
		
	}
	 
	 
	
}

function fusion_pdf(login)
{
	agent.call('','fusion_pdf','fusion_pdf_return',login); // Fusion PDF ET RTF
}

function fusion_pdf_return(str)
{
	tab=str.split(';')
	
	for(i=0;i<tab.length-1;i++)
	{
		window.open(tab[i],'popup'+i,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600,screenX=112,screenY=112,top=70,left=112')
	}
}


function generate_buttons_doc_return(str)
{
	document.getElementById('bt_imp_exp').innerHTML = str;
}
	
function generate_button_modifier_return(str)
{
	
	var pid = str.substr(0,12);
		pid = parseInt(pid);
	
	document.getElementById('modif_'+pid).innerHTML = str.substr(12,str.length-12);
}

function generate_button_imprimer_return(str)
{
	
	var pid = str.substr(0,12);
		pid = parseInt(pid);
	
	document.getElementById('apercu_'+pid).innerHTML = str.substr(12,str.length-12);
}	


function generate_media_send_return(str)
{
	var pid=str.substr(0,12);
	pid = parseInt(pid);
	
	document.getElementById('send_'+pid).innerHTML = str.substr(12,str.length-12);
}


function update_mode_envoi(printdoc_id,value)
{
		
	agent.call('','update_mode_envoi','update_mode_envoi_return', printdoc_id, value);
	
}

function update_mode_envoi_return(str)
{
		
	
}


function generate_pdf_ac3(printdoc_id)
{
	agent.call('','generate_pdf_ac3','generate_pdf_ac3_return', printdoc_id);
}


function generate_pdf_ac3_return(str)
{
	window.open(str);
}

function creation_pdf_ac3(printdoc_id)
{
	agent.call('','generate_pdf_ac3','creation_pdf_ac3_return', printdoc_id);
}


function creation_pdf_ac3_return(str)
{
	//window.open(str);
}


function start_envoi(login)
{
	agent.call('','envoi_doc','envoi_doc_return', login);
}

function envoi_doc_return(str1)
{
	
	var pos = str1.indexOf('a', 0);
	
	var str = str1.substr(pos,str1.length-pos);
	
	
	var login = str.substr(1,12);
	
		login = parseInt(login);
	
	var pid = str.substr(12,24);
		pid = parseInt(pid);
	
	
	if(pid!=0)
	{
		document.getElementById('file_'+pid).innerHTML = str.substr(24,str.length-24);
		agent.call('','envoi_doc','envoi_doc_return', login);
	}
	 
	 
	
}


function start_maj_log(nego, agence, day, month, year, media, site)
{

	agent.call('','update_status_waiting','update_status_waiting_return', nego, agence, day, month, year, media, site);
	agent.call('','start_maj_log','start_maj_log_return', nego, agence, day, month, year, media, site);
	agent.call('','start_maj_nbpage','start_maj_nbpage_return', nego, agence, day, month, year, media, site);
	
	
}

function update_status_waiting_return(str)
{
}


function start_maj_log_return(str1)
{
	var pos = str1.indexOf('a', 0);
	var str = str1.substr(pos,str1.length-pos);
	
	var nego = str.substr(1,12);
		nego = parseInt(nego);
	
	var agence = str.substr(12,24);
		agence = parseInt(agence);
	
	var day = str.substr(24,36);
		day = parseInt(day);
	
	var month = str.substr(36,48);
		month = parseInt(month);
	
	var year = str.substr(48,60);
		year = parseInt(year);
	
	var media = str.substr(60,72);
		media = parseInt(media);
		
	var status = str.substr(72,84);
		//status = parseInt(status);
	
	var transaction = str.substr(84,96);
		transaction = parseInt(transaction);
	
	var site = str.substr(96,108);
		site = parseInt(site);
	
	var sup = str.substr(108,str.length);
		
	
	if(transaction!=0)
	{
		document.getElementById('etat_'+transaction).innerHTML = status.substr(0,12);
		document.getElementById('sup_'+transaction).innerHTML = sup;
		
		agent.call('','start_maj_log','start_maj_log_return', nego, agence, day, month, year, media, site);
		
	}
	
}




function start_maj_nbpage_return(str1)
{
	var pos = str1.indexOf('a', 0);
	var str = str1.substr(pos,str1.length-pos);
	
	var nego = str.substr(1,12);
		nego = parseInt(nego);
	
	var agence = str.substr(12,24);
		agence = parseInt(agence);
	
	var day = str.substr(24,36);
		day = parseInt(day);
	
	var month = str.substr(36,48);
		month = parseInt(month);
	
	var year = str.substr(48,60);
		year = parseInt(year);
	
	var media = str.substr(60,72);
		media = parseInt(media);
		
	var nbpage = str.substr(72,84);
		nbpage = parseInt(nbpage);
	
	var transaction = str.substr(84,96);
		transaction = parseInt(transaction);
	
	var site = str.substr(96,108);
		site = parseInt(site);
	
	
	if(transaction!=0)
	{
		document.getElementById('nbpage_'+transaction).innerHTML = nbpage;
		agent.call('','start_maj_nbpage','start_maj_nbpage_return', nego, agence, day, month, year, media, site);
		
	}
	
}


function cancel_transaction(transaction_id)
{
	agent.call('','cancel_transaction','cancel_transaction_return', transaction_id);
}

function cancel_transaction_return(str1)
{
	var pos = str1.indexOf('a', 0);
	var str = str1.substr(pos,str1.length-pos);
	
	var transaction = str.substr(1,12);
		transaction = parseInt(transaction);
	
	document.getElementById('etat_'+transaction).innerHTML = "Annuler";
	document.getElementById('sup_'+transaction).innerHTML = "";
	
}

function update_compte_rglt(rglt_id)
{
	//document.getElementById(rglt_id).innerHTML = document.getElementById('list_cpt' + rglt_id).value;
	i=  parseInt(document.getElementById('cr_'+rglt_id).value);
	
	//alert(i);
	//document.getElementById(rglt_id).innerHTML=document.getElementById('cr_'+rglt_id).value;
	agent.call('','update_compte_rglt','update_compte_rglt_return', i , rglt_id);
}

function update_compte_rglt_return(str)
{
	alert(str);
}


function update_date_mo_end(orders_id)
{
	//var name = 'mo_'+orders_id;
	
	//alert(document.getElementById('mo_'+orders_id).value);
	//alert(orders_id);
	if(document.getElementById('mo_'+orders_id).value!="")
	agent.call('','update_date_mo_end','update_date_mo_end_return', document.getElementById('mo_end_'+orders_id).value, orders_id);
}

function update_date_mo_end_return(str)
{
	
	//alert(str);
}

function update_date_mo(orders_id)
{
	//var name = 'mo_'+orders_id;
	
	//alert(document.getElementById('mo_'+orders_id).value);
	//alert(orders_id);
	if(document.getElementById('mo_'+orders_id).value!="")
	agent.call('','update_date_mo','update_date_mo_return', document.getElementById('mo_'+orders_id).value, orders_id);
}

function update_date_mo_return(str)
{
	
	//alert(str);
}

function update_period_active(period, val)
{
	agent.call('','update_period_active','update_period_active_return', period, val);
}

function update_period_active_return(str)
{
	var period = str.substr(0,11);
	//alert(str);
	period = parseInt(period);
	//alert(orders_id);
	document.getElementById('activation_period_'+period).innerHTML = str.substr(12,str.length-12);
	
}

function update_action_active(ac3_orders_realisation_id, val)
{
	agent.call('','update_action_active','update_action_active_return', ac3_orders_realisation_id, val);
}

function update_action_active_return(str)
{
	var ac3_orders_realisation_id = str.substr(0,11);
	//alert(str);
	ac3_orders_realisation_id = parseInt(ac3_orders_realisation_id);
	//alert(orders_id);
	document.getElementById('action_active_'+ac3_orders_realisation_id).innerHTML = str.substr(12,str.length-12);
	
}

function update_date_demarrage(orders_id)
{
	if(document.getElementById('demarrage_'+orders_id).value!="")
	//alert(document.getElementById('demarrage_'+orders_id).value);
	agent.call('','update_date_demarrage','update_date_demarrage_return', document.getElementById('demarrage_'+orders_id).value, orders_id);
}

function update_date_demarrage_return(str)
{
	
	//alert(str);
}


function update_proba_vente(orders_id)
{
	
	
	agent.call('','update_proba_vente','update_proba_vente_return', document.getElementById('proba_vente_'+orders_id).value, orders_id);
}

function update_proba_vente_return(str)
{
	
	alert(str);
}

function update_proba_realisation(orders_id)
{
	
	agent.call('','update_proba_realisation','update_proba_realisation_return', document.getElementById('proba_realisation_'+orders_id).value, orders_id);
}

function update_proba_realisation_return(str)
{
	
	// alert(str);
}


function mep_files(path, file, action, mep_id, $rows)
  	  {
      	agent.call('','mep_files','mep_files_return', path, file, action, mep_id, $rows);
	  }

  function mep_files_return(str)
	  {
	  var pid = str.substr(0,11);
	  pid = parseInt(pid);
	  document.getElementById('mep_' + pid).innerHTML = str.substr(12,str.length-12);
	  document.getElementById('mep_action_' + pid).innerHTML = str.substr(11,1);
	  }	

  function mep_files_servers(str)
  	  { 
	  if (str.substr(0,3) != 'RET') alert(str);
	  else
		{
		  var mep_id = str.substr(3,12);
		  var old_files_id = str.substr(15,12);
		  var files_id = str.substr(27,12);
		  var sid = str.substr(39,12);
		  var following = str.substr(51,1);
		  var txt = str.substr(52,str.length-52);
		  mep_id = parseInt(mep_id);
		  sid = parseInt(sid);
		  old_files_id = parseInt(old_files_id);
		  files_id = parseInt(files_id);
		  if (txt != '') document.getElementById('mfs_' + old_files_id + '_' + sid).innerHTML = txt;
	      if (following > 0) agent.call('','mep_files_servers','mep_files_servers', mep_id, sid, files_id, following);
		}
	  }

  function mep_files_servers_remove(str)
  	  {
	  if (str.substr(0,3) != 'RET') alert(str);
	  else
		{
		  var mep_id = str.substr(3,12);
		  var old_files_id = str.substr(15,12);
		  var files_id = str.substr(27,12);
		  var sid = str.substr(39,12);
		  var following = str.substr(51,1);
		  var txt = str.substr(52,str.length-52);
		  mep_id = parseInt(mep_id);
		  sid = parseInt(sid);
		  old_files_id = parseInt(old_files_id);
		  files_id = parseInt(files_id);
		  if (txt != '') document.getElementById('mfs_' + old_files_id + '_' + sid).innerHTML = txt;
	      if (following > 0) agent.call('','mep_files_servers_remove','mep_files_servers_remove', mep_id, sid, files_id, following);
		}
	  }
	  
function insert_actions(actions_type)
{
      	agent.call('','insert_actions','insert_actions_return', document.update.admin.value, document.update.action_date.value, document.update.action_time.value, actions_type );
}

  function insert_actions_return(str)
	  {
		alert("Les actions ont bien été enregistrées ! ")
	  }	

function recherche_compte_comptable(type)
{
		//alert(type);
      	agent.call('','recherche_compte_comptable','recherche_compte_comptable_return', document.form1.compte_recherche.value, type);
}

  function recherche_compte_comptable_return(str)
	  {
		document.getElementById('liste_comptes').innerHTML = str;
	  }	
	  





function lock_vendeurs()
{
      	var pid  = new Array();
		var selection  = new Array();
      for (var l = 1; l < document.products_lock.elements.length; l++) {
      		if (document.products_lock.elements[l].value == 'on')
	  			{
				pid.push(document.products_lock.elements[l-1].value);
				selection.push(document.products_lock.elements[l].checked);
				}
      }
      agent.call('','lock_products','lock_vendeur_etape1', pid,selection);
}

function lock_vendeur_etape1(str)
{
	agent.call('','lock_vendeurs','lock_vendeurs_return');
}

function lock_vendeurs_return(str) {
document.getElementById('selected_customers').innerHTML = str;

//document.products_lock.type_action.value = 'lock_products'; document.products_lock.type_action2.value = 'mail';document.products_lock.submit();
window.open('mail.php?popup=true&cust=selection', 'popupPropertiesWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=1000,height=600,screenX=0,screenY=0,top=0,left=0'); 
	}


	



function lock_vendeurs()
{
      	var pid  = new Array();
		var selection  = new Array();
      for (var l = 1; l < document.products_lock.elements.length; l++) {
      		if (document.products_lock.elements[l].value == 'on')
	  			{
				pid.push(document.products_lock.elements[l-1].value);
				selection.push(document.products_lock.elements[l].checked);
				}
      }
      agent.call('','lock_products','lock_vendeur_etape1', pid,selection);
}


function lock_gpp()
  	  {
      	var pid  = new Array();
		var selection  = new Array();
      for (var l = 1; l < document.products_lock.elements.length; l++) {
      		if (document.products_lock.elements[l].value == 'on')
	  			{
				pid.push(document.products_lock.elements[l-1].value);
				selection.push(document.products_lock.elements[l].checked);
				}
      }
      agent.call('','lock_products','lock_gpp_return',  pid,selection);
	  }
	  
function lock_gpp_return(str)
{
	document.getElementById('selected_products').innerHTML = str;
	window.open('gestion_publicite_papier.php?popup=true','popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600,screenX=0,screenY=0,top=0,left=0');
}


function cherche_site(sites_name)
{
	//alert(sites_name);
	if(sites_name.length>=2)agent.call('','cherche_site','cherche_site_return', sites_name);
}

function cherche_site_return(str)
{
	document.getElementById('login_list_sites').innerHTML = str;
}


function traitement_sql_rapprochement(list_ligne)
{
	agent.call('','traitement_sql_rapprochement','traitement_sql_rapprochement_return',list_ligne);
}

function traitement_sql_rapprochement_return(str)
{
	//alert("+"+str);
	initialisation_rapprochement();
}


function charge_list_orders()
{
	agent.call('','charge_list_orders','charge_list_orders_return');
}

function charge_list_orders_return(str)
{
	document.getElementById('list_orders').innerHTML = str;
}

function charge_list_incidents()
{
	agent.call('','charge_list_incidents','charge_list_incidents_return');
}

function charge_list_incidents_return(str)
{
	document.getElementById('list_incidents').innerHTML = str;
}



function update_homeselection(products_id)
	{
	check = document.getElementById("pid_" + products_id).checked;
	agent.call('','update_homeselection','update_homeselection_return',products_id,check);
	}
function update_homeselection_return(str)
	{
	//alert(str);
	}


function impression_doc(action_id,products_id,customers_id,admin_id,result)
{
	//alert("impression_doc");
	agent.call('','impression_doc','impression_doc_return',action_id,products_id,customers_id,admin_id,result);
}

function impression_doc_return(str)
	{
	//alert(str);
	}

function update_basket_status(customers_basket_id,status_id)
	{
	agent.call('','update_basket_status','update_basket_status_return',customers_basket_id,status_id);
	}
function update_basket_status_return(str)
	{
    var customers_basket_id = str.substr(0,12);
	customers_basket_id = parseInt(customers_basket_id);
	document.getElementById('basket_status_' + customers_basket_id).innerHTML = str.substr(12,str.length-12);
	}

	
function lock_manufacturers()
  	  {
      	var mid  = new Array();
		var selection  = new Array();
	  for (var l = 1; l < document.listing_manufacturers.elements.length; l++) {
      		if (document.listing_manufacturers.elements[l].value == 'on')
	  			{
				mid.push(document.listing_manufacturers.elements[l-1].value);
				selection.push(document.listing_manufacturers.elements[l].checked);
				}
      }
      agent.call('','lock_manufacturers','lock_manufacturers_return', mid,selection);
	  }

function lock_manufacturers_return(str) {
    document.getElementById('selected_manufacturers').innerHTML = str;
	}
	


	
function change_manufacturers()
  	  {
  	  var mid = document.login_manufacturers.login_manufacturers_id.value;
      agent.call('','change_manufacturers','lock_manufacturers_return', mid);
	  }
	  
  function unlock_members_id(mid)
  	  {
      agent.call('','unlock_members_id','lock_members_return', mid);
	  }	  
  function unlock_manufacturers_id(mid)
  	  {
      agent.call('','unlock_manufacturers_id','lock_manufacturers_return', mid);
	  }

function send_password(cid)
	{
	agent.call('','send_password','send_password_return',cid);
	}

function send_password_return(str)
	{
	alert(str);
	}


function lock_members()
  	  {
      	var mid  = new Array();
		var selection  = new Array();
	  for (var l = 1; l < document.listing_members.elements.length; l++) {
      		if (document.listing_members.elements[l].value == 'on')
	  			{
				mid.push(document.listing_members.elements[l-1].value);
				selection.push(document.listing_members.elements[l].checked);
				}
      }
	 //alert(data);
      agent.call('','lock_members','lock_members_return', mid,selection);
	  }

function lock_members_return(str) {
	document.getElementById('selected_members').innerHTML = str;
}	

function change_members()
  	  {
  	  var mid = document.login_members.login_members_id.value;
      agent.call('','change_members','lock_members_return', mid);
	  }
	  
function update_note_financiere(segment, manufacturers_id, val)
{
	agent.call('','update_note_financiere','update_note_financiere_return', segment, manufacturers_id, val);
}

function update_note_financiere_return(str)
	{
	id = str.substr(0,21);
	newstr = id.replace(" ", "", "gi");

	//alert("'"+newstr+"'");
	
	document.getElementById('note_financiere_'+newstr).innerHTML = str.substr(21,str.length-21);
	}

function telephone_call(telephone)
	{
	agent.call('','telephone_call','telephone_call_return', telephone);
	}

function telephone_call_return(str)
	{
	if (str!='') alert(str);
	}

function publication(nom, num)
	{
	agent.call('','publication','publication_return', nom, num);
	}
	
function publication_return(str)
	{
	document.getElementById('publi').innerHTML = str;
	}