
	function fSubmit(action,confirmText,frmID) {
	
		//action : De la forme 'AC_Delete' par exemple
		//confirmText : Texte de confirmation
		//frmID : ID du formulaire
		//alert('action = ' + action);
		if (action == null || action == '') {
			var error=true;
			// erreur de validation des paramétre
			//return false;
		}
		else {
			//récupération du form
			if (frmID == null || frmID == '') {
				frmObj = document.forms[0]; 
			}
			else {
				frmObj = document.forms[frmID];
			}    
	   
			if (confirmText == null || confirmText == '') {
				//pas de boite de confirmation
				frmObj.AC_VALUE.value = action;
				frmObj.submit();
				
				//return true;
			}
			else {
				//avec boite de confirmation
				if (window.confirm(confirmText)) {
					frmObj.AC_VALUE.value = action;  
					frmObj.submit();
					//return true;
				}
				else {
					//alert('nnn');
					return false;
				}
			}
		}
	}
	
	function getBrowserSize() {
	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
	  //window.alert( 'Width = ' + myWidth );
	  //window.alert( 'Height = ' + myHeight );
	  return (myWidth + ',' + myHeight);
	}

	function popupcentree(page,largeur,hauteur,options) {
		if (largeur ==0 && hauteur==0) {
			// we use 90% of the window
			var size_window_array = getBrowserSize().split(','); // ex : 1252,456
			var window_width =size_window_array[0];
			var window_height = size_window_array[size_window_array.length-1];
		//alert(window_width + '--' + window_height);
			var perc_window = 85;
			largeur = parseInt(window_width * perc_window/100);
			hauteur = parseInt(window_height * perc_window/100);
			
		}
	
		var top=(screen.height-hauteur)/2;
		var left=(screen.width-largeur)/2;
		window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
	}
	
	// Function to open in a specific window that closes if it was already opened
	var newWin = null;
	function closeWin(){
		if (newWin != null){
			if(!newWin.closed)
			newWin.close();
		}
	}
	function DedicatedpopUp(page,largeur,hauteur,options, pageName) {
		closeWin();

		if (largeur ==0 && hauteur==0) {
			// we use 90% of the window
			var size_window_array = getBrowserSize().split(','); // ex : 1252,456
			var window_width =size_window_array[0];
			var window_height = size_window_array[size_window_array.length-1];
		
			var perc_window = 85;
			largeur = parseInt(window_width * perc_window/100);
			hauteur = parseInt(window_height * perc_window/100);
			
		}
		
		if (typeof(pageName) == 'undefined') { 
			pageName = 'newWin';
		}
	
		var top=(screen.height-hauteur)/2;
		var left=(screen.width-largeur)/2;

		newWin = window.open(page, pageName, 'top='+top+',left='+left+',width='+largeur+',height='+hauteur+','+options);
		newWin.focus();
	} 

	
	function addMessageField(text_displaied, text_class)
	{
		var str = new String();
		str += "<tr>";     
			str += "<td class=\"" + text_class + "\" colspan=\"3\">\n";      
			str += text_displaied;
			str += "</td>\n";
		str += "</tr>";
		return str;
	}
	
	// display checkbox (used for the innerHtml to display new lines in a div)
	function addCheckboxField(text_displaied, text_class, checkbox_name, checkbox_value, checkbox_class, stLocal_value)
	{
		var str = new String();
		str += "<tr>";     
			str += "<td class=\"" + text_class + "\" width=\"20%\" nowrap>\n";      
			str += "<label for=\"" +  checkbox_name + "\">" + text_displaied + "</label>";
			str += "</td>\n";
			str += "<td>\n";      
			str += "<div style=\"width=5;\" ></div>";
			str += "</td>\n";
			str += "<td align=\"left\" width=\"80%\">\n";
			
			str += "<input type=\"checkbox\" name=\"" + checkbox_name + "\" id=\"" + checkbox_name + "\" class=\""+ checkbox_class + "\" value='" + checkbox_value + "'" ;
			if (stLocal_value == checkbox_value) {
				str += " checked ";
			}
			str += " />";
			str += "</td>\n";
		str += "</tr>";
		return str;
	}
	
	
	// display checkbox with function for onclick (used for the innerHtml to display new lines in a div)
	function addCheckboxFieldWithOnClick(text_displaied, text_class, checkbox_name, checkbox_value, checkbox_class, stLocal_value, onclick_function)
	{
		var str = new String();
		str += "<tr>";     
			str += "<td class=\"" + text_class + "\" width=\"20%\" nowrap>\n";      
			str += "<label for=\"" +  checkbox_name + "\">" + text_displaied + "</label>";
			str += "</td>\n";
			str += "<td>\n";      
			str += "<div style=\"width=5;\" ></div>";
			str += "</td>\n";
			str += "<td align=\"left\" width=\"80%\">\n";
			str += "<input type=\"checkbox\" name=\"" + checkbox_name + "\"  id=\"" + checkbox_name + "\" class=\""+ checkbox_class + "\" value='" + checkbox_value ;
			str += "'" ;
			str += " onclick=\"" + onclick_function ;
			str += "\"" ;

			if (stLocal_value == checkbox_value) {
				str += " checked ";
			}
			str += " />";
			str += "</td>\n";
		str += "</tr>";
		return str;
	}
	
	function addLinkField(link_value, link_text_value, link_class, target_value)
	{
		var str = new String();
		str += "<tr>";     
			str += "<td colspan=\"3\">\n";   
				str += "<p><a href=\"";    
					str += link_value;
					str += "\" class=\""+ link_class + "\" target=\""+ target_value + "\">";
					str += "&raquo;&nbsp;";
					str += link_text_value;
				str += "</a></p>";      
			str += "</td>\n";
		str += "</tr>";
		return str;
	}
	
	function replaceChars(entry,out,add) {
		//out = ","; // replace this
		//add = "."; // with this
		
		// if out or add are not defined, we put , in out an . in add
		if (typeof(out)=='undefined') {
			out = ","; // replace this
		}
		if (typeof(add)=='undefined') {
			add = "."; // with this
		}
		
		temp = "" + entry; // temporary holder

		while (temp.indexOf(out)>-1) {
			pos= temp.indexOf(out);
			temp = "" + (temp.substring(0, pos) + add + 
			temp.substring((pos + out.length), temp.length));
		}
		//document.subform.text.value = temp;
		return temp;
	} 
	
	//////////
	// Function for FORMAT NUMBER
	//////////
	
	// Original JavaScript code by Duncan Crombie: dcrombie@chirp.com.au
	   // Please acknowledge use of this code by including this header.
	
	   // CONSTANTS
	  var separator = ",";  // use comma as 000's separator
	  var decpoint = ".";  // use period as decimal point
	  var percent = "%";
	  var currency = "$";  // use dollar sign for currency
	
	  function formatNumber(number, format, print) {  // use: formatNumber(number, "format")
		if (print) document.write("formatNumber(" + number + ", \"" + format + "\")<br>");
	
		if (number - 0 != number) return ''; //null;  // if number is NaN return null
		var useSeparator = format.indexOf(separator) != -1;  // use separators in number
		var usePercent = format.indexOf(percent) != -1;  // convert output to percentage
		var useCurrency = format.indexOf(currency) != -1;  // use currency format
		var isNegative = (number < 0);
		number = Math.abs (number);
		if (usePercent) number *= 100;
		format = strip(format, separator + percent + currency);  // remove key characters
		number = "" + number;  // convert number input to string
	
		 // split input value into LHS and RHS using decpoint as divider
		var dec = number.indexOf(decpoint) != -1;
		var nleftEnd = (dec) ? number.substring(0, number.indexOf(".")) : number;
		var nrightEnd = (dec) ? number.substring(number.indexOf(".") + 1) : "";
	
		 // split format string into LHS and RHS using decpoint as divider
		dec = format.indexOf(decpoint) != -1;
		var sleftEnd = (dec) ? format.substring(0, format.indexOf(".")) : format;
		var srightEnd = (dec) ? format.substring(format.indexOf(".") + 1) : "";
	
		 // adjust decimal places by cropping or adding zeros to LHS of number
		if (srightEnd.length < nrightEnd.length) {
		  var nextChar = nrightEnd.charAt(srightEnd.length) - 0;
		  nrightEnd = nrightEnd.substring(0, srightEnd.length);
		  if (nextChar >= 5) nrightEnd = "" + ((nrightEnd - 0) + 1);  // round up
	
	 // patch provided by Patti Marcoux 1999/08/06
		  while (srightEnd.length > nrightEnd.length) {
			nrightEnd = "0" + nrightEnd;
		  }
	
		  if (srightEnd.length < nrightEnd.length) {
			nrightEnd = nrightEnd.substring(1);
			nleftEnd = (nleftEnd - 0) + 1;
		  }
		} else {
		  for (var i=nrightEnd.length; srightEnd.length > nrightEnd.length; i++) {
			if (srightEnd.charAt(i) == "0") nrightEnd += "0";  // append zero to RHS of number
			else break;
		  }
		}
	
		 // adjust leading zeros
		sleftEnd = strip(sleftEnd, "@");  // remove hashes from LHS of format
		while (sleftEnd.length > nleftEnd.length) {
		  nleftEnd = "0" + nleftEnd;  // prepend zero to LHS of number
		}
	
		if (useSeparator) nleftEnd = separate(nleftEnd, separator);  // add separator
		var output = nleftEnd + ((nrightEnd != "") ? "." + nrightEnd : "");  // combine parts
		output = ((useCurrency) ? currency : "") + output + ((usePercent) ? percent : "");
		if (isNegative) {
		  // patch suggested by Tom Denn 25/4/2001
		  output = (useCurrency) ? "(" + output + ")" : "-" + output;
		}
		return output;
	  }
	
	  function strip(input, chars) {  // strip all characters in 'chars' from input
		var output = "";  // initialise output string
		for (var i=0; i < input.length; i++)
		  if (chars.indexOf(input.charAt(i)) == -1)
			output += input.charAt(i);
		return output;
	  }
	
	  function separate(input, separator) {  // format input using 'separator' to mark 000's
		input = "" + input;
		var output = "";  // initialise output string
		for (var i=0; i < input.length; i++) {
		  if (i != 0 && (input.length - i) % 3 == 0) output += separator;
		  output += input.charAt(i);
		}
		return output;
	  }
	
	//////////
	// Function for COOKIES
	//////////
	
	
	var expDays = 1;
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	
	function getCookieVal (offset) {  
		var endstr = document.cookie.indexOf (";", offset);  
		if (endstr == -1)    
		endstr = document.cookie.length;  
		return unescape(document.cookie.substring(offset, endstr));
	}
	
	function GetCookie (name) {  
		var arg = name + "=";  
		var alen = arg.length;  
		var clen = document.cookie.length;  
		var i = 0;  
		while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
		}  
		return null;
	}
	
	function SetCookie (name, value) {  
		var argv = SetCookie.arguments;  
		var argc = SetCookie.arguments.length;  
		var expires = (argc > 2) ? argv[2] : null;  
		var path = (argc > 3) ? argv[3] : null;  
		var domain = (argc > 4) ? argv[4] : null;  
		var secure = (argc > 5) ? argv[5] : false;  
		document.cookie = name + "=" + escape (value) + 
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) +  
		((domain == null) ? "" : ("; domain=" + domain)) +    
		((secure == true) ? "; secure" : "");
	}
	
	function DeleteCookie (name) {  
		var exp = new Date();  
		exp.setTime (exp.getTime() - 1);  
		var cval = GetCookie (name);  
		document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
	}

	//EF2010-03-14 : used to add a separator when the date is on 8 digits like : 24032010 becomes 24/03/2010 (helps to type quicker as only figures)
	function setConvertDate(theField, dateFormatIS) {
		var strValue = theField.value;
		var separatorIS = "/";
	//alert(theValue.length);	
		// if it is a Number then means there is no separator
		if (strValue.length == 8 && !isNaN(strValue)) {
			// add the separator (if there would be other formating of date as defined in ini.cfc , then adapt the separator to use
			if (dateFormatIS.toUpperCase() =='JJ/MM/AAAA') {
				strValue = strValue.substr(0, 2) + '/' + strValue.substr(2, 2) + '/' + strValue.substr(4) ;
				
				theField.value = strValue;
			}
		}
		
		return true;
	}

