// this is the drop down menu - the submenus drop down when the item is clicked on
function checkMenu(menuno,parentitem,topcount,allparents) {
	var menuno = menuno;
	menu = 'menu' + menuno;
    menuexists = document.getElementById(menu);
	buttonimg = 'buttonarrow' + menuno;
	yellowbuttonimg = 'buttonarrowy' + menuno;
	bluebuttonimg = 'buttonarrowb' + menuno;
	whitebuttonimg = 'buttonarroww' + menuno;
	clubbuttonimg = 'clubbuttonarrow' + menuno;
	arrowtext = 'arrow' + menuno;
    arrowexists = document.getElementById(buttonimg);
    yellowarrowexists = document.getElementById(yellowbuttonimg);
    bluearrowexists = document.getElementById(bluebuttonimg);
    whitearrowexists = document.getElementById(whitebuttonimg);
    clubarrowexists = document.getElementById(clubbuttonimg);
    arrowtextexists = document.getElementById(arrowtext);
	if (menuexists != null) {
		if (document.getElementById(menu).style.display == "block") {
   			//document.getElementById(menu).style.visibility = 'hidden';
   			document.getElementById(menu).style.display = "none";
			if (arrowexists != null) {
   				document.getElementById(buttonimg).src = "/res/images/layout/buttonarrowright.gif";
			}
			if (yellowarrowexists != null) {
   				document.getElementById(yellowbuttonimg).src = "/res/images/layout/buttonarrowright_yellow.gif";
			}
			if (bluearrowexists != null) {
   				document.getElementById(bluebuttonimg).src = "/res/images/layout/buttonarrowright_blue.gif";
			}
			if (whitearrowexists != null) {
   				document.getElementById(whitebuttonimg).src = "/res/images/layout/buttonarrowright_white.gif";
			}
			if (clubarrowexists != null) {
   				document.getElementById(clubbuttonimg).src = "/res/images/layout/ssc/buttonarrowright.gif";
			}
			if (arrowtextexists != null) {
   				document.getElementById(arrowtext).innerHTML = "&#8658;";
			}
		} else {
   			//document.getElementById(menu).style.visibility = 'visible';
   			document.getElementById(menu).style.display = "block";
			if (arrowexists != null) {
   				document.getElementById(buttonimg).src = "/res/images/layout/buttonarrowdown.gif";
			}
			if (yellowarrowexists != null) {
   				document.getElementById(yellowbuttonimg).src = "/res/images/layout/buttonarrowdown_yellow.gif";
			}
			if (bluearrowexists != null) {
   				document.getElementById(bluebuttonimg).src = "/res/images/layout/buttonarrowdown_blue.gif";
			}
			if (whitearrowexists != null) {
   				document.getElementById(whitebuttonimg).src = "/res/images/layout/buttonarrowdown_white.gif";
			}
			if (clubarrowexists != null) {
   				document.getElementById(clubbuttonimg).src = "/res/images/layout/ssc/buttonarrowdown.gif";
			}
			if (arrowtextexists != null) {
   				document.getElementById(arrowtext).innerHTML = "&#8659;";
			}
		}
	}
}

function openMenu() {
	var menuList = document.menuform.menuopen.value;
	var opencount = document.menuform.opencount.value;
	var separateitems = menuList.split(",");
	loopcount = 0;
	while (loopcount < opencount) {
		var menuno = separateitems[loopcount];
		var menu = 'menu' + menuno;
    	menuexists = document.getElementById(menu);
		if (menuexists != null) {
			buttonimg = 'buttonarrow' + menuno;
			yellowbuttonimg = 'buttonarrowy' + menuno;
			bluebuttonimg = 'buttonarrowb' + menuno;
			whitebuttonimg = 'buttonarroww' + menuno;
			clubbuttonimg = 'clubbuttonarrow' + menuno;
			arrowtext = 'arrow' + menuno;
			arrowexists = document.getElementById(buttonimg);
   			yellowarrowexists = document.getElementById(yellowbuttonimg);
			bluearrowexists = document.getElementById(bluebuttonimg);
			whitearrowexists = document.getElementById(whitebuttonimg);
			clubarrowexists = document.getElementById(clubbuttonimg);
   			 arrowtextexists = document.getElementById(arrowtext);
   			document.getElementById(menu).style.display = "block";
			if (arrowexists != null) {
   				document.getElementById(buttonimg).src = "/res/images/layout/buttonarrowdown.gif";
			}
			if (yellowarrowexists != null) {
   				document.getElementById(yellowbuttonimg).src = "/res/images/layout/buttonarrowdown_yellow.gif";
			}
			if (bluearrowexists != null) {
   				document.getElementById(bluebuttonimg).src = "/res/images/layout/buttonarrowdown_blue.gif";
			}
			if (whitearrowexists != null) {
   				document.getElementById(whitebuttonimg).src = "/res/images/layout/buttonarrowdown_white.gif";
			}
			if (clubarrowexists != null) {
   				document.getElementById(clubbuttonimg).src = "/res/images/layout/ssc/buttonarrowdown.gif";
			}
			if (arrowtextexists != null) {
   				document.getElementById(arrowtext).innerHTML = "&#8659;";
			}
		}
		loopcount = loopcount + 1;
	}
}

