$(document).ready(function(){

/* If the sub menu and the hidden menu index value exists add 'on' class to indexed li */
if(($('.subMenu').length) && ($('#menuIndex').length)) {
  var menuIndex = $('#menuIndex').val();
  $('.subMenu li').eq(menuIndex).addClass('on');
}		

/* Add the classname for IE6 to do the hover effect, since IE6 can't do li:hover */
if (($.browser.msie) && (parseInt($.browser.version)==6)) {
   $('.mainMenu>li').hover(
	  function(){
        $(this).addClass('hover');	
      },function() {
        $(this).removeClass('hover');
   });
}

/* Milestones toggle slide on pipeline overview */
if ($('.mstoggle').length) {
$('.mstoggle').click(function() {
   var theEl = $(this);
   var index = $('.mstoggle').index(this);
   if(theEl.hasClass('closed')){

       $('.milestoneBox').eq(index).slideUp(300,function(){
	       theEl.removeClass('closed').addClass('open');
       });

   } else {
       theEl.removeClass('open').addClass('closed');
   	   $('.milestoneBox').eq(index).slideDown(300);

   }
   return false;
});
}


/* animate the bar graphs on page load */
if($('.pbar').length) {
$.each($('.pbar'), function() {
	var theWidth = $(this).attr('rel');
	$(this).css('width','0%').animate({
		width:theWidth
	},800);
});
}


}); /* end onload */