// set a default value for the 'page' property
// 0=home, 1=services, 2=about, 3=gallery, 4=awards, 5=newsletter
var page = 0;

// set a default value for the 'depth' property
// The depth property allows a page to set how deep off of root it sits. 
// with this property we can dynamically determine where the images are
var depth = 0;


// Static object for client-side support of ContextNavigation

ContextNavigation = 
{
	CssUnselected:"CNUnselected",
	CssSelected:"CNSelected",
	SelectedItem:null,
	OpenNode:null,
	Init:function(id)
	{
		if(id!=null)
		{
			this.SelectedItem=document.getElementById(id);
			if(this.SelectedItem==null) return;
			this.Toggle(this.SelectedItem,true);
		}
	},
	Toggle:function(o,show)
	{
		//LG:I have put some try/catches in here to prevent javascript error alerts in the
		//case of the menu not initialising. In which case, the toggle part is redundant
		//because there is nothing to toggle with.
		if(show==null)show=o.className.indexOf(this.CssSelected)>=0 ? false:true;
		try{
			if(!show&&this.SelectedItem.parentNode.parentNode==o)
			{
				return;
			} else if (this.SelectedItem.parentNode.parentNode!=o&&this.OpenNode!=o) {
				if(this.OpenNode!=null) this.Toggle(this.OpenNode,false);
				this.OpenNode = o;
			}
		}catch(e)
		{
			this.SelectedItem		= o;
			this.OpenNode			= o;
		}
		
		if(show)
		{
		
			RemoveCssClass(o,this.CssUnselected);
			AddCssClass(o,this.CssSelected);
			
			if(o==this.SelectedItem.parentNode.parentNode||o==this.SelectedItem)
			{
				o.style.fontWeight = "bold";
			} else {
				o.style.fontWeight = "normal";
			}
		} else {
			o.style.fontWeight = "normal";
			if(o==this.SelectedItem) return;
			RemoveCssClass(o,this.CssSelected);
			AddCssClass(o,this.CssUnselected);
		}
		if(o.parentNode.parentNode.nodeName=="LI")
		{
			this.Toggle(o.parentNode.parentNode,show);
		}
		try {
			AddCssClass(this.SelectedItem,this.CssSelected);
		} catch(e)
		{}//do nothing
		
		this.SelectedItem.style.fontWeight = "bold";
	}
}
	