function openPrintWindow(url) {
	remote = window.open(url,'Impression','toolbar=no,status=no,width=800,height=480,left=20,top=50,scrollbars=yes,resizable=yes');
    if (((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4 ))) {
            remote.focus();
    }
}

function ouvrirEcritures(num) {
	remote = window.open('../ecritures/default.asp?Numero=' + num,'Ecritures','toolbar=no,status=no,width=730,height=600,left=20,top=50,scrollbars=yes,resizable=yes');
    if (((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4 ))) {
            remote.focus();
    }
}
function ouvrirSoldeComptable() {
	remote = window.open('SoldeComptable.asp','Consultation du solde comptable','toolbar=no,status=no,width=400,height=150,left=20,top=50,scrollbars=yes,resizable=yes');
    if (((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4 ))) {
            remote.focus();
    }
}
function ouvrirPJ() {
window.open('attachPJ.asp','','toolbar=no,status=no,width=400,height=150,left=20,top=50,scrollbars=yes,resizable=yes');
}

function FormatNumber(num,decimalNum)
{ 
    if (isNaN(parseInt(num))) return "NaN";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	return tmpNum;		// Return our formatted string!
}
function cent(amount) {
// returns the amount in the .99 format 
    amount -= 0;
    amount = (Math.round(amount*100))/100;
    return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}
function getIndex(what) {
    for (var i=0;i< saisieAchat.elements.length;i++)
        if (what == saisieAchat.elements[i])
            return i;
    return -1;
}

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_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 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 Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4) && (this.major < 5));
    this.ns6 = (this.ns && (this.major >= 5));
    this.ie   = (agent.indexOf("msie") != -1);
    this.ie3  = (this.ie && (this.major == 2));
    this.ie4  = (this.ie && (this.major >= 4));
    if (navigator.userAgent.indexOf('MSIE 5')>0 || navigator.userAgent.indexOf('MSIE 6')>0)
		this.ie5  = (this.ie && (this.major >= 4));
    this.op3 = (agent.indexOf("opera") != -1);
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
	this.cr1 = "(";
	this.cr2 = ")";
 	this.txtshow = "visible";
	this.txthide = "hidden";
   if(this.ns4) { this.doc = "document";
		this.cr1 = "[";
		this.cr2 = "]";
		this.sty = "";
		this.txtshow = "show";
		this.txthide = "hide";
	} else if(this.ie4) { this.doc = "document.all";
		this.sty = ".style";
	} else if(this.ns6) { this.doc = "document.getElementById";
		this.sty = ".style";
	}
}
var is = new Is();

function showObject(strobj) {
var obj = eval(is.doc + is.cr1 + '"' + strobj + '"' + is.cr2 + is.sty);
obj.visibility = is.txtshow;
}
function hideObject(strobj) {
var obj = eval(is.doc + is.cr1 + '"' + strobj + '"' + is.cr2 + is.sty);
obj.visibility = is.txthide;
}
var offsetx = 9, offsety = 9, snow=0, over;
document.onmousemove = mouseMove;
if (is.ns4) document.captureEvents(Event.MOUSEMOVE);

function moveTo(strobj,xL,yL) {
var obj = eval(is.doc + is.cr1 + '"' + strobj + '"' + is.cr2 + is.sty);
obj.left = xL
obj.top = yL
}

function mouseMove(e) {
if (snow!=0) {
	if (is.ns4) {x=e.pageX; y=e.pageY;}
	if (is.ie4) {x=event.x; y=event.y;}
	if (is.ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}
	if (is.ns6) {x=e.pageX+10; y=e.pageY;}
	over='expli'+snow;
	moveTo(over,x+offsetx,y+offsety);
	}
}
function setTextOfLayer(objName,x,newText) {
  if ((obj=findObj(objName))!=null) with (obj)
    if (navigator.appName=='Netscape') {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
function defil()
{
size=15;
x = 3*size;
place = 0;

texteDef = texteDef.substring(1,texteDef.length);
while(texteDef.length < x)
	{
	texteDef += " - " + texte;
	}
document.defil.defilbox.value = texteDef;
tempo2 = setTimeout("defil()", 150)
}
