﻿
//navigation buttons

sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i = 0; i < sfEls.length; i++) {
        sfEls[i].onmouseover = function() {
            this.className += " sfhover";
        }
        sfEls[i].onmouseout = function() {
            this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//email validation


function emailvalidation_Contact() {

    var emailentered = document.emailForm.Email.value;
    var invEmailalert = document.getElementById('invalidemailalert');

    var at = "@"
    var dot = "."
    var locationat = emailentered.indexOf(at)
    var emaillength = emailentered.length
    var locationdot = emailentered.indexOf(dot)

    if ((emailentered == null) || (emailentered == "")) {
        invEmailalert.innerHTML = "Please Enter your Email Address";
        return false;
    }

    //checks if @ exists or is at the beginning or end of the email address
    if (emailentered.indexOf(at) == -1 || emailentered.indexOf(at) == 0 || emailentered.indexOf(at) == emaillength - 1) {
        invEmailalert.innerHTML = "Invalid Email Address";
        return false;
    }

    //checks if . exists or is at the beginning or end of the email address
    if (emailentered.indexOf(dot) == -1 || emailentered.indexOf(dot) == 0 || emailentered.indexOf(dot) == emaillength - 1) {
        invEmailalert.innerHTML = "Invalid Email Address";
        return false;
    }

    //checks if more than one @ exists in the email address
    if (emailentered.indexOf(at, (locationat + 1)) != -1) {
        invEmailalert.innerHTML = "Invalid Email Address";
        return false;
    }

    //checks if . is beside @ 
    if (emailentered.substring(locationat - 1, locationat) == dot || emailentered.substring(locationat + 1, locationat + 2) == dot) {
        invEmailalert.innerHTML = "Invalid Email Address";
        return false;
    }

    //checks if a . comes after @
    if (emailentered.indexOf(dot, (locationat + 2)) == -1) {
        invEmailalert.innerHTML = "Invalid Email Address";
        return false;
    }


    //checks for blank spaces		
    if (emailentered.indexOf(" ") != -1) {
        invEmailalert.innerHTML = "Invalid Email Address";
        return false;
    }


    return true;


}



//Gallery Larger Image View	

function BigImageShow_03(bigImageSrc, bigImageText) {

    var ShowBigImage = document.getElementById('SF_galleryImage')
    ShowBigImage.src = bigImageSrc;

    var ShowBigImage_Text = document.getElementById('SF_galleryText');
    ShowBigImage_Text.innerHTML = bigImageText;

    //   ShowBigImage_Text.firstChild.nodeValue = bigImageText;

    //        document.getElementById(bigImageWindow).focus();

}
