﻿function showMenu(menuID) {
    var allMenus = new Array('services', 'aboutUs', 'newsletters', 'contact');

    for (var i=0; i<allMenus.length; i++) {
        var item = document.getElementById(allMenus[i]);
        if (item) {
            item.className = "submenu hidden";
        }
        item = document.getElementById(allMenus[i] + "Link");
        if (item) {
            item.className = "";
        }
    }
    
    var item = document.getElementById(menuID);
    if (item) {
        item.className = "submenu";
    }
    item = document.getElementById(menuID + "Link");
    if (item) {
        item.className = "highlight";
    }
}   
    
function showCategory(categoryID) {
    var allCategories = document.getElementById("lstCategory");
    
    for (var i=0; i<allCategories.length; i++) {
        var curID = allCategories[i].value;
        var item = document.getElementById(curID);
        if (item) {
            item.className = "newsletters hidden";
        }
    }
    
    var item = document.getElementById(categoryID);
    if (item) {
        item.className = "newsletters";
    }
}

function checkContactForm() {
    var allFields = new Array('txtName',  'txtEmail', 'txtPhone', 'txtComments');
    for (var i=0; i<allFields.length; i++) {
        if (document.contactForm[allFields[i]].value.length < 1) {
            alert("Please fill in all the fields.");
            document.contactForm[allFields[i]].focus();
            return false;
        }
    }            
    return true;
}

function checkInitialInterview() {
    var allFields = new Array('Client_Name',  'Client_EMail_Address', 'Electronic_Signature');
    for (var i=0; i<allFields.length; i++) {
        if (document.contactForm[allFields[i]].value.length < 1) {
            alert("Please fill in all the fields.");
            document.contactForm[allFields[i]].focus();
            return false;
        }
    }         
    return true;
}

function checkDivorceConsultation() {
    var allFields = new Array('T4');
    for (var i=0; i<allFields.length; i++) {
        if (document.contactForm[allFields[i]].value.length < 1) {
            alert("Please fill in all the fields.");
            document.contactForm[allFields[i]].focus();
            return false;
        }
    }         
    return true;
}

function checkPersonalInjury() {
    var allFields = new Array('T3');
    for (var i=0; i<allFields.length; i++) {
        if (document.contactForm[allFields[i]].value.length < 1) {
            alert("Please fill in all the fields.");
            document.contactForm[allFields[i]].focus();
            return false;
        }
    }         
    return true;
}

function checkEstate() {
    var allFields = new Array('T7');
    for (var i=0; i<allFields.length; i++) {
        if (document.contactForm[allFields[i]].value.length < 1) {
            alert("Please fill in all the fields.");
            document.contactForm[allFields[i]].focus();
            return false;
        }
    }         
    return true;
}