/***********************************************
** File:      %M%  version %I%
** Author:    nat
** Modified:  %G%
** Copyright: I-Next Ltd
***********************************************/
/* ident %W% */


  $(function() {
		
	// highlight the current menu item and show section
  var path = location.pathname.substring(1);
  if ( path ) {
		$('#parentnav ul a[href$="' + path + '"]').parent().attr('class','current');
		$('#parentnav ul ul a[href$="' + path + '"]').parent().parent().parent().attr('class', 'current');
	  $('#parentnav ul ul a[href$="' + path + '"]').parent().parent().parent().addClass('open');
	}
	
	// bind iehover class (only needed for IE could move to template in conditionals)
    $('#parentnav li').hover(function() {
			$(this).addClass('iehover'); },
			function() {
				$(this).removeClass('iehover');
			});			
		
    // perform the open/closes on click
		$('#parentnav a').click(function() {
        if ($(this).attr('href') == '#') $(this).attr('href', 'javascript:;');
				if ($(this).parent().children('ul').length > 0) { // is there a sub menu?
					if ($(this).parent().hasClass('open')) {
						$(this).parent().removeClass('open');
						$(this).parent().addClass('closed');
					}
					else {
						$(this).parent().removeClass('closed');
						$(this).parent().addClass('open');
					}
				}
		});
    
	})



