var Pic = new Array()


function marecherche() {
    f=document.recherche;
    if (f.rech.value=="" || f.rech.value=="mot clef") {
        if (f.sid=="0") {
            alert("veuillez sélectionner un secteur d'activité ou taper un mot clé");
        }
        else {
            document.location='pour-'+f.sid.value+'.html';
        }
    } else {
        if (f.rech.value.length<3) {
            alert("veuillez rentrer un mot clé d'au moins 3 caractères");
        }
        else {
            f.action = "recherche/" + encodeURIComponent(f.rech.value) + ".html";
            f.submit();
        }
    }
}

function isDefined(variable) {
    return (!(!(document.getElementById(variable))))
}

function preloadImages() {
    var d=document;
    if(d.images){
        if(!d.p) d.p=new Array();
        var i,j=d.p.length,a=preloadImages.arguments;
        for(i=0; i<a.length; i++)
            if (a[i].indexOf("#")!=0){
                d.p[j]=new Image;
                d.p[j++].src=a[i];
            }
        }
}


if (typeof(window["Pic"]) != "undefined") {
    // Fonctions de fondu des images

    var slideShowSpeed = 3000
    var crossFadeDuration = 3

    var t
    var j = 0
    var p = Pic.length

    var preLoad = new Array()
    for (i = 0; i < p; i++){
        preLoad[i] = new Image()
        preLoad[i].src = Pic[i]

    }
}


function runSlideShow(){

    if (document.all){
        document.images.SlideShow.style.filter="blendTrans(duration=2)"
        document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
        document.images.SlideShow.filters.blendTrans.Apply()
    }

    document.images.SlideShow.src = preLoad[j].src

    if (document.all){
        document.images.SlideShow.filters.blendTrans.Play()
    }

    j = j + 1

    if (j > (p-1)) j=0
    t = setTimeout('runSlideShow()', slideShowSpeed)
}



function newImage(arg) {
    if (document.images) {
        rslt = new Image();
        rslt.src = arg;
        return rslt;
    }
}

function changeImages() {
    if (document.images && (preloadFlag == true)) {
        for (var i=0; i<changeImages.arguments.length; i+=2) {
            document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
        }
    }
}


function lobj(nom) {
    if (document.layers)zeobj=document.layers[nom];  else zeobj=(document.all && !document.getElementById)?document.all[nom]:document.getElementById(nom);
    return zeobj;
}


function total_commande() {
    totalite=0;
    quantite=0;
    for (i=0;i<document.ref.length;i++)
        if (document.ref.elements[i].name.substr(0,3)=="qte") {
            total_ligne=document.ref.elements[i].value*document.ref.elements[i+1].value;
            totalite=totalite*1+total_ligne;
            quantite=quantite*1+document.ref.elements[i].value*1;
            document.getElementById('t' + document.ref.elements[i + 1].name).innerHTML = total_ligne.toFixed(2);
        }
    document.getElementById('total').innerHTML = totalite.toFixed(2);
//     document.getElementById('qte').innerHTML = quantite;
}

function affiche_zoom(a) {
    document.getElementById('zoomeur').style.display=a;
}

function affiche_p(c) {
    if (c) {
        etat="block";
        etat2="inline";
    } else {
        etat="none";
        etat2="none";
    }
    document.getElementById('discl').style.display=etat2;
    document.getElementById('paiements').style.display=etat2;
//cond=( (document.panier.adid.value>'0' && c) || (document.panier.adid.value=='0' && document.panier.pays.selectedIndex>0) );
//alert((document.panier.adid));
}

function affiche_descopt(opt) {
    if (document.getElementById('sp'+opt).style.display=='none')
        document.getElementById('sp'+opt).style.display='inline';
    else document.getElementById('sp'+opt).style.display='none';
}


hexinputr=0  // Initial color value.
hexinputg=51 // Initial color value.
hexinputb=102  // Initial color value.
var inc=-1 //increment variable

function fadingtext(){
    if(hexinputb<256) {
        hexinputr+=48; // increase color value
        hexinputg+=48; // increase color value
        hexinputb+=48; // increase color value
        document.getElementById("fader").style.color="rgb("+hexinputr+","+hexinputg+","+hexinputb+")"; // Set color value.
        setTimeout("fadingtext()",160);
    }
    else {
        hexinputr=0  // Initial color value.
        hexinputg=51 // Initial color value.
        hexinputb=102  // Initial color value.
    }
}
