$(document).ready(function(){
	readFromCMS("notice", "#jNotice", 4);
	readFromCMS("post", "#jPost", 4);
	readFromCMS("news", "#jNews", 4);
	readWish();
});

function readFromCMS(mode, targetTag, limitCount){
	$.post("../../php/cms/cmsXML.php", {
		mode: mode,
		limitcount: limitCount
	}, function(xml){
		var htmlString = "<ul>";
		$("cms", xml).each(function(i){
			htmlString += '<a href="../php/cms/zoom.php?mode=' + mode + '&code=' + $(this).attr("Code") + '"><li>' + $(this).attr("Caption") + '</li></a>';
		});
		htmlString += "</ul>"
		$(targetTag).empty().append(htmlString);
	});
};

function readWish(){
	$.post("../../php/cms/getWish.php", {}, function(xml){
		$("wishmain", xml).each(function(i){
			$("#number").html($(this).attr("total"));
			$("#date").html($(this).attr("today") + " 진행 " + $(this).attr("current") + "명");
		});
	});
}



