// Preload Nav Images
function preloadNavImages() {
    
    var images_array = new Array('/images/global/nav_item01.gif','/images/global/nav_item01_on.gif','/images/global/nav_item02.gif','/images/global/nav_item02_on.gif','/images/global/nav_item03.gif','/images/global/nav_item03_on.gif','/images/global/nav_item04.gif','/images/global/nav_item04_on.gif','/images/global/nav_item05.gif','/images/global/nav_item05_on.gif','/images/global/nav_item06.gif','/images/global/nav_item06_on.gif','/images/global/nav_item07.gif','/images/global/nav_item07_on.gif','/images/global/nav_item08.gif','/images/global/nav_item08_on.gif','/images/global/nav_item09.gif','/images/global/nav_item09_on.gif','/images/global/nav_item10.gif','/images/global/nav_item10_on.gif');
    
    for(loop = 0; loop < images_array.length; loop++) {
        var an_image = new Image();
        an_image.src = images_array[loop];
    }
    
    //call preload to subnav if exists
    if (typeof(preloadSubnav)=="function") {
        preloadSubnav();
    }
}



function isEmail(email) {
    invalidChars = " ~\'^\`\"*+=\\|][(){}$&!#%/:,;";

    // Check for null
    if (email == "") {
        return true;
    }

    // Check for invalid characters as defined above
    for (i=0; i<invalidChars.length; i++) {
        badChar = invalidChars.charAt(i);
        if (email.indexOf(badChar,0) > -1) {
            return false;
        }
    }
    lengthOfEmail = email.length;
    if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
        return false;
    }
    Pos = email.indexOf("@",1);
    if (email.charAt(Pos + 1) == ".") {
        return false;
    }
    while ((Pos < lengthOfEmail) && ( Pos != -1)) {
        Pos = email.indexOf(".",Pos);
        if (email.charAt(Pos + 1) == ".") {
            return false;
        }
        if (Pos != -1) {
            Pos++;
        }
    }

    // There must be at least one @ symbol
    atPos = email.indexOf("@",1);
    if (atPos == -1) {
        return false;
    }

    // But only ONE @ symbol
    if (email.indexOf("@",atPos+1) != -1) {
        return false;
    }

    // Also check for at least one period after the @ symbol
    periodPos = email.indexOf(".",atPos);
    if (periodPos == -1) {
        return false;
    }
    if (periodPos+3 > email.length) {
        return false;
    }
    return true;
}



function checkforRadio(theForm,q) {
    for (i=0;i<theForm.elements[q].length;i++) {
        if (theForm.elements[q][i].checked==true) {
            //alert(theForm.elements[q][i].value);
            return true;
            break;
        }
    }
    return false;
}


// Match drop down box to selected value
// setSelect(this,value)
function setSelect(theObject,a) {
    //alert(typeof(theObject));
    //if (typeof(theObject)=="object") {
    	for (i=0;i<theObject.options.length;i++) {
    		if (theObject.options[i].value==a) {
    			theObject.selectedIndex=i;
    			break;
    		}
    	}
    //}
}