
function getNotice( num ) {
	var moduleObj = new module();
	moduleObj.setServer("na");
	moduleObj.bDebug = true;
	moduleObj.newsList("ogp_notice", 9, num, 8, 1);
}

function getEvent( num ) {
	var moduleObj2 = new module();
	moduleObj2.setServer("na");
	moduleObj2.bDebug = true;
	
	moduleObj2.newsList("ogp_event", 9, num, 8, 2);
}

function getRank() {
	var moduleObj3 = new module();
	moduleObj3.setServer("na");
	moduleObj3.bDebug = true;
	moduleObj3.rankList("ls", 5, 3);
}

function getPatch( num ) {
	var moduleObj4 = new module();
	moduleObj4.setServer("na");
	moduleObj4.bDebug = true;
	moduleObj4.newsList("ogp_patch", 9, num, 8, 4);
}


function moduleCallBack1( data ){
	
	var x = $('#notice_entry_box');
	x.html('');
	$.each(data.List, function(i,item){
		var month = new String(item.PostedDate);
		var date = month.slice(8, 10);
		month = month.slice(5, 7);
		if( month == "01")month = "JAN";
		else if(month == "02")month = "FEB";
		else if(month == "03")month = "MAR";
		else if(month == "04")month = "APR";
		else if(month == "05")month = "MAY";
		else if(month == "06")month = "JUN";
		else if(month == "07")month = "JUL";
		else if(month == "08")month = "AUG";
		else if(month == "09")month = "SEP";
		else if(month == "10")month = "OCT";
		else if(month == "11")month = "NOV";
		else if(month == "12")month = "DEC";
			x.append('<div class="notice_entry"><div class="calendar">\n'+
                      '<span class="month">' + month + '</span>\n'+
                      '<span class="date">' + date + '</span></div><div class="contents">\n'+
                      '<a href="NEWS/NOTICES_VIEW.html?'+ item.Idx+'"><p class="title">'+ item.Subject +'</p></a>\n'+
                      '<p class="inside">'+ item.SmallContent +'</p>\n'+
                    '</div></div>\n');
        if (i == 0){
        	$('.notice_entry .calendar').addClass('first');
        } 
	});
	
}

function moduleCallBack2( data ){
	
	var y = $('#event_entry_box');
	y.html('');
	$.each(data.List, function(i,item){
		var content = new String(item.SmallContent);
		content = content.replace("<p>", "");
		content = content.replace("</p>", "");
		var month = new String(item.PostedDate);
		var date = month.slice(8, 10);
		month = month.slice(5, 7);
		if( month == "01")month = "JUL";
		else if(month == "02")month = "FEB";
		else if(month == "03")month = "MAR";
		else if(month == "04")month = "APR";
		else if(month == "05")month = "MAY";
		else if(month == "06")month = "JUN";
		else if(month == "07")month = "JUL";
		else if(month == "08")month = "AUG";
		else if(month == "09")month = "SEP";
		else if(month == "10")month = "OCT";
		else if(month == "11")month = "NOV";
		else if(month == "12")month = "DEC";
			y.append('<div class="events_entry"><div class="calendar">\n'+
                      '<span class="month">' + month + '</span>\n'+
                      '<span class="date">' + date + '</span></div><div class="contents">\n'+
                      '<a href="NEWS/EVENTS_VIEW.html?'+ item.Idx+'"><p class="title">'+ item.Subject +'</p></a>\n'+
                      '<p class="inside">'+ content +'</p>\n'+
                    '</div></div>\n');
        if (i == 0){
        	$('.events_entry .calendar').addClass('first');
        } 
	});
}

function moduleCallBack4( data ){
	var y = $('#updates_entry_box');
	y.html('');
	$.each(data.List, function(i,item){
		var content = new String(item.SmallContent);
		while (content.search("<p>") > 0 || content.search("</p>") >0 || content.search("<br />")>0)
		{
			content = content.replace("<p>", "");
			content = content.replace("</p>", "");
			content = content.replace("<br />", "");
		
		}
		content = content.substr(0, 200);
		var month = new String(item.PostedDate);
		var date = month.slice(8, 10);
		month = month.slice(5, 7);
		if( month == "01")month = "JUL";
		else if(month == "02")month = "FEB";
		else if(month == "03")month = "MAR";
		else if(month == "04")month = "APR";
		else if(month == "05")month = "MAY";
		else if(month == "06")month = "JUN";
		else if(month == "07")month = "JUL";
		else if(month == "08")month = "AUG";
		else if(month == "09")month = "SEP";
		else if(month == "10")month = "OCT";
		else if(month == "11")month = "NOV";
		else if(month == "12")month = "DEC";
			y.append('<div class="updates_entry"><div class="calendar">\n'+
                      '<span class="month">' + month + '</span>\n'+
                      '<span class="date">' + date + '</span></div><div class="contents">\n'+
                      '<a href="NEWS/UPDATES_VIEW.html?'+ item.Idx+'"><p class="title">'+ item.Subject +'</p></a>\n'+
                      '<p class="inside">'+ content +'</p>\n'+
                    '</div></div>\n');
        if (i == 0){
        	$('.updates_entry .calendar').addClass('first');
        } 
	});
}


function ranking( data ){
	var z = $('#rankingBanner');
	var rankWord = new String();
	z.html('<a href="COMMUNITY/RANKINGS.html" class="moreButton"></a><p class="title"><span class="rankLabel">Name</span><span class="levelLabel">Rank</span></p>');
	$.each(data.List, function(i,item){
		if (item.rank == 1) rankWord = "one";
		if (item.rank == 2) rankWord = "two";
		if (item.rank == 3) rankWord = "three";
		if (item.rank == 4) rankWord = "four";
		if (item.rank == 5)rankWord = "five";
		if (i != 5)
		{
			z.append('<p class="level '+ rankWord + '"><span class="icon">'+item.rank+'</span><span class="name" id="rank'+ rankWord + '">' + item.nickName + '</span><span class="level levelNum'+ item.level +'">'+ item.level + '</span></p>');
		}else{
			z.append('<p class="level '+ rankWord + '"><span class="icon">'+item.rank+'</span><span class="name" id="rank'+ rankWord + '">' + item.nickName + '</span><span class="level levelNum'+ item.level +'">'+ item.level + '</span></p></div>');
		}
	});
}

$(function() {
    function calculateHeight() {
            var browserWidth = parseInt($(window).width());
            if (browserWidth < 1050){
			$("#facebook").css({"left": "595px"});
            }else
		{
			$("#facebook").css({"left": "909px"});
		}
	
        }
        var resizeTimer = null;
        $(window).bind('resize load', function() {
			if (resizeTimer) {clearTimeout(resizeTimer);}
            	resizeTimer = setTimeout(calculateHeight, 10);
    	});
           
});






