var UEL;
if (!UEL) UEL = {};

//If not empty the message is displayed whenever UELDirect link is clicked (only when JavaScript is enabled).
UEL.UELDirectMessage = 'Please Note: Due to high volume of users attempting to log in you may encounter difficulties logging into UEL Direct, please try again if you should encounter any problems.';

//
/* COF - UEL Direct Error Messages to be used as appropriate */
/* Please Note: We are currently experiencing problems with UEL Direct. IT Services are working to resolve this problem and we apologise for any inconvenience caused. */

/* Please Note: Due to high volume of users attempting to log in you may encounter difficulties logging into UEL Direct, please try again if you should encounter any problems. */

/* Please Note: Due to essential maintenance being carried out on the student records system, access will be restricted to WebCT, Web Mail and ECDL from 21:00 on Wednesday 19th October to 09:00 Monday 24 October 2005. Please accept our apologies for any inconvenience that this may cause. */
/*Please Note: As a consequence of the Planned Power Outages across the Docklands Campus on Sunday the 10th of July there will be there will be no network services available between the hours of 08:00 and 20:00. This means that you will not be able to access services such as UEL Direct and UEL Plus. Please accept our apologies for any inconvenience that this may cause.*/

UEL.class_Menus =  function () {
	$(document).ready(function () {
		//UEL Direct
		if (UEL.UELDirectMessage != ''){
			$('#menu__UELDirect a').click(function(){
				alert(UEL.UELDirectMessage);
			});
		}
		//
		//var Art = $('#section_Artwork');
		//if (Art.text() == '') Art.click(function(){document.location = String(document.location);});
		//
		$("#menu_Section li:has(.menu_Subsection)").each(function () {
			var $this = $(this);
			if ($this.children('.Current').size() < 1) {
				this.uel = {
					isOpen: false,
					menu: $this.children('.menu_Subsection')
				};
				this.uel.menu.hide().removeClass('menu_Hidden');
				$this.addClass('CollapsiblePanelClosed').addClass('menu_Closed');
				$this.click(function () {
					var $this = $(this);
					this.uel.isOpen = !this.uel.isOpen;
					if (this.uel.isOpen) {
						this.uel.menu.show("fast");
						$this.removeClass('CollapsiblePanelClosed').removeClass('menu_Closed');
						$this.addClass('CollapsiblePanelOpen').addClass('menu_Open');
					} else {
						this.uel.menu.hide("fast");
						$this.removeClass('CollapsiblePanelOpen').removeClass('menu_Open');
						$this.addClass('CollapsiblePanelClosed').addClass('menu_Closed');
					}
					return true;
				});
			}
		});
		//initialise bookmark toolbar
		try {
			$('#menu__Bookmark').bookmark({
				compact: false,
				icons: '/_artwork/bookmarks.png',
				popup: true,
				addFavorite: true,
				sites: ['facebook', 'delicious', 'myspace', 'digg', 'live', 'google', 'reddit'],
				popupText: '<img src="/_artwork/bookmark_placeholder.gif" width="125" height="16" align="absbottom" alt="Bookmark this page" />&nbsp;'
			});
		} catch (e) {
		}
		//
		try {
			if (spry_Tabs != null) {
				var Anchor = String(document.location);
				Anchor = Anchor.substr(Anchor.indexOf('#'));
				var parent = $('.TabbedPanelsContent:has(a'+Anchor+')');
				var i = parent.parent().children().index( parent );
				if (i >=0) spry_Tabs.showPanel(i);
			}
		} catch (e) {
		}
	});
}
if (!UEL.Menus) UEL.Menus = new UEL.class_Menus();
