function loadSubMenu(id){
	$.get("ajax_load_sub_menu.php", {id:id}, function(data){
		$(".sub-menu-container").html(data);
	});
}

function loadContent(id){
	$.get("ajax_load_content.php", {id:id}, function(data){
		$(".content-container").html(data);
	});	
}

function loadWiaaa(){
	$.get("ajax_load_wiaaa.php", {}, function(data){
		$(".content-container").html(data);
	});	
}

function changeSubContent(sm){
//	$(".sub-menu-container").html('<img src="images/loading.gif">');
//	$.get("ajax_load_sub_content.php", {sub_level:sm}, function(data){
//		$(".content-container").html(data);
//	});
}

function changeTopContent(lnk){
//	$(".sub-menu-container").html("");
//	$(".content-container").html('<img src="images/loading.gif">');
//	$.get("ajax_load_top_content.php", {top_level:lnk}, function(data){
//		$(".content-container").html(data);
//	});
}

function changeContent(cid){
//	$(".content-container").html('<img src="images/loading.gif">');
//	$.get("ajax_load_top_content.php", {content_id:cid}, function(data){
//		$(".content-container").html(data);
//	});
}

function changeNews(pg){
	$(".news-container").html('<img src="images/loading.gif">');
	$.get("ajax_load_news.php", {page:pg}, function(data){
		$(".news-container").html(data);
	});
}

function uploadNewsImage(nid){
$("#upload1").upload({
	name: 'file',
	method: 'post',
	enctype: 'multipart/form-data',
	action: 'news_image_upload.php?nid='+nid,
	onSubmit: function() {},
	onComplete: function(data) {
		$.get("ajax_upload_news_image.php", {nid:nid}, function(data){
			$("#image-preview").html(data);
		});
	}
});}

function deleteNewsImage(nid, niid){
	$.get("ajax_delete_news_image.php", {nid:nid, niid:niid}, function(data){
		$("#image-preview").html(data);
	});
}

function uploadContentImage(cid){
$("#upload1").upload({
	name: 'file',
	method: 'post',
	enctype: 'multipart/form-data',
	action: 'content_image_upload.php?cid='+cid,
	onSubmit: function() {},
	onComplete: function(data) {
		$.get("ajax_upload_content_image.php", {cid:cid}, function(data){
			$("#image-preview").html(data);
		});
	}
});}

function deleteContentImage(cid, ciid){
	$.get("ajax_delete_content_image.php", {cid:cid, ciid:ciid}, function(data){
		$("#image-preview").html(data);
	});
}

function displayPopup(msg){
	$('#popup-message').dialog({
		autoOpen:false,
		buttons:{'Ok':function(){$(this).dialog("close");}},
		closeOnEscape:true,
		draggable:false,
		modal:true,
		resizable:false,
		title:'Information',
		width:480
	});
	$('#popup-message').html(msg);
	$('#popup-message').dialog('open');
}

function confirmDeleteNews(){
	input_box=confirm("Are you sure you want to delete this entry?\nClick OK to confirm or CANCEL to cancel.");
	if (input_box==true){
		document.admin_delete.submit();
	}
}

function confirmDeleteMenus(){
	input_box=confirm("Are you sure you want to delete this entry?\nClick OK to confirm or CANCEL to cancel.");
	if (input_box==true){
		document.admin_delete.submit();
	}
}

function confirmDeleteContent(){
	input_box=confirm("Are you sure you want to delete this entry?\nClick OK to confirm or CANCEL to cancel.");
	if (input_box==true){
		document.admin_delete.submit();
	}
}

function getMenuOrder(){
	order = $('#sorter').sortable('serialize');
	$.get("ajax_update_sub_menu_order.php", {order:order}, function(data){
		if(data == 'true'){
			location.href = 'menus.php?r=mss';
		}else{
			location.href = 'menus.php?r=msf';
		}
	});
}
