//file: includes/commonJSScripts.js

/* ************************************************************************************** */

function changeCursor(inOut,curSpan) {
    switch (inOut) {
        case "in"  : eval("document.all." + curSpan + ".style.cursor = 'hand'"); break;
        case "out" : eval("document.all." + curSpan + ".style.cursor = 'pointer'"); break;
    }
}

/* ************************************************************************************** */

function checkData() {
    var email   = contactLynn.emailAddress.value;
    var name    = contactLynn.name.value;
    var nameValid, emailValid = false;
    
    if (name == "") {
        alert("You forgot to enter your name.");
    } else if (email == "") {
        alert("You forgot to enter your e-mail address.");
    } else {
        nameValid = true;
    }
    
    if (email != "") {
        //if (!validateEmail(email)) {
        if (!checkemail()) {
            alert("Your e-mail address appears to be invalid.  Please correct it before continuing.");
        } else {
            emailValid = true;
        }
    }
    
    if ((nameValid) && (emailValid)) {
        alert("Thank you!");
        contactLynn.submit();
    }
}

/* ************************************************************************************** */

var testresults

function checkemail(){
 var str=contactLynn.emailAddress.value
 var filter=/^.+@.+\..{2,3}$/

 if (filter.test(str))
    testresults=true
 else {
    alert("Please input a valid email address!")
    testresults=false
}
 return (testresults);
}

/* ************************************************************************************** */

function openPopUp(strURL,objArgs,strParms) {
    window.open(strURL,objArgs,strParms);
}

/* ************************************************************************************** */

function resetForm() {
    contactLynn.name.value           = "";
    contactLynn.emailAddress.value   = "";
    contactLynn.comment.value        = "";
}

/* ************************************************************************************** */

function showMenuHdr(sectionName) {
    switch (sectionName) {
        case "oncamera"    : document.all.titleBarRight.innerHTML = "on camera"; break;
        case "snapshots"   : document.all.titleBarRight.innerHTML = "snap shots"; break;
        case "soundbytes"  : document.all.titleBarRight.innerHTML = "sound bytes"; break;
        case "resume"      : document.all.titleBarRight.innerHTML = "resume"; break;
        case "bio"         : document.all.titleBarRight.innerHTML = "bio"; break;
        case "contact"     : document.all.titleBarRight.innerHTML = "contact"; break;
        case "home"        : document.all.titleBarRight.innerHTML = "<img src='images/spacer.gif' width='40' height='0' border='0'>"; break;
    }
}

/* ************************************************************************************** */