﻿var a = 1;
var x1 = 0;
var submitOK = "true";
var va = 9;

function men1() {
    document.getElementById("tab1").rows[1].cells[0].className = "c21";
}
function men1o() {
    document.getElementById("tab1").rows[1].cells[0].className = "c11";
}
function men1c() {
    window.location.assign("index.html");
}

function men2() {
    document.getElementById("tab1").rows[2].cells[0].className = "c21";
}
function men2o() {
    document.getElementById("tab1").rows[2].cells[0].className = "c11";
}
function men2c() {
    window.location.assign("products.html");
}

function men3() {
    document.getElementById("tab1").rows[3].cells[0].className = "c21";
}
function men3o() {
    document.getElementById("tab1").rows[3].cells[0].className = "c11";
}
function men3c() {
    window.location.assign("info.html");
}

function men4() {
    document.getElementById("tab1").rows[4].cells[0].className = "c21";
}
function men4o() {
    document.getElementById("tab1").rows[4].cells[0].className = "c11";
}
function men4c() {
    window.location.assign("news.html");
}

function men5() {
    document.getElementById("tab1").rows[5].cells[0].className = "c21";
}
function men5o() {
    document.getElementById("tab1").rows[5].cells[0].className = "c11";
}
function men5c() {
    window.location.assign("business.html");
}
function men6() {
    document.getElementById("tab1").rows[6].cells[0].className = "c21";
}
function men6o() {
    document.getElementById("tab1").rows[6].cells[0].className = "c11";
}
function men6c() {
    window.location.assign("contact.html");
}
function men7() {
    document.getElementById("tab1").rows[7].cells[0].className = "c21";
}
function men7o() {
    document.getElementById("tab1").rows[7].cells[0].className = "c11";
}
function men7c() {
    window.location.assign("francais/index.html");
}
function rbut1() {
    document.getElementById("cont_frm").rows[7].cells[0].innerHTML = "*email:";
}
function rbut2() {
    document.getElementById("cont_frm").rows[7].cells[0].innerHTML = "*Telephone:";
}

function timerout() {
    t = setTimeout("timcount()", 1000);
}

function timcount() {
    if (x1 >= 4) 
    {
        window.location.assign("../index.html");
    }
    else {
        x1++ ;
        document.getElementById("tab1").rows[4].cells[1].innerHTML = (5 - x1);
        timerout();
    }
}

function fvalidate() { }
function validd() {
        submitOK = "True";
        document.getElementById('f1').action = "";
        var fn = document.getElementById('fname').value;
        if (fn != null && fn != "" && fn != "?")
        { document.getElementById("fname").className = ""; }
        else {
            document.getElementById("fname").className = "errbox";
            document.getElementById("fname").value = "?";
            document.getElementById("fname").focus();
            submitOK = "false";
        }

        var t1 = document.getElementById('title').selectedIndex;
        if (t1 != null && t1 != "" && t1 != 0)
        { document.getElementById('title').className = ""; }
        else {
            document.getElementById('title').className = "errbox";
            document.getElementById('title').value = "";
            document.getElementById('title').focus();
            submitOK = "false";
        }  

        var em = document.getElementById('email').value;
        if (em != null && em != "" && em != "?")
        { document.getElementById("email").className = ""; }
        else {
            document.getElementById("email").className = "errbox";
            document.getElementById("email").value = "?";
            document.getElementById("email").focus();
            submitOK = "false";
        }

        var qs = document.getElementById('ques').value;
        if (qs != null && qs != "" && qs != "?")
        { document.getElementById("ques").className = ""; }
        else {
            document.getElementById("ques").className = "errbox";
            document.getElementById("ques").value = "?";
            document.getElementById("ques").focus();
            submitOK = "false";
        }


        var cd = document.getElementById('code1').value;
        var cono = document.getElementById('rcodeimg').src;
        var cono1 = cono.slice(-9);

        var cono2 = "";
        switch (cono1) {
            case "code0.jpg":
                cono2 = "xy3Tao61";
                break;
            case "code1.jpg":
                cono2 = "HeT59itB";
                break;
            case "code2.jpg":
                cono2 = "Y050yCJ";
                break;
            case "code3.jpg":
                cono2 = "R7nV3WM9";
                break;
            case "code4.jpg":
                cono2 = "MMWe6pae";
                break;
            case "code5.jpg":
                cono2 = "4RqekiF2";
                break;
            case "code6.jpg":
                cono2 = "x2Tr21wz";
                break;
            case "code7.jpg":
                cono2 = "9fB3apSw";
                break;
            case "code8.jpg":
                cono2 = "73254180";
                break;
            case "code9.jpg":
                cono2 = "Vvmaew84";
                break;
            case "codea.jpg":
                cono2 = "Novx772H";
                break;

        }


        if (cd != null && cd != "" && cd != "??" && cd === cono2) {
            document.getElementById("code1").className = "";
        }
        else {
            document.getElementById("code1").className = "errbox";
            document.getElementById("code1").value = "";
            document.getElementById("code1").focus();
            alert("Incorrect validation code, please enter again! ");
            submitOK = "false";
            return false;
        }

        if (submitOK == "True") {
            document.getElementById('f1').action = "scripts/m4hrz23tty.php";
            document.getElementById('f1').submit();
        }
        else {
            alert("Please provide the information required:");
            return false;
        }
}

function randcode() {
    var ra = Math.floor(Math.random() * 11);
    if (ra > 9) { ra = "a"; }
    document.getElementById("rcodeimg").src = "images/code" + ra + ".jpg";
    if (ra == 3 || ra == 4) {
        document.getElementById('rcodeimg').height = "149";
        document.getElementById('rcodeimg').width = "59";
    }
    else {
        document.getElementById('rcodeimg').height = "49";
        document.getElementById('rcodeimg').width = "139";
    }
}

function bfrm() {
    window.location.assign("contact_form.html");
}
