//datastart
var MenuOrder = new Array("0","1","1","1","1","1","1","1","1","1","1","1","1","1","2","2","2","2","2","2","2","2","2","2","2","3","3","3","4","4","4","4","4","4","5","5","5","5","5","5","6","6");
var MenuItem = new Array("","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Pontypool G.C.","Teams/Sections","Teams/Sections","Teams/Sections","Teams/Sections","Teams/Sections","Teams/Sections","Teams/Sections","Teams/Sections","Teams/Sections","Teams/Sections","Teams/Sections","New Membership","New Membership","New Membership","Visitors/Societies","Visitors/Societies","Visitors/Societies","Visitors/Societies","Visitors/Societies","Visitors/Societies","Catering","Catering","Catering","Catering","Catering","Catering","Open Events","Open Events");
var SubMenuOrder = new Array("1","1","2","3","4","5","6","7","8","9","10","11","12","13","1","2","3","6","8","10","11","12","13","15","16","1","2","3","1","2","3","4","5","6","1","2","3","4","5","6","1","2");
var SubMenuItem = new Array("Home Page","Club Details","Fixtures","Facilities","The Course","Social Events","History","Advertisers","Professional Shop","Catering - Members","Bar Hours - Members","Results","Locker Room","Notice Board","Officers","Fixtures/Results","Men Teams","Ladies Teams","Ladies Section","Men Section","Senior","Hallett","Wayfarers","Junior Section","Results","New Membership","Membership Information","Application Forms","Green Fees/Packages","Facilities","The Course","Application Forms","Catering","Bar Hours","Function Facilities","Members","Weddings","Christmas Menus","Buffets etc.","Member Bar Hours","Years Open Events","Application Forms");
var Href = new Array("main1.html","engdoc/details.html","engdoc/fixtures.html","engdoc/facil.html","engdoc/course.html","engdoc/accom.html","engdoc/history.html","engdoc/sponsors.html","engdoc/proshop.html","engdoc/funcroom/funcmemb.html","engdoc/funcroom/funcbar.html","engdoc/results.html","lockerroom/php/pages.php?pg=1","engdoc/notice.html","engdoc/teams.html","engdoc/fixtures.html","engdoc/mteams.html","engdoc/lteams.html","engdoc/lfteam.html","engdoc/otherfix.html","engdoc/seniors.html","engdoc/halletts.html","engdoc/wayfars.html","juniors/index.htm","engdoc/results.html","engdoc/membship.html","engdoc/membinfo.html","engdoc/appforms.html","engdoc/visit.html","engdoc/facil.html","engdoc/course.html","engdoc/appforms.html","engdoc/funcroom/funcmemb.html","engdoc/funcroom/funcbar.html","engdoc/funcroom/funcgen.html","engdoc/funcroom/funcmemb.html","engdoc/funcroom/funcwed.html","engdoc/funcroom/funcchris.html","engdoc/funcroom/funcinformal.html","engdoc/funcroom/funcbar.html","engdoc/oweek.html","engdoc/appforms.html");
var Title = new Array("Back to the home page.","Details of the Officers of the Club.","Fixtures for all competitions. Results of club com","Facilities offered by the Club.","Photographs of the layout of the course.","Details of forthcoming social events.","History of the Club.","","","","","Results of competitions etc.","Club magazine","Members notice board","Officers of the various teams and sections.","Fixtures for all competitions. Results of club competitions.","","","","","","","","Link to Junior section - worth a visit.","Results of competitions etc.","","Information for new and present members","","Information to intended  visitors to the course.","","","","","","","","","","","","","");
var Target = new Array("mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage","mainpage");
//dataend

// use a menu css script with this code e.g menunpqh.css
/*
var heads = new Array(Title.length+1);
var menu_exposed = new Array(Title.length+1);
var mobjs = new Array(Title.length+1);
*/
var objtemp=null;
var m;
/*
for(i=0; i<=Title.length;i++){
	menu_exposed[i] = false;
}
*/


// for netscape

