
var cutFactor      = 1335.3;      // M2 coupés par seconde en Amazonie ( 48 110 000 000 / (3600x24x365) )
var worldCutFactor = 2540.3;      // M2 coupés par seconde dans le monde (80 110 000 000 / (3600x24x365) )

var textCouleur    = "DarkGreen",    // En anglais (selon code couleur (blue, black, green, lightblue, darkgrey etc.) ou code hexa ex. #ACEEEE"
    textTaille     = "2px",          // En pixels (px) ou en points (pts) ex. 12px
    textPolice     = "Verdana",      // Une police typique présente sur tous les postes (Verdana, Courier New, etc.) ou un type vague (Sans Serif, Fixed) 
    separateur     = " ",            // Chaine à utiliser pour séparer les milliers 
    alignement     = "center";       // Alignement du compteur dans son environnement (Centre, Left, Right)
    
/*  
    cutFactor      = 1335.29934;

    textCouleur    = "DarkGreen",
    textTaille     = "10px",
    textPolice     = "Verdana",
    separateur     = " ",
    alignement     = "Center";
*/


function startCounter(ctype ) {

    startZeroDCounter(ctype );
}
function print_counter( ) {
    formcode = "<FORM NAME='zd_compteur_007'><input type='text' name='mcarre' size='15' style='font-family:Verdana,arial;font-size:22px;color:#000000;border= 0px;>'></FORM>";
    document.write(formcode);
    //startZeroDCounter( );
}

function print_world_counter( ) {
    formcode = "<FORM NAME='zd_compteur_007'><input type='text' name='mcarre' size='15' style='font-family:Verdana,arial;font-size:22px;color:#000000;border= 0px'></FORM>";
    document.write(formcode);
    //startZeroDCounter( );
}

function toString(number) {
    var tempnum;
    
    var sep = " "; // Choisir le séparateur (" ", ",", ";" etc.) 

    tempnum= Math.round(number)+" ";
    tempnum= tempnum.substring(0,tempnum.length-1);
    
    if (tempnum.length >3) {
        tempnum = tempnum.substring(0,tempnum.length-3) + separateur + tempnum.substring(tempnum.length-3, 99);
    }
    if (tempnum.length >7) {
        tempnum = tempnum.substring(0,tempnum.length-7) + separateur + tempnum.substring(tempnum.length-7, 99);
    }
    if (tempnum.length >11) {
        tempnum = tempnum.substring(0,tempnum.length-11) + separateur + tempnum.substring(tempnum.length-11, 99);
    }

// Pad information
    if (tempnum.length == 11) {
        tempnum = "  " + tempnum;
    }
    if (tempnum.length == 10) {
        tempnum = "   " + tempnum;
    }
    if (tempnum.length == 9) {
        tempnum = "   " + tempnum;
    }
    if (tempnum.length == 7) {
        tempnum = "      " + tempnum;
    }
    if (tempnum.length == 6) {
        tempnum = "       " + tempnum;
    }
    if (tempnum.length == 5) {
        tempnum = "        " + tempnum;
    }
    if (tempnum.length == 3) {
        tempnum = "          " + tempnum;
    }
    if (tempnum.length == 2) {
        tempnum = "           " + tempnum;
    }
    if (tempnum.length == 1) {
        tempnum = "            " + tempnum;
    }
    
        
    return tempnum;
}

function startZeroDCounter(path) {
    var now = new Date(),
    newyears = new Date("January 1, 2000");
    newyears.setFullYear(now.getFullYear( ));
    if (path == "world")
	secsSince = worldCutFactor * ( now.getTime( ) - newyears.getTime( ) ) / 1000;
    else
	secsSince = cutFactor * ( now.getTime( ) - newyears.getTime( ) ) / 1000;

    document.zd_compteur_007.mcarre.value=  toString(secsSince);

//document.getElementById("counter").align =  alignement;
    timerID = setTimeout("startZeroDCounter('"+path+"')", 1);
    timerRunning = true;
}

