
function showMenuTest(eventObj) {
	eventObj.cancelBubble = true;
    if(changeObjectVisibility('myMenu', 'visible')) {
	return true;
    } else {
	return false;
    }
}
function hideMenuTest(eventObj) {
	eventObj.cancelBubble = true;
    if(changeObjectVisibility('myMenu', 'hidden')) {
	return true;
    } else {
	return false;
    }
}

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W6C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	//we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

numMenus = 8;
document.onmouseover = hideAllMenusTest;
function showMenuTest(menuNumber, eventObj, labelID) {
    hideAllMenusTest();
	if(document.layers) {
	img = getImage("myImg" + menuNumber);
 	x = getImagePageLeft(img);
 	y = getImagePageTop(img);
 	menuTop = y + 10; // LAYER TOP POSITION
	eval('document.layers["myMenu'+menuNumber+'"].top="'+menuTop+'"');
 	eval('document.layers["myMenu'+menuNumber+'"].left="'+x+'"');
	}
	eventObj.cancelBubble = true;
    var menuId = 'myMenu' + menuNumber;
    if(changeObjectVisibility(menuId, 'visible')) {
	return true;
    } else {
	return false;
    }
}


function hideAllMenusTest() {
    for(counter = 1; counter <= numMenus; counter++) {
	changeObjectVisibility('myMenu' + counter, 'hidden');
    }
}
function submitonce(theform) {
if (document.all||document.getElementById) {
	for (i=0;i<theform.length;i++) {
		var tempobj=theform.elements[i]
		if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
		tempobj.disabled=true
		}
	}
}
function countVowels(inStr) {
	var prevChar = ""
	var curChar = ""
	var nextChar = ""
	var i
	var retVal = 0
	for(i = 0; i < inStr.length; i++) {
		prevChar = curChar
		curChar = inStr.charAt(i)
		if (i < inStr.length - 1)
			nextChar = inStr.charAt(i+1);
                else
                        nextChar = "";
                
                if(prevChar == curChar && curChar == nextChar) {
                        return(0);
                }
                if(curChar == "A" || curChar == "a" ||
                        curChar == "E" || curChar == "e" ||
                        curChar == "I" || curChar == "i" ||
                        curChar == "O" || curChar == "o" ||
                        curChar == "U" || curChar == "u" ||
                        curChar == "Y" || curChar == "y")
                        retVal++;
        }               
        return(retVal)
}
function countConsonants(inStr)
{
        var i
        var retVal = 0
        for(i = 0; i < inStr.length; i++) {
                if(!(inStr.charAt(i) == "A" || inStr.charAt(i) == "a" ||
                        inStr.charAt(i) == "E" || inStr.charAt(i) == "e" ||
                        inStr.charAt(i) == "I" || inStr.charAt(i) == "i" ||
                        inStr.charAt(i) == "O" || inStr.charAt(i) == "o" ||
                        inStr.charAt(i) == "U" || inStr.charAt(i) == "u" ||
                        inStr.charAt(i) == "Y" || inStr.charAt(i) == "y"))
                        retVal++;
        }
        return(retVal)
}
function countLetters(inStr) {
        var i
        var retVal = 0
        for(i = 0; i < inStr.length; i++) {
                if(inStr.charAt(i) == "a" || inStr.charAt(i) == "A" ||
                		inStr.charAt(i) == "b" || inStr.charAt(i) == "B" ||
                        inStr.charAt(i) == "c" || inStr.charAt(i) == "C" ||
                        inStr.charAt(i) == "d" || inStr.charAt(i) == "D" ||
                        inStr.charAt(i) == "e" || inStr.charAt(i) == "E" ||
                        inStr.charAt(i) == "f" || inStr.charAt(i) == "F" ||
                        inStr.charAt(i) == "g" || inStr.charAt(i) == "G" ||
                        inStr.charAt(i) == "h" || inStr.charAt(i) == "H" ||
                        inStr.charAt(i) == "i" || inStr.charAt(i) == "I" ||
                        inStr.charAt(i) == "j" || inStr.charAt(i) == "J" ||
                        inStr.charAt(i) == "k" || inStr.charAt(i) == "K" ||
                        inStr.charAt(i) == "l" || inStr.charAt(i) == "L" ||
                        inStr.charAt(i) == "m" || inStr.charAt(i) == "M" ||
                        inStr.charAt(i) == "n" || inStr.charAt(i) == "N" ||
                        inStr.charAt(i) == "o" || inStr.charAt(i) == "O" ||
                        inStr.charAt(i) == "p" || inStr.charAt(i) == "P" ||
                        inStr.charAt(i) == "q" || inStr.charAt(i) == "Q" ||
                        inStr.charAt(i) == "r" || inStr.charAt(i) == "R" ||
                        inStr.charAt(i) == "s" || inStr.charAt(i) == "S" ||
                        inStr.charAt(i) == "t" || inStr.charAt(i) == "T" ||
                        inStr.charAt(i) == "u" || inStr.charAt(i) == "U" ||
                        inStr.charAt(i) == "v" || inStr.charAt(i) == "V" ||
                        inStr.charAt(i) == "w" || inStr.charAt(i) == "W" ||
                        inStr.charAt(i) == "x" || inStr.charAt(i) == "X" ||
                        inStr.charAt(i) == "y" || inStr.charAt(i) == "Y" ||
	     				inStr.charAt(i) == "z" || inStr.charAt(i) == "Z")
                        retVal++;
        }
        return(retVal)
}
function countDigits(inStr) {
        var i
        var retVal = 0
        
        for(i = 0; i < inStr.length; i++) {
                if(inStr.charAt(i) == "0" || inStr.charAt(i) == "1" ||
                        inStr.charAt(i) == "2" || inStr.charAt(i) == "3" ||
                        inStr.charAt(i) == "4" || inStr.charAt(i) == "5" ||
                        inStr.charAt(i) == "6" || inStr.charAt(i) == "7" ||
                        inStr.charAt(i) == "8" || inStr.charAt(i) == "9")
                        retVal++;
        }
        return(retVal)
}
function filledOut(myForm) {
        var i
        var retVAl
        var atPos
		

// Check for valid firstname
	if(myForm.fullname.value.length < 3) {
		alert("Please provide your full name");
		return(false);
	} else {
		if(countVowels(myForm.fullname.value) == myForm.fullname.value.length || countVowels(myForm.fullname.value) == 0) {
			alert("Please provide your full name");
			return(false);
		}
		if(countConsonants(myForm.fullname.value) == 0) {
			alert("Please provide your full name");
			return(false);
		}
	}
		
// Check for valid phone
	if(countDigits(myForm.telephone.value) < 7) {
		alert("The telephone number that you have entered is invalid");
		return(false);
	}
		
//Check for valid email
	atPos = myForm.email.value.indexOf("@")
	if(!(atPos >= 0 && myForm.email.value.indexOf(".", atPos) >= 0)) {
		alert("The e-mail address that you have entered is invalid");
		return(false);
	}
}