var baseref = "http://www.rc.net/southwark/dartford/new/"; // LIVE

// menu literals and arrays

var menuHinner = new Array 
("Home"
,"Our Churches"
,"Our Parish"
,"Mass Times"
,"Weekly Schedule"
,"Events"
,"Useful Information"
,"We can help you"
,"You can help us"
,"Contact Us"
);

var menuHhrefs = new Array 
("main.html"
,"churches.html"
,"parish.html"
,"masstimes.html"
,"schedule.html"
,"events.html"
,"useful.html"
,"helpyou.html"
,"helpus.html"
,"contact.html"
);

var menuHtitles = new Array 
("Click here to return to our home page"
,"Click here to find out more about our churches"
,"Click here to find out more about our parish"
,"Click here for mass times here and in other nearby parishes"
,"Click here for the weekly schedule of activities in the parish"
,"Click here for information on various events"
,"Click here for useful information"
,"Click here if you need help from the parish team"
,"Click here if you can help the parish team"
,"Click here to get in touch with us"
);

var menuPinner = new Array 
("Parish Priest"
,"Parish Team"
,"Altar Servers"
,"Primary School"
,"Parish Centre"
,"Parish Choir"
,"Folk Group"
,"Music Group"
,"Youth Group"
,"Sacraments"
);

var menuPhrefs = new Array 
("parish/parteam.html"
,"parish/parteam.html"
,"groups/altarserver.html"
,"ourladys.html"
,"parish/centre.html"
,"groups/choir.html"
,"groups/folkgroup.html"
,"groups/musicgroup.html"
,"groups/youthgroup.html"
,"parish/sacraments.html"
);

var menuPtitles = new Array 
("Click here to find out about our parish priest"
,"Click here for details of the parish team"
,"Click here to find out about our altar servers"
,"Click here for details of our Primary School"
,"Click here for details of the parish centre"
,"Click here for details of the parish choir"
,"Click here for details of the folk group"
,"Click here for details of St George\'s music group"
,"Click here for more details of the youth group"
,"Click here for more details of the sacraments"
);

var menuMinner = new Array 
("Further Afield"
);

var menuMhrefs = new Array 
("events/afield.html"
);

var menuMtitles = new Array 
("Click here for mass times in other nearby parishes"
);

var menuEinner = new Array 
("Past Events"
,"Parish Mission"
);

var menuEhrefs = new Array 
("events/archive.html"
,"mission.html"
);

var menuEtitles = new Array 
("Click here for past events"
,"Click here for mission information"
);

var menuIinner = new Array 
("Parish Centre"
,"Parish History"
,"St. Anselm"
,"St. George"
,"Reference"
,"Links"
);

var menuIhrefs = new Array 
("parish/centre.html"
,"info/history.html"
,"info/stanselm.html"
,"info/stgeorge.html"
,"info/reference.html"
,"info/links.html"
);

var menuItitles = new Array 
("Click here for details of the parish centre"
,"Click here for a brief history of the parish"
,"Click here for a short biography of St Anselm"
,"Click here for a short biography of St George"
,"Click here for various links to reference material"
,"Click here for links to other web sites"
);

var menuYinner = new Array 
("Bereavement"
,"Senior parishioners"
,"Sick parishioners"
,"Young Adults"
);

var menuYhrefs = new Array 
("parish/bereavement.html"
,"parish/older.html"
,"parish/sick.html"
,"parish/young.html"
);

var menuYtitles = new Array 
("Click here for details of our Bereavement Care Team"
,"Click for details of our Senior Parishioners group"
,"Click here for more information about support for sick parishioners"
,"Click here for details of our Young Adults group"
);

var menuCinner = new Array 
("Guestbook"
);

var menuChrefs = new Array 
("contacts/guestbook.html"
);

var menuCtitles = new Array 
("Click here to view or add to the guestbook"
);


function AP_menu(opt) { //v1.0
var mref=document.getElementById('menu');

show_menu_head(mref,0,(opt=="Home"));
show_menu_head(mref,1,(opt=="Church"));
show_menu_head(mref,2,(opt=="Parish"),menuPinner,menuPhrefs,menuPtitles);
show_menu_head(mref,3,(opt=="Mass"),menuMinner,menuMhrefs,menuMtitles);
show_menu_head(mref,4,(opt=="Week"));
show_menu_head(mref,5,(opt=="Event"),menuEinner,menuEhrefs,menuEtitles);
show_menu_head(mref,6,(opt=="Info"),menuIinner,menuIhrefs,menuItitles);
show_menu_head(mref,7,(opt=="You"),menuYinner,menuYhrefs,menuYtitles);
show_menu_head(mref,8,(opt=="Us"));
show_menu_head(mref,9,(opt=="Contact"),menuCinner,menuChrefs,menuCtitles);
}

function show_menu_head(dv,ind,op,si,sh,st) {
	var mp,ma,sind;
	mp=document.createElement('p');
	mp.className = "menu";
	ma=document.createElement('a');
	if (op) {ma.className = "menu chosen";}
	else    {ma.className = "menu";}
	ma.href = baseref+menuHhrefs[ind];
	ma.title = menuHtitles[ind];
	ma.innerHTML = menuHinner[ind];
	mp.appendChild(ma);
	dv.appendChild(mp);
	if (op) { // sub-menu
		if (si) {
			for (sind in si)
				{show_submenu(dv,sind,si,sh,st);}
		}
	}
}

function show_submenu(dv,ind,si,sh,st) {
	var mp,ma;
	mp=document.createElement('p');
	mp.className = "submenu";
	ma=document.createElement('a');
	ma.className = "submenu";
	ma.href = baseref+sh[ind];
	ma.title = st[ind];
	ma.innerHTML = si[ind];
	mp.appendChild(ma);
	dv.appendChild(mp);
}


function AP_SAAddress(nm,tx) { //v1.0
  wibble=nm;
  wibble=(wibble + '&#064;');
  wibble=(wibble + 'google');
  wibble=(wibble + 'mail');
  wibble=(wibble + '.');
  wibble=(wibble + 'com');
  wobble='a href="mail';
  if (tx) {cltx = tx} else {cltx = wibble}
  document.write('<' + wobble + 'to:' + wibble + '">' + tx + '</a>');
}
