//****************************************************************
//****************************************************************
//	COPYRIGHT 2009, Vertex Software
//****************************************************************
//****************************************************************


//===========================================================
// Initialize
//===========================================================
function Initialize( ) {
	try {
		UpdateNav();
		}
	catch (error) {
		alert( "Initialize: " + error.description  );
		}
	}


//===========================================================
// UpdateNav
//===========================================================
function UpdateNav( )
{
	try
	{
		if (!GetPageSectionID()) return;
		var pageName = (document.location.pathname.match( /([^\/]+)$/ ) ? RegExp.$1 : "");
		$( "li" ).removeClass( "selected" );
		// 15SEP2009 RFM - Changed to allow non-root hosting
		$( "a[href='" + document.location.pathname + "']" ).parent().addClass("selected" );
		//$( "a[href='" + pageName + "']" ).parent().addClass("selected" );
		$( "li#" + GetPageSectionID() ).addClass("selected" );
		
	}
	catch (error) {	alert( "UpdateNav: " + error.description  );}
}


//===========================================================
// GetPageSectionID
//===========================================================
function GetPageSectionID( ) {
	try {
		// 15SEP2009 RFM - Changed to allow non-root hosting
		//if (document.location.pathname.match( /([^\/]+)\/[^\.\/]+\.html$/g )) return RegExp.$1
		// 15SEP2009 RL - Changed extension to .asp
		if (document.location.pathname.match( /([^\/]+)\/[^\.\/]+\.aspx$/g )) return RegExp.$1
		if (document.location.pathname.match( /\/([^\/]+)\/$/g )) return RegExp.$1
		}
	catch (error) {
		alert( "GetPageID: " + error.description  );
		}
	return "";
	}

$( Initialize );
