
jQuery(document).ready(function()
  {
    /* Find all friendly UL's */
    jQuery('ul.adminmenu').each(function()
    {
    
      /* Create new ID for the select, use existent Id of UL but add the _Select prefix */
      var ElementId = jQuery(this).attr("id") + "_Select";
      
      /* Create new Select-element */
      jQuery(this).after("<select id='" + ElementId + "' class='adminmenu'><option value='none'>--- Admin Menu ---</option></select>");
      
      /* Loop-through list and add children to select */
      jQuery(this).find("li.Level1").each(function()
      {
        /* Setup values */
        var Anchor = jQuery(this).find("a").eq(0), Value = (Anchor.length > 0 ? jQuery(Anchor).attr("href") : '');
        var SelectedElement = (jQuery(this).hasClass("SelectedItem") ? ' selected' : '');
        
        /* Add child to select */
        jQuery("#"+ElementId).append("<option value='"+Value+"'"+SelectedElement+">"+jQuery(this).html()+"</option>");
      });
    });
    
    /* Hook selects */
    jQuery("select.adminmenu").change(function()
    {
      if(this.value.length > 0) window.location.href = this.value;
    });
  });
  
jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}
