

	/***********************************************************************************************************
	 * fonction permettant de transférer le contenu d'un div ou span vers un textbox pour l'éditer
	 */
		function EditObj(TAGID)
		{
			var obj=document.getElementById(TAGID);
			var htmlStr= "<span id=\"" + TAGID + "editableObj\"><input type=\"text\" id=\"" + TAGID + "editableContent\" value=\"" + obj.innerHTML + "\"/>";
			htmlStr += "<script language=\"javascript\">document.getElementById(\"" + TAGID + "editableContent\").focus()</script>"; 
			Element.hide(obj);
			new Insertion.After(obj, htmlStr);	
		}

/***********************************************************************************************************
 * Fonction qui permet de selectionner ou deselectionner un article 
 * dans une liste de resultats 
 */
function SelectItem(isSel, val,titre,auteur,editeur,prixttc, prixht,is_num)
{
	var url = "/_application/_functions/selectItem.aspx?id=" + encodeURI(val + "&check=false&selected=" + isSel + "&uId=" + uID);	
	url = url + encodeURI("&titre=" + titre + "&auteur=" + auteur + "&editeur="  + editeur + "&prixttc=" + prixttc + "&prixht=" + prixht + "&is_num=" + is_num);
    
    if (isSel) 
    {
        var divQte = document.getElementById("qte");
        divQte.value = ReplaceNummlock(divQte.value);
        
        if (CheckElementValueIsInteger(divQte)) {
            url = url + encodeURI("&qte=" + divQte.value);
            closeDynLayer();
        } else {
            alert('Vous devez entrer un nombre entier pour renseigner la quantit\351 !');
            return false;
        }
    }
    
 	var XHR = new httpRequest(url,"","POST");
 	var strJS = "checkItem(" + val + ",1)";
 	XHR.execContent(strJS);
}
/***********************************************************************************************************
 * Fonction qui permet de vérifier si un article est sélectionné dans une liste de resultats 
 * Et réalise l'action voulue en fonction de la selection
 */
function VerifItemChecked(isSel, val,titre,auteur,editeur,prixttc, prixht,is_num)
{
	if(isSel) 
	{ //si le bouton est sélectionné, on affiche la popup pour les quantités
	    checkItem(val,0);
	    ShowQuantityDiv(isSel,val,titre,auteur,editeur,prixttc, prixht,is_num);
	}
	else 
	{
	    SelectItem(isSel,val,titre,auteur,editeur,prixttc, prixht,is_num);
 	}
}

/***********************************************************************************************************
 * Fonction qui permet d'afficher la div de quantités
 */
function ShowQuantityDiv(isSel,val,titre,auteur,editeur,prixttc, prixht,is_num)
{
    var objDynLayer = document.getElementById("QteDynLayer");
	objDynLayer.style.visibility = 'visible';
	objDynLayer.style.display = 'inline';
	objDynLayer.innerHTML="";
	
	if (document.all) 
	{
		//IE
		x = (document.documentElement.clientWidth/2) - (objDynLayer.offsetWidth / 2);
		y = window.event.clientY + document.documentElement.scrollTop - (objDynLayer.offsetHeight / 2);		
	}
	else
	{
		x = xMousePos - (objDynLayer.offsetWidth * 1.1);
		y = yMousePos - (objDynLayer.offsetHeight / 2);
	}
	setOpacity(document.getElementById("container"), 30);
	setOpacity(objDynLayer, 100);
	objDynLayer.style.top = y + "px";
	objDynLayer.style.left =x + "px";
	
	if(objDynLayer != null)
	{
		var myURL = "/_application/_functions/ajaxLoader.aspx?idControl=QTEPROD&id=" + encodeURI(val + "&check=false&selected=" + isSel + "&uId=" + uID);	
		    myURL = myURL + encodeURI("&titre=" + titre + "&auteur=" + auteur + "&editeur="  + editeur + "&prixttc=" + prixttc + "&prixht=" + prixht + "&is_num=" + is_num);
		var myxhr = new httpRequest(myURL,'','POST');
		myxhr.LoadContent('QteDynLayer','Chargement...','getSelect("qte");');

	}		
}

/***********************************************************************************************************
 * Fonction qui permet de cocher/decocher une checkbox en fonction de son ID
 */
function checkItem(id,value)
{
    var checkBox = document.getElementById(id);
    checkBox.checked = value;
}


	/***********************************************************************************************************
	 * Récupère le nombre d'artcile dans une liste de sélection
	 * dans une liste de resultats 
	 */
		function GetNbSelected(CartId)
		{
		
				var url = docRoot + "/_application/_functions/selectItem.aspx?todo=GET_TOTAL_ITEM&id=" + CartId;
				
	
				
				//var url = docRoot + "/_application/_functions/selectItem.aspx?id=" + val + "&check=false&selected=" + isSel + "&uId=" + uID;	
			 	var XHR = new httpRequest(url,"","POST");
			 	XHR.execContent('');
								
		}

	/***********************************************************************************************************
	 * Affichage du nb d'articles sélectionnés ds le controlPanel 
	 */
		function AfficheNbSelectedItem(Qte)
		{
			var objInfo=document.getElementById("dynInfos");
			var txt = "";
			
			if (Qte <= 0) {
				txt += "Aucun article s&eacute;lectionn&eacute;";
			}
			else if (Qte == 1) {
				txt += "<b>" + Qte + "</b> article s&eacute;lectionn&eacute;";
			}
			else {
				txt += "<b>" + Qte + "</b> articles s&eacute;lectionn&eacute;s";
			}
			
			objInfo.innerHTML = txt;
		}



