
$(document).ready(function() {
			
								
		$('.menu-removeitem').live('click', function() {
			$.get('/support/doStuff.php?do=menu-removeitem&itemID='+$(this).parent().attr('id')+'&menuID='+$(this).parent().parent().parent().attr('id'), function(data) {
              $('#admin-menu-items').html(data);
            });
		});
		
		$('.menu-moveitem-up').live('click', function() {
			$.get('/support/doStuff.php?do=menu-moveitem-up&itemID='+$(this).parent().attr('id')+'&menuID='+$(this).parent().parent().parent().attr('id'), function(data) {
              $('#admin-menu-items').html(data);
            });
		});
		
		$('.menu-moveitem-down').live('click', function() {
			$.get('/support/doStuff.php?do=menu-moveitem-down&itemID='+$(this).parent().attr('id')+'&menuID='+$(this).parent().parent().parent().attr('id'), function(data) {
              $('#admin-menu-items').html(data);
            });
		});
		
		
		$('#admin_toggle').live('click', function() { 
			$.get('/support/doStuff.php?do=admin-bar-showhide&itemID', function(data) {
              //alert(html(data));
            });
		});
			
		
			
});
		function mmd_run_ajax(theseParams)
		{
			if ( theseParams['post'] != '')
			{
				$.post('/support/doStuff.php?do='+theseParams['action']+'&which='+theseParams['which']+'&childOf='+theseParams['childof']+'&'+theseParams['custom'], theseParams['post'], function(data) {
				 if ( theseParams['add'] != null ) {
				  		$(theseParams['add']).append(data);
				  } else {
					  $(theseParams['fill']).html(data);
				  }
				});
			}
			else
			{
				$.get('/support/doStuff.php?do='+theseParams['action']+'&which='+theseParams['which']+'&childOf='+theseParams['childof']+'&'+theseParams['custom'], function(data) {
				  if ( theseParams['add'] != null ) {
				  		$(theseParams['add']).append(data);
				  } else {
					  $(theseParams['fill']).html(data);
				  }
				});
			}
		}
		function changeMenuName(menuID, newName) {
			 $('#btnChangeMenuName').attr('value', 'Processing');
			$.get('/support/doStuff.php?do=menu-changename&menuID='+menuID+'&newName='+newName, function(data) {
              $('#btnChangeMenuName').attr('value', data);
			});		
		};
		
		function changeMenuItemName(menuID, itemID, newName, newURL) {
			 $('#btnchangeMenuLinkName-'+itemID).attr('value', 'Processing');
			$.get('/support/doStuff.php?do=menu-renameitem&menuID='+menuID+'&itemID='+itemID+'&newName='+newName+'&newURL='+newURL, function(data) {
              $('#btnchangeMenuLinkName-'+itemID).attr('value', 'Modify');
			  //alert(data);
			});		
		};
		
		function addMenuItem(menuID, newContentID) {
			 $('#newContentBTN').attr('value', 'Wait...');
			$.get('/support/doStuff.php?do=menu-additem-content&menuID='+menuID+'&newContentID='+newContentID, function(data) {
              $('#newContentBTN').attr('value', 'Add');
			$('#admin-menu-items').html(data);
			});
		}
		function addTextItem(menuID, newContentName, newContentURL) {
			 $('#newTextBTN').attr('value', 'Wait...');
			$.get('/support/doStuff.php?do=menu-additem-text&menuID='+menuID+'&newItemName='+newContentName+'&newItemURL='+newContentURL, function(data) {
              $('#newTextBTN').attr('value', 'Add');
			$('#admin-menu-items').html(data);
			});
		}
		function addOtherItem(menuID, newContentType) {
			 $('#newSpecialBTN').attr('value', 'Wait...');
			$.get('/support/doStuff.php?do=menu-additem-other&menuID='+menuID+'&newItemType='+newContentType, function(data) {
              $('#newSpecialBTN').attr('value', 'Add');
			$('#admin-menu-items').html(data);
			});
			
		}
