$(document).ready( function() {
   if ( $.browser.msie && parseInt($.browser.version, 10) <= 6 )
     setTimeout('resizeMenu()', 500); // wait for iefixes
   else
      resizeMenu();
});

function resizeMenu() {

   // resize menu items
   var targetW = $('#main_menu').width();
   var itemCount = $('#main_menu .drop_down').children('li').length;
   if (itemCount) {
      var realW = 0;
      $('#main_menu .drop_down').children('li').each(function() { realW += $(this).width(); });
      realW += itemCount - 1; // add separators

      var addToEach = Math.floor((targetW - realW)/itemCount);
      var addToLast = targetW - (realW + itemCount*addToEach); // calculate loss by Math.float

      $('#main_menu .drop_down').children('li').each(function(index) {
         var item = $(this).children('a').children('span');
         if (index == itemCount-1)
            item.width(item.width() + addToEach + addToLast);
         else
            item.width(item.width() + addToEach);
      });
   }   
}

function printOrder(_url) {
	printWindow = window.open(_url,
							  "printWindow","toolbar=0, location=0, status=1, resizable=1, menubar=1, "+
							  "scrollbars=1, width=750, height=540");
	printWindow.focus();
}