//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fonctions relatives aux cookies   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


	/***********************************************************************************************************
	 * Pose un cookie 
	 */
		function setCookie(nom,valeur,domain)
		{
			var expiration = new Date(2999,1,31);
			document.cookie=nom+"="+escape(valeur)+";expires="+expiration.toGMTString() + ";domain=" + domain + ";path=/" ;
		}


	/***********************************************************************************************************
	 *
	 */
	function GetDomainCookie(name) 
	{
		var dc = document.cookie;
		var prefix = name + "=";
		var begin = dc.indexOf("; " + prefix);
		
		if (begin == -1) {
			begin = dc.indexOf(prefix);
			if (begin != 0) return null;
		} 
		else {
			begin += 2;
		}
		
		var end = document.cookie.indexOf(";", begin);
		
		if (end == -1) {
			end = dc.length;
		}
		
		return unescape(dc.substring(begin + prefix.length, end));
	}


	/***********************************************************************************************************
	 *
	 */
	function GetCookieVal( strCookie, valName )
	{
		if (strCookie != null)
		{
			var cookieArr=strCookie.split("&");
			
			for (i=0; i < cookieArr.length; i++)
			{
				var cookieName = cookieArr[i].split("=");
				
				if (cookieName[0] == valName)
				{
					return cookieName[1];
				}
			}			
		}	
	}
	
	
	/***********************************************************************************************************
	 *
	 */
	function GetCookie(domain, name)
	{
		var str = GetDomainCookie(domain);
		return GetCookieVal(str, name);
	}
	
	
	/***********************************************************************************************************
	 *
	 */
		function cookieExist(Name) 
		{
			var search = Name + "=";
			
	        if (document.cookie.length > 0)  // si il existe au moins un cookie
	        {
				offset = document.cookie.indexOf(search);
				
	            if (offset != -1)  // si le cookie recherché existe
	            {
					return offset;
	            }
	            else  //le cookie n'existe pas
	            {
					return -1;
	            }
			}
		} 

	
	

