function createMenu(arMenu,ele) {
   var menuHtml = '<ul class="sf-menu">';
   for(var i=0;i<arMenu.children.length;i++) {
      menuHtml += '<li id="'+ arMenu.children[i].mID +'"><a href="'+arMenu.children[i].link +'">';
      if (!arMenu.children[i]) {
         menuHtml += arMenu.children[i].title;
      } else {
         menuHtml += '<img class="BFnormalImage"alt="'+arMenu.children[i].title +'" src="'+arMenu.children[i].imagePath +'" />';
         menuHtml +=  '<img class="BFhoverImage"alt="'+arMenu.children[i].title +'" src="'+arMenu.children[i].hoverImagePath +'" style="display:none"/>';
         menuHtml +=  '<img class="BFactiveImage" alt="'+arMenu.children[i].title +'" src="'+arMenu.children[i].activeImagePath +'" style="display:none"/>';
      }
       menuHtml +=  '</a>';
      if (arMenu.children[i].children.length >0 ) {
         menuHtml += createMenu(arMenu.children[i]);
      }
      menuHtml += '</li>';
   }
   menuHtml += "\n</ul>\n";
   if (ele) {
      $(ele).append(menuHtml); 
      var sfOptions = {
autoArrows: false,
animation : { opacity:"show" /*,height:"show"*/ }
      };
      $('.sf-menu').superfish(sfOptions);
      $('#Bmenu'+bID+' a').hover( 
      function() {
        if ($('img:nth-child(1)',this).is(':visible') && $('img:nth-child(2)',this).attr('src') != "") {
       $('.BFnormalImage',this).hide();
       $('.BFhoverImage',this).show();
        }
      },
      function() {
 if ($('img:nth-child(2)',this).is(':visible') && $('img:nth-child(1)',this).attr('src') != "") {

   $('.BFhoverImage',this).hide();
   $('.BFnormalImage',this).show()
      }
   }
      );
    
    var topLevelLinks = $('#Bmenu'+bID+' > ul > li > a')
      for (var i=topLevelLinks.length-1 ; i >= 0 ; i--)  {
      if ( cPageLink.indexOf($(topLevelLinks[i]).attr('href'))    !=  -1 ) {
             $('img.BFnormalImage',$(topLevelLinks[i])).hide();
              $('img.BFactiveImage',$(topLevelLinks[i])).show();
         break;
      }
     }


   }else {
      return menuHtml;
   } 
}

$(document).ready( function() {
  




  });

