// JavaScript Document
	function format(valeur) {
		var cents = Math.round(valeur*100) - Math.floor(valeur)*100;
		if (cents < 10) {cents = "0" + String(cents) ;}
		if (cents==100) {cents = "00";valeur = valeur+1; }
	
		valeur = Math.floor(valeur) + "," + cents;
		return valeur;
	}
	function replace(texte,recherche,remplacement) {
		if (recherche != remplacement && recherche.length > 0 ) {
			fin = texte.indexOf(recherche,0);
			while (fin >= 0) {
			texte =  texte.substring(0,fin)+remplacement+texte.substring(fin+recherche.length,texte.length); 
			fin = texte.indexOf(recherche,0); } }
		return texte; }
		
	function formatCurrency(num) {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+' '+
		num.substring(num.length-(4*i+3));
		return (((sign)?'':'-') + num + ',' + cents);
	}




function onLoad_GridHeader() { FreezeGridViewHeader('GridView1','WrapperDiv'); } 
function FreezeGridViewHeader(gridID,wrapperDivCssClass) {
	var grid = document.getElementById(gridID);
	if (grid != 'undefined') {
		grid.style.visibility = 'hidden';
		var div = null;
		if (grid.parentNode != 'undefined') {
			div = grid.parentNode;
			if (div.tagName == "DIV") {
				div.className = wrapperDivCssClass;  
				div.style.overflow = "auto";                   
			}
		}                
		var tags = grid.getElementsByTagName('TBODY');
		if (tags != 'undefined') {
			var tbody = tags[0];
			var trs = tbody.getElementsByTagName('TR');
			var headerHeight = 8;
			if (trs != 'undefined') {
				headerHeight += trs[0].offsetHeight;
				var headTR = tbody.removeChild(trs[0]);
				var head = document.createElement('THEAD');
				head.appendChild(headTR);
				grid.insertBefore(head, grid.firstChild);
			}
			tbody.style.height = (div.offsetHeight -  headerHeight) + 'px';
			tbody.style.overflow = 'auto';
			tbody.style.overflowX = "hidden";/**/
			tbody.style.height = (div.offsetHeight -  headerHeight) + 'px';
			tbody.overflow = 'auto';
			tbody.overflowX = 'hidden';
		}
		grid.style.visibility = 'visible';
	}
}

function WMOpenPreview(f) { var myPopup = window.open(f); }


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function WMOpen(f,nom, h, w, scroll) {
  var PosLeft = screen.width;
  var PosTop = screen.height;
  PosLeft = ((PosLeft/2)-((w+10)/2))
  PosTop = ((PosTop/2)-((h+59)/2))
  var myPopup = window.open(f, nom, 'resizable=no,scrollbars=' + scroll + ',left=' + PosLeft + ',top=' + PosTop + ',menubar=no,status=no,width=' + w + ',height=' + h);
  if(myPopup.focus){myPopup.focus();}
}

