/* Copyright (c) 2009 Smileweb co., Ltd.  All rights reserved.  www.smileweb.co.kr */

function NoticeTop5(stage)
{				
	new ajax.xhr.Request("/main/main_transaction/notice_top5.php", 'stage='+stage , NoticeTop5SetList, 'GET');
}


function NoticeTop5SetList(xmlDoc)
{
	var code = getNodeValue( xmlDoc.getElementsByTagName( 'code' ) );

	if (code == 'success') 
	{
		ChildNodesDel("noticeList");		
		
		var loaddata = eval( "(" + getNodeValue( xmlDoc.getElementsByTagName ( 'data' ) ) + ")" );				
		
		for ( var i=0; i < loaddata.length; i++)
		{						
			NoticeTop5makeRow(loaddata[i], i);				
		}
	}
}

function NoticeTop5makeRow(data, i)
{
	var obj = document.getElementById("noticeList");	
	var dl = document.createElement("dl");
	if( obj != null ) {
		dl.innerHTML = "<dd><a href='/callcenter/qna_read.php?type=notice&num="+data.num+"&stage=C&head="+encodeURIComponent("공지사항")+"'>"+data.title+"</a></dd>";
		obj.appendChild(dl);
	}
	
}

function NoticeTop2(stage)
{				
	new ajax.xhr.Request("/main/main_transaction/notice_top5.php", 'stage='+stage , NoticeTop2SetList, 'GET');
}


function NoticeTop2SetList(xmlDoc)
{
	var code = getNodeValue( xmlDoc.getElementsByTagName( 'code' ) );

	if (code == 'success') 
	{
		ChildNodesDel("noticeList");		
		
		var loaddata = eval( "(" + getNodeValue( xmlDoc.getElementsByTagName ( 'data' ) ) + ")" );				
		
		for ( var i=0; i < loaddata.length; i++)
		{						
			NoticeTop2makeRow(loaddata[i], i);		
			if( i > 5) break;
		}
	}
}

function NoticeTop2makeRow(data, i)
{
	var obj = document.getElementById("noticeList");	
	var dl = document.createElement("dl");
	if( obj != null ) {
		dl.innerHTML = "<dd><a href='/callcenter/qna_read.php?type=notice&num="+data.num+"&stage=C&head="+encodeURIComponent("공지사항")+"'>"+data.title+"</a></dd>";
		obj.appendChild(dl);
	}
}


function NoticeTop3(stage)
{				
	new ajax.xhr.Request("/main/main_transaction/notice_top3.php", 'stage='+stage , NoticeTop3SetList, 'GET');
}


function NoticeTop3SetList(xmlDoc)
{
	var code = getNodeValue( xmlDoc.getElementsByTagName( 'code' ) );

	if (code == 'success') 
	{
		ChildNodesDel("noticeList2");		
		
		var loaddata = eval( "(" + getNodeValue( xmlDoc.getElementsByTagName ( 'data' ) ) + ")" );				
		
		for ( var i=0; i < loaddata.length; i++)
		{						
			NoticeTop3makeRow(loaddata[i], i);		
			if( i > 3) break;
		}
	}
}

function NoticeTop3makeRow(data, i)
{
	var obj = document.getElementById("noticeList2");	
	var li = document.createElement("li");
	if( obj != null ) {
		li.innerHTML = "<a href='/callcenter/qna_read.php?type=notice&num="+data.num+"&stage=C&head="+encodeURIComponent("공지사항")+"'>"+data.title+"</a>";	
		obj.appendChild(li);
	}
}