//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+     Fonctions diverses            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

	
	
	/***********************************************************************************************************
	 * Fonction qui permet de gérer une taille max de caractères dans un text area. 
	 * params : - form est le nom du formulaire 
	 *          - champ est le nom du champ du formulaire 
	 *          - max est le nombre max de caractères 
	 */
		function checkTextArea(champ, max) 
		{
			var txt_size = document.getElementById(champ).value.length;
			
			if ( txt_size > max ) 
			{
				var msg = "Vous avez d\351pass\351 le nombre maximum de " + max + " caract\350res !\n";
				msg += "(Vous en avez tap\351 " + txt_size + " ! )";
				alert(msg);
			}
		}
	
	
	/***********************************************************************************************************
   * Fonction booléénne qui vérifie qu'un nom de fichier a une bonne extension
   * 
   * Paramètres : 
   *  - tabExt() : un tableau contenant les extensions choisies (sans le point '.') en minuscules ! 
   *               ex : tabExt = {"gif"; "jpeg"; "jpg"; "png"}
   *  - filename : le nom du fichier à vérifier
   * 
   * Retour : 
   *  - checkExtension renvoie vrai ssi l'extension de filename est contenue dans tabExt 
   *  - faux sinon
	 */
	function checkExtension(tabExt, filename) 
	{
		if ( filename != "" )
		{
			var T = filename.split(".");
			var i_max = T.length - 1;
			
			if (T.length > 1) // filename contient au moins un point '.' 
			{
				var ext = T[i_max].toLowerCase();
				
				// Recherche de ext dans tabExt() : 
				var i = 0;
				//while ( i < tabExt.length && !(ext.equals(tabExt[i])) ) 
				while ( i < tabExt.length && ext != tabExt[i].toLowerCase() ) 
				{
					i = i + 1;
				}
				
				return (i < tabExt.length);
			}
			else // filename ne contient pas de point '.' 
			{
				return false;
			}
		}
		else {
			return false;
		}
	}
	
	
	/***********************************************************************************************************
	 * Fonction qui ouvre une msgBox de type confirm (bouton Ok et cancel)
	 * params : 
	 *			msg			, type String	, Message qui s'affichera dans la msgBox
	 *			urlValidate	, type String	, Si l'utilisateur click sur oui, on redirige l'utilisateur vers cette url
	 *
	 **/
	function msgConfirme(msg, urlValidate,CartId)
	{
		if (confirm(msg))
		{
			/*
			var moreact="GetNbSelected(" + CartId + ")";
			LoadContent(urlValidate,'main',moreact);
			*/
			var XHR = new httpRequest(urlValidate,'','POST')
			var moreact="GetNbSelected(" + CartId + ")";
			XHR.LoadContent('main','Chargement de vos paniers...',moreact); 
		}
	}
	

	
	/***********************************************************************************************************
	 * Fonction qui ouvre une fenetre popUp avec la taille spécifié
	 * params : 
	 *			url		, type String	, url de la page affiché dans la fenetre pop up
	 *			name	, type String	, nom de la fenetre
	 *			width	, type integer	, largeur de la fenetre pop up
	 *			height	, type integer	, hauteur de la fenetre pop up
	 * 
	 **/
	var WindowObjectReference = null;
	
	function openWindow(strUrl, strWindowName,  width, height)
	{
		if(WindowObjectReference == null || WindowObjectReference.closed)
		{
			WindowObjectReference = window.open(strUrl, strWindowName,
				'height=' + height + ',width=' + width + ',toolbar=no,status=no,directories=no,menubar=yes,location=no,scrollbars=yes,resizable=yes');
		}
		else
		{
			WindowObjectReference.focus();
		}
	}
	
	
	/***********************************************************************************************************
	 * Fonction qui ouvre une fenetre popUp avec exactement la hauteur et la largeur de l'image !
	 * params : 
	 *			url		, type String	, url de la page affiché dans la fenetre pop up
	 *			name	, type String	, nom de la fenetre
	 * 
	 **/
	var WindowImgObjectReference = null;
	
	function openImgWindow(bigImg, strWindowName)
	{		
		if(WindowImgObjectReference == null || WindowImgObjectReference.closed)
		{			
			WindowImgObjectReference = window.open(bigImg.src, strWindowName,
				'height=' + (20 + bigImg.height ) + ',width=' + (bigImg.width + 20) + ',toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=no');
		}
		else
		{
			WindowImgObjectReference.focus();
		}
	}
	
	
	
	/***********************************************************************************************************
	 * Fonction qui supprime tous les espaces dans une chaine de caractères : 
	 **/
		function suppr_espaces(chaine)
		{
			var str = chaine.replace(" ", "");
			
			for (i=0; i < chaine.length; i++) 
			{
				str = str.replace(" ", "");
			}
			
			return str;
		}
	
	
	/***********************************************************************************************************
	 * Fonction qui renvoie True ssi la chaine passée en paramètre a bien le format d'un e-mail valide : 
	 **/
		function check_email(chaine)
		{
			var regexp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9]+)+$/;
			
			return (regexp.test(chaine));
		}
	
	/***********************************************************************************************************
	/** | Add le 02/10/2007 par D.Guillard | **
	 * Fonction qui renvoie True si les login et mot de passe ont bien été saisi, False + un message d'erreur dans le cas contraire : 
	 **/
		function CheckLoginPwd(id_login,id_pwd)
		{
	
			var isValid = true;
			
			if(document.getElementById(id_login).value == '')
			{
				isValid=false;
			}else if(document.getElementById(id_pwd).value == '')
			{
				isValid=false;
			}		
			
			if(isValid==false)
			{
				alert('Vous devez entrer un login et un mot de passe pour pouvoir vous connecter \340 MollatPro.');
			}
			
			return isValid;
		}
	
	/***********************************************************************************************************
	 * Fonction qui renvoie True ssi le numéro passé en paramètre a bien le format d'un EAN valide : 
	 **/
	function check_ean(num)
	{
		var regexp = /^[0-9]{13,13}$/;
		return (regexp.test(num));
	}
	
	
	/***********************************************************************************************************
	 * Fonction qui teste la validité du numéro EAN ou ISBN passé en paramètre. 
	 * Valeurs de retour : 
	 *      1 : EAN valide 
	 *     -1 : EAN invalide 
	 *      2 : ISBN valide 
	 *     -2 : ISBN invalide 
	 *      0 : valeur incorrecte ne contenant pas de chiffres 
	 **/
	function check_isbn_ean(num)
	{
		var correct;
		
		var nb_chiffrres = 10; // nb de chiffres pour un ISBN 
		var nb_tirets = 3;     // nb de tirets pour un ISBN 
		var isbn_length = nb_chiffrres + nb_tirets;
		
		var regexp_isbn = /^[0-9]+(-)[0-9]+(-)[0-9]+(-)[0-9]+$/;
		
		var pas_de_chiffres = /^[^0-9]+$/;
		
		if ( pas_de_chiffres.test(num) ) 
		{
			correct = 0;
		}
		else 
		{
			// Si on teste un EAN (pas de tirets dans le numéro) : 
			if (num.indexOf("-") == -1) 
			{
				if (check_ean(num)) {
					correct = 1;
				}
				else {
					correct = -1;
				}
			}
			// Si on teste un ISBN : 
			else 
			{
				if (num.length == isbn_length) 
				{
					if ( (regexp_isbn.test(num)) ) {
						correct = 2;
					}
					else {
						correct = -2;
					}
				}
				else {
					correct = -2;
				}
			}		
		}
		
		return correct;
	}
	
	
	/***********************************************************************************************************
	 * Fonction qui limite le nombres de caractères saisis dans un champ text ou textarea 
	 * identifié par son id. 
	 * Lorsqu'on atteint le maximum, la fonction efface les caractères en trop. 
	 * 
	 * @params	txt_id  : l'id du champ à contrôler 
	 *			max		: le nombre maximum de caractères autorisé 
	 **/
	function countCar(txt_id, max) 
	{
		var txt = document.getElementById(txt_id);
		
		if (txt.value.length > max) 
		{
			txt.value = txt.value.substr(0, max); // substr(0, max) <=> substring(0, max-1)
		}
	}
	
	
	//==============================================================================================
	
	function txtOnFocus(thisTxtBox, txtDefault)
	{
		if (thisTxtBox.value == txtDefault)
		{
			thisTxtBox.value='';
		}
	}
	
	function txtOnBlur(thisTxtBox, txtDefault)
	{
		if (thisTxtBox.value == '')
		{
			thisTxtBox.value=txtDefault;
		}
	}
	
	
	//==============================================================================================
	/**
	 * Fonction qui récupère les paramètres GET de l'url courante et les retourne dans un 
	 * tableau à 2 dimensions : 
	 * 
	 * Ex : url = http://www.truc.com/index.aspx ? param1=x & param2=y 
	 * 
	 *		tab[0][0] = "param1"  /  tab[0][1] = "x" 
	 *		tab[1][0] = "param2"  /  tab[1][1] = "y" 
	 * 
	 * S'il n'y a pas de paramètres GET dans l'url la fonction renvoie la valeur 'null'.
	 **/
	function getParams() 
	{
		var params = location.search.substring(1, location.search.length);
		
		if ( params != "" ) 
		{
			var tab = new Array();
			params = params.split("&");
			
			for (i=0; i < params.length; i++) 
			{
				var variable = params[i].substring(0, params[i].indexOf("="));
				var valeur = params[i].substring(params[i].indexOf("=")+1, params[i].length);
				
				tab[i] = new Array(variable, valeur);
			}
			
			return tab;
		}
		else 
		{
			return null;
		}
	}
	
	
	/***********************************************************************************************************
	 * Masque le layer dynamique 
	 */
	function closeDynLayer()
	{
	    var objDynLayer=document.getElementById("FloatDynLayer");
		if(objDynLayer != null)
		{
	
            if (objDynLayer.style.visibility=='visible')
            {
                setOpacity(objDynLayer, 0);
			    objDynLayer.style.visibility='hidden';
			    objDynLayer.innerHTML="";
			    setOpacity(document.getElementById("container"), 100);        	    
            }			
		}				
		
		objDynLayer=document.getElementById("QteDynLayer");
		if(objDynLayer != null)
		{
	
            if (objDynLayer.style.visibility=='visible')
            {
                setOpacity(objDynLayer, 0);
			    objDynLayer.style.visibility='hidden';
			    setOpacity(document.getElementById("container"), 100);        	    
            }			
		}				
	}
	
	
	/***********************************************************************************************************
	 * Affiche avec un effet fad-in un objet html
	 */	
	function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		obj.style.visibility='visible';
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 10;
			window.setTimeout("fadeIn('"+ objId +"',"+opacity+")", 100);
		}
	}
}

	/***********************************************************************************************************
	 * Masque avec un effet fad-out un objet html
	 */	
	function fadeOut(objId,opacity) {
		if (document.getElementById) {
			obj = document.getElementById(objId);
			if (opacity > 0) {
				setOpacity(obj, opacity);
				opacity -= 10;
				timerFader = window.setTimeout("fadeOut('"+ objId +"',"+opacity+")", 100);
			}
		}
	}

	/***********************************************************************************************************
	 * MAffecte l'opacité d'un objet html
	 */	
	function setOpacity(obj, opacity) {
		opacity = (opacity == 100)?99.999:opacity;	
		// IE/Win
		obj.style.filter = "alpha(opacity:"+opacity+")";
		// Safari<1.2, Konqueror
		obj.style.KHTMLOpacity = opacity/100;
		// Older Mozilla and Firefox
		obj.style.MozOpacity = opacity/100;
		// Safari 1.2, newer Firefox and Mozilla, CSS3
		obj.style.opacity = opacity/100;
	}




