jQuery.preloadImages = function(arrMenu, depthLimit, currentDepth)
{
  currentDepth = currentDepth != null ? currentDepth : 0;

  if( arrMenu instanceof Array) {
    for(var i = 0; i<arrMenu.length; i++) {
      $.preloadImages(arrMenu[i], depthLimit, currentDepth + 1);
    }
  } else {
    if(arrMenu.imagePath) {
      jQuery("<img>").attr("src", arrMenu.imagePath);

    }
    if((depthLimit == null || currentDepth < depthLimit) && arrMenu.children.length > 0) {
      $.preloadImages(arrMenu.children, depthLimit, currentDepth + 1);
    }
  }
}
