//--------------------------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------- SITE NAVIGATION ----------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------
// on body load run these functions
//---------------------------------
window.onload = function()
{
    activateMenu('nav');
}

//-----------------------------------------------------------------
// main site navigation / controls style for parent and builds menu  
//-----------------------------------------------------------------
activateMenu = function(nav) {

    /* currentStyle restricts the Javascript to IE6 only */
	if (document.all && document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                   this.firstChild.className="active";
                }
                lis[i].onmouseout=function() {   
                   this.lastChild.style.display="none";
                   this.firstChild.className="sub";
                }
            }
        }
    }
}

//-----------------------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------- CONTACT FORM ----------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------------------------
// make sure only numbers are entered for phone 
//---------------------------------------------
function onlyNumbers(evt) {
    var e = event || evt;
    var charCode = e.which || e.keyCode;

    if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
        return true;
}

    //----------------------------------------------
    // just run standard validation for contact form 
    //----------------------------------------------
    function validation() {
        var errStr = "";
        var errId = "";
        
        if ( document.getElementById("txtName").value == "" ) { errStr += "\n - Fullname"; 
            if (errId=="") { errId = "txtName";} }
        if ( document.getElementById("txtEmail").value == "" ) { errStr += "\n - Email address"; 
            if (errId=="") { errId = "txtEmail";} }
        if ( document.getElementById("txtPhone").value == "" ) { errStr += "\n - Telephone"; 
            if (errId=="") { errId = "txtPhone";} }
        
        if (errStr != "") {
            alert("Please complete the following field(s)\n" + errStr);
            document.getElementById(errId).focus();
            return false;
        }
    }