//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+     Fonctions relatives à la souris -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+	

	if (document.layers) { // Netscape
    document.captureEvents(event.MOUSEMOVE);
} else if (document.all) { // Internet Explorer
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onmousemove = captureMousePosition;
    if (navigator.userAgent.indexOf('Safari',0)>0) document.onclick=captureMousePosition;
}


	
/***********************************************************************************************************
 * Récupère les coordonnées de la souris
 */		
function captureMousePosition(e) {
    if (document.layers)
    {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
    else if (document.all)
    {
    	if (document.body) 
    	{
    		if ((navigator.appVersion.indexOf('Mac',0))>0) 
    		{
    			xMousePos = event.x+document.body.scrollLeft; 
     			yMousePos = event.y+document.body.scrollTop; 
     			//xMousePosMax = document.documentElement.clientWidth+document.body.scrollLeft;
     			xMousePosMax = document.documentElement.clientWidth;
	        	yMousePosMax = document.documentElement.clientHeight+document.body.scrollTop;
    		} 
    		else if ((document.body.scrollLeft == 0) && (document.body.scrollTop == 0)) 
    		{
					xMousePos = window.event.x+document.documentElement.scrollLeft;
		        yMousePos = window.event.y+document.documentElement.scrollTop;
		        xMousePosMax = document.documentElement.clientWidth+document.documentElement.scrollLeft;
	        	yMousePosMax = document.documentElement.clientHeight+document.documentElement.scrollTop;
	        } 
	        else 
	        {
		       	xMousePos = window.event.x+document.body.scrollLeft;
		        yMousePos = window.event.y+document.body.scrollTop;
	    		xMousePosMax = document.documentElement.clientWidth+document.body.scrollLeft;
	        	yMousePosMax = document.documentElement.clientHeight+document.body.scrollTop;
			}
		}
    } 
    else if (document.getElementById) 
    {
        // Netscape 6 behaves the same as Netscape 4 in this regard 
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}



//==============================================================================================
//Add le 10/10/2007 par D.Guillard :: Renvoi la page courante
//(Par exemple dans la liste des messages, il faut revenir à la page 1 lorsque l'on supprime le dernier element restant de la page 2)
function get_currentPage(page,nbElements)
{
var limit = (page - 1) * 10

	if ( limit < nbElements )
	{
		return page;
	}
	else
	{
		if (page == 1)
		{
			return 1;
		}
		else
		{
			return page - 1;
		}
	}
}


	/***********************************************************************************************************
	 * Appel la page de supression d'un utilisateur et de ses paniers / messages
	 */
	function dropUser(userID)
	{
		if ( confirm("\312tes-vous certain de vouloir supprimer cet utilisateur ?\nAttention, cette action supprimera \351galement tout les paniers et messages de celui-ci !") ) 
		{
			var myXHR = new httpRequest('/compte/utilisateurs.aspx?action=suppr&id=' + userID,'','POST')

			myXHR.LoadContent('main','Suppression de l utilisateur en cours ...','initXHR()'); 			
		}
	}
	
	
	/***********************************************************************************************************
	 * Affiche le formulaire de recherche dans les commandes  
	 */
	function ShowSearchCommandForm() 
	{
		var objLayer=document.getElementById("searchFormDiv");
		
				
		if(objLayer != null)
		{
			objLayer.innerHTML="";
			var myXHR = new httpRequest('/_application/_functions/ajaxLoader.aspx?idControl=SEARCH_CMD_FORM','','POST')
			myXHR.LoadContent('searchFormDiv','Chargement du formulaire de recherche',''); 
			
            var btn = document.getElementById("btn_showCmdSearch");
            btn.innerHTML = '<a class="btnBleu righttop" href="#" onclick="HideSearchCommandForm()">Annuler la recherche</a>';
		}		
			
	} 
	
	/***********************************************************************************************************
	* Masquele formulaire de recherche dans les commandes  
	 */
	function HideSearchCommandForm() 
	{
		var objLayer=document.getElementById("searchFormDiv");
		
				
		if(objLayer != null)
		{
			objLayer.innerHTML="";
			
            var btn = document.getElementById("btn_showCmdSearch");
            btn.innerHTML = '<a class="btnBleu righttop" href="#" onclick="ShowSearchCommandForm()">Rechercher</a>';
		}		
			
	} 	
    
	
	
	/***********************************************************************************************************
	 * Affiche le formulaire de recherche dans les factures  
	 */
	function ShowSearchFactForm(modeAffiche) 
	{
		var objLayer=document.getElementById("searchFormDiv");				
		if(objLayer != null)
		{
			objLayer.innerHTML="";
			var myXHR = new httpRequest('/_application/_functions/ajaxLoader.aspx?idControl=SEARCH_FACT_FORM&mode_affichage=' + modeAffiche,'','POST')
			myXHR.LoadContent('searchFormDiv','Chargement du formulaire de recherche',''); 
            
            var btn = document.getElementById("btn_showfactSearch");
            btn.innerHTML = '<a class="btnBleu righttop" href="#" onclick="HideSearchFactForm()">Annuler la recherche</a>';
		}		
	} 
	
	
	
	/***********************************************************************************************************
	* Masquele formulaire de recherche dans les factures
	 */
	function HideSearchFactForm() 
	{
		var objLayer=document.getElementById("searchFormDiv");
						
		if(objLayer != null)
		{
			objLayer.innerHTML="";
			
            var btn = document.getElementById("btn_showfactSearch");
            btn.innerHTML = '<a class="btnBleu righttop" href="#" onclick="ShowSearchFactForm(\'fact\')">Rechercher</a>';
		}		
	} 	
	
    
	/***********************************************************************************************************
	 * Affiche le formulaire de recherche des comptes 
	 */
	function ShowSearchCompteForm() 
	{
		var objLayer=document.getElementById("searchFormDiv");
			
		if(objLayer != null)
		{
			objLayer.innerHTML="";
			var myXHR = new httpRequest('/_application/_functions/ajaxLoader.aspx?idControl=SEARCH_CPT_FORM','','POST');
			myXHR.LoadContent('searchFormDiv','Chargement du formulaire','');
			
            var btn = document.getElementById("btn_showCptSearch");
            btn.innerHTML = '<a class="btnBleu righttop" href="#" onclick="HideSearchCompteForm()">Annuler la recherche</a>';
		}		
	} 
	
	/***********************************************************************************************************
	 /* Masque le formulaire de recherche des comptes 
	 */
	function HideSearchCompteForm() 
	{
		var objLayer=document.getElementById("searchFormDiv");
		
				
		if(objLayer != null)
		{
			objLayer.innerHTML="";
			
            var btn = document.getElementById("btn_showCptSearch");
            btn.innerHTML = '<a class="btnBleu righttop" href="#" onclick="ShowSearchCompteForm()">Rechercher un compte</a>';
		}		
	} 	
	
	

var lastActLink="";

function setCSSStyle(objName,CSSObj,CssValue)
{

	var LinkObj = document.getElementById(objName);
	if (LinkObj)
	{
		lastActLink=objName
		eval("LinkObj.style." + CSSObj + "=\"" + CssValue+ "\"") ;
	}
}

function UnsetLastActLink()
{
	
	setCSSStyle(lastActLink,'color','#000000')

}


//=====================================================================================


function voiCGV()
{
		var objDynLayer=document.getElementById("FloatDynLayer");
		objDynLayer.style.visibility='visible';
		objDynLayer.style.display='block';
		objDynLayer.innerHTML="";
		
		if (document.all) 
		{
			//IE
			x = (document.documentElement.clientWidth/2) - (objDynLayer.offsetWidth / 2);;
			y =(document.documentElement.clientHeight/2) - (objDynLayer.offsetHeight / 2);;
		}
		else
		{
			x = (window.innerWidth / 2) - (objDynLayer.offsetWidth / 2);
			y = (window.innerHeight / 2) - (objDynLayer.offsetHeight / 2);		
		}
		
		setOpacity(document.getElementById("container"), 25);
		setOpacity(document.getElementById("FloatDynLayer"), 100);
		objDynLayer.style.top = y + "px";
		objDynLayer.style.left =x + "px";
				
		
			if(objDynLayer != null)
			{
				var myxhr = new httpRequest('/faq/cgv.aspx','','POST');
				myxhr.LoadContent('FloatDynLayer','Chargement en cours...','');
								
			}		
}


//=====================================================================================
//=====================================================================================


function OuvrirMessage(idMsg,mode,page,nbElements)
{
		var objDynLayer=document.getElementById("FloatDynLayer");
		objDynLayer.style.visibility='visible';
		objDynLayer.style.display='block';
		objDynLayer.innerHTML="";
		var x,y;


		if (document.all) 
		{

			x = (document.documentElement.clientWidth / 2) - (objDynLayer.offsetWidth / 2);
			y = (document.documentElement.clientHeight / 3.5);
		}
		else
		{
			x = (window.innerWidth / 2) - (objDynLayer.offsetWidth / 2);
			y = (window.innerHeight / 2) - (objDynLayer.offsetHeight / 2);		
		}
    			
		setOpacity(document.getElementById("container"), 25);
		setOpacity(document.getElementById("FloatDynLayer"), 100);
		objDynLayer.style.top = y + "px";
		objDynLayer.style.left = x + "px";				
			if(objDynLayer != null)
			{
				var jsStr ="ChangeStatusMessage('" + idMsg + "')";
				var myURL = '/_application/_functions/ajaxLoader.aspx?idControl=MAILBOX&detailmode=' + mode + '&IdMsg=' + idMsg + '&page=' + page + '&nbElements=' + nbElements;
								
				/* Modif le 03/10/2007 par D.Guillard */
				var myxhr = new httpRequest(myURL,'','POST');
				myxhr.LoadContent('FloatDynLayer','Ouverture du message en cours',jsStr);
			}		
}



// 

//=====================================================================================
//=====================================================================================
// Ouvre le formulaire d'ajout de livres non trouvé

function OuvrirFormNotFound(idPan)
{
			var objDynLayer=document.getElementById("FloatDynLayer");
			objDynLayer.style.visibility='visible';
			objDynLayer.style.display='inline';
			objDynLayer.innerHTML="";
	
			if (document.all) 
			{
				//IE
				x = (document.documentElement.clientWidth/2) - (objDynLayer.offsetWidth / 2);;
				y =(document.documentElement.clientHeight/2) - (objDynLayer.offsetHeight / 2);;
			}
			else
			{
				x = (window.innerWidth / 2) - (objDynLayer.offsetWidth / 2);
				y = (window.innerHeight / 2) - (objDynLayer.offsetHeight / 2);		
			}
			setOpacity(document.getElementById("container"), 30);
			setOpacity(document.getElementById("FloatDynLayer"), 100);
			objDynLayer.style.top = y + "px";
			objDynLayer.style.left =x + "px";
					
				if(objDynLayer != null)
				{
					var myURL = '/_application/_functions/ajaxLoader.aspx?idControl=FORMADD_NF&idPan=' + idPan;
					var myxhr = new httpRequest(myURL,'','POST');
					myxhr.LoadContent('FloatDynLayer','Chargement de la fiche produit','initializetabcontent(\'maintab\')');
	
				}		
}



//=====================================================================================
//=====================================================================================
// Ouvre le formulaire d'ajout de livres non trouvé

function OuvrirDetailNotFound(idCmd,ean)
{
			var objDynLayer=document.getElementById("FloatDynLayer");
			objDynLayer.style.visibility='visible';
			objDynLayer.style.display='inline';
			objDynLayer.innerHTML="";
	
			if (document.all) 
			{
				//IE
				x = (document.documentElement.clientWidth/2) - (objDynLayer.offsetWidth / 2);;
				y =(document.documentElement.clientHeight/2) - (objDynLayer.offsetHeight / 2);;
			}
			else
			{
				x = (window.innerWidth / 2) - (objDynLayer.offsetWidth / 2);
				y = (window.innerHeight / 2) - (objDynLayer.offsetHeight / 2);		
			}
			setOpacity(document.getElementById("container"), 30);
			setOpacity(document.getElementById("FloatDynLayer"), 100);
			objDynLayer.style.top = y + "px";
			objDynLayer.style.left =x + "px";
					
				if(objDynLayer != null)
				{
					var myURL = '/_application/_functions/ajaxLoader.aspx?idControl=DETAIL_NF&idCmd=' + idCmd + '&ean=' + ean;
					var myxhr = new httpRequest(myURL,'','POST');
					myxhr.LoadContent('FloatDynLayer','Chargement de la fiche produit','initializetabcontent(\'maintab\')');
	
				}		
}

// 
//========================================================================================
// Ajout un titre non trouvé au panier ( repris de la fonction de christophe sur LP )
function exec_form_addProduct(panierID,nameForm, nameTxtEan, nameTxtTitle, nameTxtAuteur, nameTxtEditeur, nameTxtAreaExplicatif)
{
	this.elmt_form				= document.forms[nameForm]; // récupération du formulaire
	this.elmt_txtEan			= this.elmt_form[nameTxtEan];
	this.elmt_txtTitle			= this.elmt_form[nameTxtTitle];
	this.elmt_txtAuteur			= this.elmt_form[nameTxtAuteur];
	this.elmt_txtEditeur		= this.elmt_form[nameTxtEditeur];
	this.elmt_txtAreaEplicatif	= this.elmt_form[nameTxtAreaExplicatif];

	// LE formulaire est valide dans plusieurs cas.
	// Si l'ean est remplis, ou alors le champ titre, ou alors le champs explicatif.
	// le champs Auteur, editeur et support ne sont qu'informatif !
	this.verifForm = function()
	{
		isValid = false;
		
		if (this.elmt_txtEan.value.length > 0 || this.elmt_txtTitle.value.length > 0 || this.elmt_txtAreaEplicatif.value.length > 0)
		{isValid  = true;}
		
		return isValid;
	}

	// si le formulaire est valide, alors on envoie via httpRequest les données :)
	if (this.verifForm())
	{
	
		//¤¤¤¤¤¤¤ EAN ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
		var validEAN = true;
		if (this.elmt_txtEan.value.length > 0)
		{
			//Check de la validité de l'ean
			if (check_isbn_ean(this.elmt_txtEan.value) == 1)
			{
				var txtEanValue	= this.elmt_txtEan.value;
			}
			else
			{
				validEAN = false;
			}
		}
		else
		{
			var txtEanValue		= 'inconnu';
		} 
		//¤¤¤¤¤¤¤ TITRE ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
		if (this.elmt_txtTitle.value.length > 0)
		{
			var txtTitleValue	= this.elmt_txtTitle.value;
		}
		else if (this.elmt_txtAreaEplicatif.value.length > 0)
			{
				if (this.elmt_txtAreaEplicatif.value.length > 60)
				{
					var txtTitleValue = this.elmt_txtAreaEplicatif.value.substring(0,60) + '...';
				}
					else
				{
					var txtTitleValue = this.elmt_txtAreaEplicatif.value;
				}
			}
				else
				{
					var txtTitleValue = 'Titre en cours de recherche';
				}
		//¤¤¤¤¤¤¤ AUTEUR ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
		var txtAuteurValue	= this.elmt_txtAuteur.value;
		//¤¤¤¤¤¤¤ EDITEUR ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
		var txtEditeurValue = this.elmt_txtEditeur.value;
		//¤¤¤¤¤¤¤ COMMENTAIRE ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
		var areaExplicValue = this.elmt_txtAreaEplicatif.value;
			
		//si l'ean saisie est valide
		if (validEAN == true)
		{
			var myxhr = new httpRequest(docRoot + '/commandes/monPanier.aspx?action=addNotFound&id=' + panierID + '&ean=' + txtEanValue + '&titre=' + txtTitleValue +'&auteur=' + txtAuteurValue + '&editeur=' + txtEditeurValue + '&commentaire=' + areaExplicValue,'','POST');
			myxhr.LoadContent('main','Ajout du livre en cours ...','');		
			
			//on en profite pour fermer le formulaire
			closeDynLayer();
		}
			else
		{
			//si l'ean saisie n'est pas un ean valide.
			alert('Votre EAN n\'est pas valide');
		}
		
	}
	else
	{
		alert("Vous devez remplir au moins un des champs suivant pour que votre charg\351 de client\350le puisse retrouver ce titre : \n - EAN13 \n - Titre \n - Commentaire");
	}
}

//=====================================================================================

	// Appel la page de supression d'un utilisateur et de ses paniers / messages
	function dropModele(formatID)
	{
		if ( confirm("\312tes-vous certain de vouloir supprimer ce mod\350le d'import ?") ) 
		{
				var myxhr = new httpRequest('/commandes/ModeleImport_charge.aspx?action=suppr&id=' + formatID,'','POST');
				myxhr.LoadContent('main','Suppression du format en cours ...','');			

		}
	}
//=====================================================================================
// Actualise le nom du compte en cours dans le menu de gauche (control_panel)
function Affiche_CompteSelected(compteAffiche_societe)
{
	document.getElementById('CompteCourant').innerHTML = compteAffiche_societe;
}
//=====================================================================================
//Change le type d'affichage des messagesChange
function ChangeTypeMessages(mode,typeMessages)
{
	var myxhr = new httpRequest('/compte/courrier.aspx?mode=' + mode +'&typeAffiche=' + typeMessages,'','POST');
	myxhr.LoadContent('main','Chargement des messages ...','');		
	
}
//=====================================================================================
//Controle les champs d'un modele
ModeleisValid='0';
function CheckThisModele(step)
{
	isvalid=true;

	// STEP 1
	if (step =='1')
	{
		if (document.getElementById('TemplateName').value == '')
		{
			alert('Vous devez donner un nom a votre modele');
			isvalid=false;
		}
		if ( ModeleisValid == '0' )
		{
			isvalid=false;
		}
		if (document.getElementById('separator').value == 'autre')
		{
			if (document.getElementById('separator_perso').value == '')
			{
				alert('Votre modele dois contenir un separateur de colonnes');
				isvalid=false;
			}
		}
	}
	
	// STEP 2
	if (step =='2')
	{
		if (document.getElementById('EAN').value == '-1' && document.getElementById('ISBN').value == '-1')
		{
			alert('Votre modèle dois contenir au moins un EAN ou un ISBN');
			isvalid=false;
		}
		if (document.getElementById('QUANTITE').value == '-1')
		{
			alert('Votre modele dois contenir au moins une QUANTITE');
			isvalid=false;
		}
	}
	
	return isvalid;
}



	function mailchecker()
	{
		myXHR = new httpRequest(docRoot + "/_application/_functions/ajaxLoader.aspx?idControl=CHECK_MAIL", "", "POST");
		myXHR.LoadContent("MsgChecker",'','checkSession()');
		
		var MailCheckTimer = setTimeout('mailchecker()',15000)	
		
	}
	
	
	function checkSession()
	{	
			var objMain=document.getElementById("MsgChecker");
			if (objMain)
			{
				var strDiv = objMain.innerHTML;
				
				if (strDiv.indexOf('fin de session')>0)
				{
					document.location.href='index.aspx?log=end_session';
				}
			}
			
	}
	
	
	//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
	//¤¤¤¤ Add le 17/12/2007 par d.guillard, Charge le lofo et la description d'un format d'import ¤¤¤¤¤¤
	function ShowLogo(ThisID)
	{
		myXHR = new httpRequest("/_application/_functions/ajaxLoader.aspx?idControl=LOAD_LOGO&idFormat=" + ThisID, "", "POST");
		myXHR.LoadContent('Loadlogo','','');
	}
	
	//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
	//¤¤¤¤ Add le 17/12/2007 par d.guillard, ouvre la description d'un modele d'import ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

	function OuvrirDescriptionImport(id) 
	{
	    var objDynLayer=document.getElementById("FloatDynLayer");
	    objDynLayer.style.visibility='visible';
	    objDynLayer.style.display='inline';
	    objDynLayer.innerHTML="";

	    if (document.all) 
	    {
		    //IE
		    x = (document.documentElement.clientWidth/2) - (objDynLayer.offsetWidth / 2);;
		    y =(document.documentElement.clientHeight/2) - (objDynLayer.offsetHeight / 2);;
	    }
	    else
	    {
		    x = (window.innerWidth / 2) - (objDynLayer.offsetWidth / 2);
		    y = (window.innerHeight / 2) - (objDynLayer.offsetHeight / 2);		
	    }
	    setOpacity(document.getElementById("container"), 30);
	    setOpacity(document.getElementById("FloatDynLayer"), 100);
	    objDynLayer.style.top = y + "px";
	    objDynLayer.style.left =x + "px";
	    
	    var strContent = '<h1>' 
	                   + '<ul id="maintab" style="margin-right:10px; position:absolute; top:8px; right:2px;"><li><a class="btnClosePopup" href="#" title="Fermer cette fen\352tre" onclick="closeDynLayer();">Fermer la fenetre</a></li></ul>' 
	                   + 'Description du mod\350le d\'import</h1>' 
	                   + '<div style="clear:left; padding:30px 12px;">';
	                   
	    if (document.getElementById('hidden_desc' + id)) {
	        strContent += document.getElementById('hidden_desc' + id).value + '</div>';
	    } 
	    else {
	        strContent += 'Aucun descriptif n\'a \351t\351 saisi.</div>';
	    }
	    
	                   
	    document.getElementById('FloatDynLayer').innerHTML = strContent;
    	
	    /*
	    if(objDynLayer != null)
	    {
		    var myURL = '/_application/_functions/ajaxLoader.aspx?idControl=DETAIL_NF&idCmd=' + idCmd + '&ean=' + ean;
		    var myxhr = new httpRequest(myURL,'','POST');
		    myxhr.LoadContent('FloatDynLayer','Chargement de la fiche produit','initializetabcontent(\'maintab\')');

	    }
	    */		
	}

	//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
	//¤¤¤¤ Add le 08/01/2009 par d.guillard, check si l'utilisateur souhaite utiliser un identificateur personnalisé ¤¤¤¤¤¤
	function check_PersonnalSeparator()
	{

	var curValue=document.getElementById('separator').value;

		if(curValue=='autre')
		{
			document.getElementById('separator_perso').disabled=false;
		}else{
			document.getElementById('separator_perso').disabled=true;
		}

	}
	//¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    //#######################################################################################################
    
    function trim(s) {
        return s.replace(/^\s+/, '').replace(/\s+$/, '');
    }

    /**
     * M.Zekhnini- 18/10/2011 
     * Mettre en majuscule le premier caractère d'une chaîne 
     */
    function ucFirst(str) 
    {
	    var str_trimmed = trim(str);     	
	    var str_modified = str_trimmed.charAt(0).toUpperCase() + str_trimmed.substring(1);
	    return str.replace(str_trimmed, str_modified);
    }


    /**
     * M.Zekhnini - 18/10/2011 
     * Mettre en minuscules toutes les lettres sauf la première en majuscule
     */
    function ucFirst_lcAll(str) 
    {
	    var str_trimmed = trim(str);
	    var str_modified = str_trimmed;
    	
	    str_modified = str_trimmed.toLowerCase();
	    str_modified = str_modified.charAt(0).toUpperCase() + str_modified.substring(1);
    	
	    return str.replace(str_trimmed, str_modified);
    }


    /**
     * M.Zekhnini - 18/10/2011 
     * Mettre en majuscule le premier caractère de chaque mot d'une chaîne 
     */
    function ucFirst_words(str) 
    {
	    str = trim(str);
    	
	    // Tableau de séparateurs de mots possibles 
	    var tab_carToSplit = new Array(" ", ",", ";", "'", "-", "(", ")", "[", "]", "{", "}");
    	
	    var sep;
	    var tab_tmp;
	    var tmpStr = "";
    	
	    for (i=0; i < tab_carToSplit.length; i++) 
	    {
		    sep = tab_carToSplit[i];
		    tab_tmp = str.split(sep);
		    tmpStr = "";
    		
		    for (k=0; k < tab_tmp.length; k++) 
		    {
			    if (tab_tmp[k].length > 0) 
			    {
				    //tmpStr += ucFirst(tab_tmp[k]);
				    tmpStr += ucFirst_lcAll(tab_tmp[k]);
				    if (k < (tab_tmp.length - 1)) 
				    {
					    tmpStr += sep;
				    }
			    }
		    }
    		
		    str = tmpStr;
		    str = trim(str);
	    }
    	
	    return str;
    }

    function ucFirst_allWords(str) 
    {
	    str = trim(str);
    	
	    // Tableau de séparateurs de mots possibles 
	    var tab_carToSplit = new Array(" ", ",", ";", "'", "-", "(", ")", "[", "]", "{", "}");
    	
	    var sep;
	    var tab_tmp;
	    var tmpStr = "";
    	
	    for (i=0; i < tab_carToSplit.length; i++) 
	    {
		    sep = tab_carToSplit[i];
		    tab_tmp = str.split(sep);
		    tmpStr = "";
    		
		    for (k=0; k < tab_tmp.length; k++) 
		    {
			    if (tab_tmp[k].length > 0) 
			    {
				    tmpStr += ucFirst(tab_tmp[k]);
				    if (k < (tab_tmp.length - 1)) 
				    {
					    tmpStr += sep;
				    }
			    }
		    }
    		
		    str = tmpStr;
		    str = trim(str);
	    }
    	
	    return str;
    }
    
 /***********************************************************************************************************
 * Function wich check if value of an element is an integer ( > 1, hasn't decimal part)
 */
function CheckElementValueIsInteger(objElement)
{
    var elementValue = objElement.value;
    
    //Check if quantity is an integer (not a numeric, not lower than 1 and hasn't a decimal part (authorized character or not)
    if (elementValue !='' && (isNaN(elementValue) || elementValue.indexOf(",") != -1 || elementValue.indexOf(".") != -1 || elementValue < 1 ))
    { //Cas error
        objElement.value = 1;
        return false;
    }
    return true;
}

function ReplaceNummlock(myString)
 {
    myString = myString.replace(/\&/g, "1");
    myString = myString.replace(/é/g, "2");
    myString = myString.replace(/\"/g, "3");
    myString = myString.replace(/\'/g, "4");
    myString = myString.replace(/\(/g, "5");
    myString = myString.replace(/-/g, "6");
    myString = myString.replace(/è/g, "7");
    myString = myString.replace(/_/g, "8");
    myString = myString.replace(/ç/g, "9");
    myString = myString.replace(/à/g, "0");

    return myString;
 }   
 
/***********************************************************************************************************
 * Appel la page de supression d'une recherche et de ses rayons
 */ 	
function dropAlert(alertID)
{
	
	if ( confirm("Etes-vous certain de vouloir supprimer cette recherche ?") ) 
	{
		var myXHR = new httpRequest('/compte/mesRss.aspx?action=delete&recherche_id=' + alertID,'','POST')
		myXHR.LoadContent('main','Suppression de la recherche en cours ...',''); 			
	}
}

function ShowNewAlertForm() 
{
	var objLayer=document.getElementById("main");
		
	if(objLayer != null)
	{
		objLayer.innerHTML="";
		var myXHR = new httpRequest('/compte/newRss.aspx','','POST');
		myXHR.LoadContent('main','Chargement du formulaire','');
	}		
}

function ShowMesRss()
{
    var objLayer=document.getElementById("main");
		
	if(objLayer != null)
	{
		objLayer.innerHTML="";
		var myXHR = new httpRequest('/compte/mesRss.aspx?utils=charge','','POST');
		myXHR.LoadContent('main','Chargement du formulaire','');
	}
}


//*******************************************************************************
function getSelect(id)
{
    document.getElementById(id).select();
}
