/*left navigation bar menu
*
* 1-Council Committees
* 2-Senate Committees
* 3-University Extension Board
* 4-College Boards of Trustees
* 5-Planning Comittees for New Colleges
* 6-College Assembiles of Fellows
* 7-Advisory Boards and Committees
* 8-Others Committees
*
*/
var arrDefinition = [

['council-committees.html', 'aapc.html', 'audit.html', 'campus.html', 'donations.html', 'distinctive.html', 'exco.html', 'finance.html', 'hon-degrees.html', 'hon-fellowship.html', 'terms-of-service.html', 'tender.html', 'cuhk-foundation.html'],

['senate-committee.html', 'apc.html', 'general-education.html', 'language-enhancement.html', 'physical-education.html', 'staff-student-consultative.html', 'student-discipline.html','teaching-learning.html', 'undergraduate-admissions.html', 'university-press.html', 'university-scholarships.html', 'uexb.html'],

['university-ext-board.html'],

['college-boards-trustees.html'],

['planning-com-new-colleges.html', 'c-w-chu-planning.html', 'wu-yee-sun-planning.html', 'lee-woo-sing-planning.html'],

['college-assembiles-fellows.html'],

['advisory-boards-committees.html', 'continuing-studies.html', 'engineering.html', 'law.html', 'hkier.html', 'ics.html', 'idd.html', 'lf-scml.html', 'mba.html', 'shun-hing.html', 'accounting.html', 'museum.html', 'social-work.html', 'math.html', 'electronic.html', 'environmental.html', 'hotel.html', 'information.html',  'mechanical.html', 'architecture.html',  'career.html'],

['other-committees.html', 'aac.html', 'research.html']
	
]

$(document).ready( function() {
	var targetIndex = -1;
	
	for (i in arrDefinition) {
		for (j in arrDefinition[i]) {
			//Use Regular Expression to check. e.g. to check a1.html then the regular expression is /a1\.html$/ where $ represents the end of string.
			var re = new RegExp(arrDefinition[i][j].replace(".", "\\.") + "$");
			
			if (re.test(document.location.pathname)) {
				targetIndex = i;
				break;
			}
		}
		
		if (targetIndex >= 0) 
			break;
	}
	
	//Turn on the corresponding button in the left navigation bar
	$("table#leftnav table:first td[background]:eq(" + targetIndex + ")").attr("background","/governance/images/english/bg-nav-on.jpg");
	//"background", "/governance/images/english/bg-nav-on.jpg"	/Orange Color Background
	//"background", "/governance/images/english/bg-nav-off.jpg"	//Grey Color Backgroud

})
