(function() {

 

       /**

        * @author NPrice

        */

       var NewMind = window.NewMind || {};

       NewMind.Site = window.NewMind.Site || {};

       

       /**

        * RolloverNav

        * @Requires JQuery.1.2.2

        */

       NewMind.Site.RolloverNav = function(selector) {

       

              //add hover mouseover and mouseout events for the selected element

              //hover is used because it caters for bubbling problems 

              //that mouseover and mouseout dont do separately

              $(selector).hover(

                     function(){

                           

                           var liObj = $(this);

                           

                           //add hover class to the li

                           liObj.addClass('hover');

                           

                           //get the classes of the li

                           //using attr because it returns a string of the value

                           var classAttr = String(liObj.attr('class'));

                           

                           //assign just the first class found to the parent ul

                           //this needs to be the pagename for the top level

                           liObj.parent().addClass(classAttr.substring(0,classAttr.indexOf(' ')));

                     },

                     function(){

                           //for mouseout just remove class from the li and its parent

                           $(this).removeClass('hover').parent().removeClass();

                     }

              )

       };

       

       $(document).ready(

              function() { 

                     //selector adds rollover to main nav direct child li of a direct child ul

                     NewMind.Site.RolloverNav('.ctl_Navigation > ul > li'); 

              }

       );

 

 

})();