if(typeof HTMLElement!="undefined" && !
HTMLElement.prototype.insertAdjacentElement){
	HTMLElement.prototype.insertAdjacentElement = function
(where,parsedNode)
	{
		switch (where){
		case 'beforeBegin':
			this.parentNode.insertBefore(parsedNode,this)
			break;
		case 'afterBegin':
			this.insertBefore(parsedNode,this.firstChild);
			break;
		case 'beforeEnd':
			this.appendChild(parsedNode);
			break;
		case 'afterEnd':
			if (this.nextSibling) 
this.parentNode.insertBefore(parsedNode,this.nextSibling);
			else this.parentNode.appendChild(parsedNode);
			break;
		}
	}

	HTMLElement.prototype.insertAdjacentHTML = function
(where,htmlStr)
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	}


	HTMLElement.prototype.insertAdjacentText = function
(where,txtStr)
	{
		var parsedText = document.createTextNode(txtStr)
		this.insertAdjacentElement(where,parsedText)
	}
}

m=-1;
function showItems(obj, x){
//	alert(obj.id);
	if(obj.id=="menuitems"){
				m=1;	
			}	
			else{
				m--;
			}

/*   
	if(document.all){
   //thisbrowser="ie"
    	
			if(m<0){
			if(!document.all["t"+x]){
				temp = '<div id="t' + x + '">' + document.all[obj.id+x+"_items"].innerHTML + '</div>';

				obj.insertAdjacentHTML("BeforeEnd", temp);
				obj.children[0].src="images/minus.gif";
				obj.children[0].alt="Click to collapse.";
				
  		}
  		else{
				document.all["t"+x].outerHTML = "";
				obj.children[0].src="images/plus.gif";
				obj.children[0].alt="Click to show more.";
				}
				}
		
 }
 if(!document.all && document.getElementById){
	*/
		if(m<0){
  	
		if(!document.getElementById("t"+x)){
				
				temp= '<div id="t' + x + '">' + document.getElementById(obj.id+x+"_items").innerHTML + '</div>';
		//		obj.insertAdjacentHTML('beforeEnd', temp);
		    obj.innerHTML += temp;
				document.getElementById("image" + x).src="images/minus.gif";
	      document.getElementById("image" + x).alt="Click to collapse.";
  		}
  		else{
        document.getElementById("t"+x).innerHTML = ""; // outerHTML doesn't work

        temp='<div id="t' + x + '"></div>'; // remove tx element
				
				obj.innerHTML = obj.innerHTML.substring(0, obj.innerHTML.length-temp.length);	
				document.getElementById("image" + x).src="images/plus.gif";
	      document.getElementById("image" + x).alt="Click to show more.";
  		}
	//	}
	}

}


function mSel(obj, ind){
var xTag;

/*	if(document.all){	
		if(objtemp!=null){
		 		xTag = document.all.item(objtemp.id);
				
				if(xTag.length!=2){
					objtemp=obj;
				}
				else{
					xTag[0].style.background='#ffffff';
					objtemp=obj;
				}
		}
		else{
			objtemp=obj;
		}
		}
		if(!document.all && document.getElementById){
	*/
			if(objtemp!=null){
		 		xTag = document.getElementById(objtemp.id);
	
				if(xTag.id==obj.id){
					objtemp=obj;
				}
				else{
					xTag.style.background='#ffffff';
					objtemp=obj;
				}
		}
		else{
			objtemp=obj;
		}
	//	}
		
}
function mOver(obj){
  
	 obj.style.background='#ddffff';
	
}
function mOut(obj){
/*  if(document.all){	
	if(objtemp!=null){

		if(obj.id==objtemp.id){	
			obj.style.background='#aaffff';
		}
		else{
			obj.style.background='#ffffff';
		}
	}
	else{
			 obj.style.background='#ffffff';
	}
	}
	if(!document.all && document.getElementById){
*/	if(objtemp!=null){
		if(obj.id==objtemp.id){
			obj.style.background='#aaffff';
		}
		else{
			obj.style.background='#ffffff';
		}
	}
	else{
			 obj.style.background='#ffffff';
	 }
//	}
		
}
function mOverMenu(obj){
//  obj.style.color='#00dddd';
	obj.style.color='#0000cc'; 
}
function mOutMenu(obj){
//  obj.style.color='#dddddd'; 
	obj.style.color='#aa0000';
}

