//Fonction ajout au favori

    function addbookmark() {
        if (document.all) {
            window.external.AddFavorite(location.href, document.title);
        } else {
            alert("Cette fonction est uniquement disponible pour Internet Explorer.");
        }
    }

// Fonction pour les popup
/*
	Affichage d'une popup de maniere générale
*/
function affichage_popup(nom_de_la_page, nom_interne_de_la_fenetre) {
	window.open (nom_de_la_page, nom_interne_de_la_fenetre, config='height=500, width=800, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
}

function affichage_popup_faq(nom_de_la_page, nom_interne_de_la_fenetre) {
	window.open (nom_de_la_page, nom_interne_de_la_fenetre, config='height=600, width=980, toolbar=no, menubar=yes, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}

function affichage_popup_parametrable(nom_de_la_page, nom_interne_de_la_fenetre,pheight,pwidth,ptoolbar,pmenubar,pscrollbars,presizable,plocation,pdirectories,pstatus) {
	window.open (nom_de_la_page, nom_interne_de_la_fenetre, config='height='+pheight+', width='+pwidth+', toolbar='+ptoolbar+', menubar='+pmenubar+', scrollbars='+pscrollbars+', resizable='+presizable+', location='+plocation+', directories='+pdirectories+', status='+pstatus);
}
function affichage_vendeur(serveur)
{
   x=(screen.width-560)/2;
   if(screen.height==600)
   {
      roll='yes';
      hauteur=500;
   }
   else
   {
      roll='no';
      hauteur=720;
   }

   window.open("http://"+serveur+"/vendeur.php","Vendeur",'top=0,left='+x+',width=607,height='+hauteur+',toolbar=no,menubar=no,scrollbars='+roll);

}
function affichage_vendeur_conn(serveur)
{
   x=(screen.width-560)/2;
   if(screen.height==600)
   {
      roll='yes';
      hauteur=500;
   }
   else
   {
      roll='no';
      hauteur=720;
   }

   window.open("http://"+serveur+"/vendeur_conn.php","Vendeur",'top=0,left='+x+',width=607,height='+hauteur+',toolbar=no,menubar=no,scrollbars='+roll);

}

function verif_email(email)
{ 
   // vérif validité email par REGEXP
   var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/
   return (reg.exec(email)!=null)
}


function ecrire_cookie(nom, valeur)
{
	date=new Date;
   var argv=ecrire_cookie.arguments;
   var argc=ecrire_cookie.arguments.length;
   //argv[2] en mili second
	if (argc > 2){
		date.setTime(date.getTime() + argv[2]);
		var expires=date;
	}
	else{
		var expires=null;
	}
   var path=(argc > 3) ? argv[3] : null;
   var domain=(argc > 4) ? argv[4] : 'www.hellopro.fr';
   var secure=(argc > 5) ? argv[5] : false;
   document.cookie=nom+"="+escape(valeur)+
      ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
      ((path==null) ? "" : ("; path="+path))+
      ((domain==null) ? "" : ("; domain="+domain))+
      ((secure==false) ? "" : "; secure");
}

function efface_cookie(nom)
{
date=new Date;
date.setFullYear(date.getFullYear()-6);
ecrire_cookie(nom,null,date);
}

function go_url_fiche_societe (societe, id_societe, onglet, id_lien_onglet, id_fiche_prod, last_id, page, tri, langue)
{
	/*
		il faut que la variable societe ait été préalablement traitée par TraitementCaracteresSpeciauxPourUrl (  )  !!
	*/
	
	var url = societe;
	
	if (langue == "")
	{
		langue = "fr";
	}
	
	url += "-" + id_societe + "-" + onglet;
	
	if (((id_lien_onglet != "") && (id_lien_onglet != 0)) || ((id_fiche_prod != "") && ($id_fiche_prod != 0)) || (($last_id != "") && ($last_id != 0)) || (($page!="") && ($page != 1)) || (($tri != "") && ($tri != 1)))
	{
		url += "-" + id_lien_onglet + "-" + id_fiche_prod + "-" + last_id + "-" + page + "-" + tri;
	}
	
	url = url + "-" + langue + "-societe.html";
	
	//window.open (url);
	document.location.href = url;
}