function jumpto(where) {
    if (where=="aide") {
        openAide();
    } else {
    window.document.location = "/" + where + ".php";
}
}

function openTailles() {
    winTailles = window.open('/tailles.html',
                             'Tailles',
                             'width=556,height=202,scrollbars=no');
}

function openAide() {
    winAide = window.open('/aide.htm','AIDE','width=650,height=500,scrollbars=yes');
}
function checkBrowser() {
    this.ver = navigator.appVersion;
    this.dom = document.getElementById ? 1 : 0;
    this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ie4mac=this.ie4 && navigator.userAgent.indexOf("Mac")>-1;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) && !this.ie4mac;
    
    return this
}


bw = new checkBrowser();

var useFlash = 0;

if (navigator.plugins) {
    numPlugins = navigator.plugins.length;
    for (i = 0; i < numPlugins; i++) {
        plugin = navigator.plugins[i];
        if (plugin.description.indexOf("Shockwave Flash") != -1) {
            ind = plugin.description.lastIndexOf("Flash") + 5;
            version = plugin.description.substr(ind,plugin.description.length);
            version = parseInt(version);
            useFlash = (parseInt(version) >= 4) ?1:0;
        }
    }
}

function addArtikelArray(artArray) {
    if(artArray[0] == false) {
        return false;
    }
    
    this.addArtikel(artArray[0], artArray[1], artArray[2], artArray[3], artArray[4], artArray[5], artArray[6]);
}

function openWinArtikelInfo(artArray) {
    openWin('./shop/?artnr='+artArray[0], '100%', '100%', 'main');
}

function openWinArtikelInfo(artArray) {
    if(artArray[0] == false) {
        return false;
    }
    
    openWin('./article.php?artnr='+artArray[0], '100%', '100%', 'main');
}

var message="";
function clickIE(){
    if (document.all) {(message);return false;}
}

function clickNS(e){
    if  (document.layers||(document.getElementById&&!document.all)){
        if (e.which==2||e.which==3){
            (message);
            return false;
        }
    }
}

if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS;
} else {
document.onmouseup=clickNS;document.oncontextmenu=clickIE;
}

function Launch(page) {
    OpenWin = this.open(page,
        "Maxiscoot",
        "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=565,height=550");
}

function remove(prod) {
    document.myform.action.value = "update";
    eval("document.myform.quantite"+ prod +".value = 0");
    document.myform.submit();
}

function update() {
    document.myform.action.value = "update";
    document.myform.submit();
}

function checkNewsletterForm(objForm) {
    if (!checkNewsletterSyntax(objForm.email.value)) {
        alert("Vous devez saisir une adresse e-mail valide !");
        return false;
    }
    return true;
}

function checkNewsletterSyntax(emailadr) {
    var atpos=emailadr.indexOf("@");
    var ptpos=emailadr.lastIndexOf(".");
    var blpos=emailadr.indexOf(" ");
    if (atpos==-1 || ptpos ==-1 || ptpos < atpos || blpos!= -1) {
        return false;
    }
    return true;
}

function openCGV() {
    winCGV = window.open('cgv.htm','CGV','width=600,height=400,scrollbars=yes');
}

function openWin() {
    winCGV = window.open('win.htm','WIN','width=600,height=400,scrollbars=yes');
}


function validateHomologation(){
    if(!document.myform.homologation.checked) {
        alert("accepter les termes?");
    } else {
        document.myform.submit();
    }
}

function submitMyForm(){
    document.myform.submit();
}

function submitForm(formId) {
    $(formId).submit();
}

function commande() {
    document.myform.submit();
}

function popup(link,name,size) {
    newwin = window.open(link,name,size);
}

function popupVacation()  {
    var w = 300;
    var h = 200;
    
    if (parseInt(navigator.appVersion)>=4) {
            xOff = (screen.width-w)/2;
            yOff = (screen.height-h)/2;
            xOff += 106;
            yOff -= 30;
    }
        
    popUp = window.open("vac.htm","pop",'toolbar=no,status=no,location=no,directories=no,resizable=no,scrollbars=no,width='+w+',height='+h+',left='+xOff+',top='+yOff);        
}
    
function continuer() {
    if (document.validation.mode.length) {
            test = document.validation.mode[0].checked;
    } else {
            test = document.validation.mode.checked;
    }
    
    if (!test) {
        document.validation.submit();
    } else if (verifie()) {
        document.validation.submit();
    }
}

function verifie() {
    var N=document.validation.numero.value;
    var P=document.validation.porteur.value;
    var A=document.validation.annee.value;
    var M=document.validation.mois.value;
    var T=document.validation.cvc.value;
    
    if (isNaN(N)) {
        alert('Le numéro de votre carte ne doit contenir que des chiffres...');
        return false;
    }
    
    if (N.length!=16) {
        alert('Il faut 16 chiffres à votre numéro de carte...');
        return false;
    }
    
    if (M=='') {
        alert('Merci de choisir le mois d\'expiration de votre carte...');
        return false;
    }
    
    if (A=='') {
        alert('Merci de choisir l\'année d\'expiration de votre carte...');
        return false;
    }
    
    if (P.length<2) {
        alert('Le nom du détenteur de la Carte Bancaire doit comporter au moins' 
            + ' 2 caractères...');
        return false;
    }
    
    if ( T.length!=3 || isNaN(T) ) {
        alert('Le Cryptogramme visuel doit se composer de 3 chiffres' 
            + ' uniquement...');
        return false;
    }
    
    return true;
}