function theMenu(){
	var i, x=0, y=0;
	var temp = "xyz", temp1="";

	for (i = 0; MenuItem.length>i ; i++){
		
		if(temp!=MenuItem[i]){
			if(i!=0){
				document.write('</div></div>');
			}
			if(MenuItem[i]!=""){
				temp1 = '<div id="menu"';
				temp1 = temp1 + ' onclick="showItems(this, ' + (x+1) + ')"';
				temp1 = temp1 + ' onmouseover="mOverMenu(this)"';
				temp1 = temp1 + ' onmouseout="mOutMenu(this)">';
				document.write(temp1);
				temp1 = '<img id="image' + (x+1) + '"'; 
				temp1 = temp1 + ' hspace="0" src="images/plus.gif"';
				temp1 = temp1 + ' alt="Click to show more." align="left"';
				temp1 = temp1 + ' class="plus"></img>';
				
				document.write(temp1);
				temp1 = MenuItem[i] +'</div>';
				document.write(temp1);
			  document.write('<div id="menu' + (x+1) + '_items" style="display: none">');
			}
			  document.write('<div id="menuitems"  onclick="showItems(this, '+ (x+1)  + ')">');
				
	/*		 if(document.all){
				temp1 = '<a id = "' + i + '"';
				temp1 = temp1 + ' class = "submenu" href="' + Href[i] + '"';
				temp1 = temp1 + ' target="' + Target[i] +'" title="' + Title[i] + '"';
				temp1 = temp1 + '  onmouseover="mOver(this);"';
				temp1 = temp1 + ' onmouseout="mOut(this);"';
				temp1 = temp1 + ' onclick="mSel(this, ' + i + ' );">';
				temp1 = temp1 + SubMenuItem[i] + '</a>';
				document.write(temp1);

			}
			 if(!document.all && document.getElementById){
	*/			temp1 = '<a  id="menulinknet"';
				temp1 = temp1 + ' href="' + Href[i] + '" target="' + Target[i] + '"';
				temp1 = temp1 + ' title="' + Title[i] +  '">';
				temp1 = temp1 + '<div id= "' + i + '" class = "submenunet"';
				temp1 = temp1 + '  onmouseover="mOver(this);"';
				temp1 = temp1 + ' onmouseout="mOut(this);"';
				temp1 = temp1 + ' onclick="mSel(this, ' + i + ' );">';
				temp1 = temp1 + SubMenuItem[i] + '</div></a>';
				document.write(temp1);
		//	}
			temp=MenuItem[i];
			x++;
			
		}
	else{
	/*		if(document.all){
				temp1 = '<a id = "' + i + '"';
				temp1 = temp1 + ' class = "submenu" href="' + Href[i] + '"';
				temp1 = temp1 + ' target="' + Target[i] +'" title="' + Title[i] + '"';
				temp1 = temp1 + '  onmouseover="mOver(this);"';
				temp1 = temp1 + ' onmouseout="mOut(this);"';
				temp1 = temp1 + ' onclick="mSel(this, ' + i + ' );">';
				temp1 = temp1 + SubMenuItem[i] + '</a>';
				document.write(temp1);
			}
			 if(!document.all && document.getElementById){
	*/			temp1 = '<a  id="menulinknet"';
				temp1 = temp1 + ' href="' + Href[i] + '" target="' + Target[i] + '"';
				temp1 = temp1 + ' title="' + Title[i] +  '">';
				temp1 = temp1 + '<div id= "' + i + '" class = "submenunet"';
				temp1 = temp1 + '  onmouseover="mOver(this);"';
				temp1 = temp1 + ' onmouseout="mOut(this);"';
				temp1 = temp1 + ' onclick="mSel(this, ' + i + ' );">';
				temp1 = temp1 + SubMenuItem[i] + '</div></a>';
				document.write(temp1);
		//	}
	}
	}
	document.write('</div></div>');
}

