document.write('<s'+'cript type="text/javascript" src="/common/js/jslb_ajax.js"></s'+'cript>');

var sUrl = '/front/php/b/board_main_ajax.php';
var iVistPage = 1;
var iRecoPage = 1;

/**
 *  Á¶È¸¼ö BEST
 */
function getVistBBS(iPage)
{
    if (iPage < 1) {
        iVistPage = 1;
    } else {
        iVistPage = iPage;
    }
    sendRequest(setVistBBS, '&vist_page='+iPage,'GET', sUrl, true, true);
}

function setVistBBS(oj)
{
    try {
        eval("var res = " + oj.responseText);
        dorpRow(visit_list,5);
        for (i =0; i < res.length; i++) {
           oTr = visit_list.insertRow(0);
           oTd1 = oTr.insertCell(0);
           oTd1.className = 'tbm_1';
           oTd1.innerHTML = '<img src="http://img.cafe24.com/images/ec_hosting/front/bul_014.gif" align="absmiddle" style="display:inline-block" />&nbsp;&nbsp;&nbsp;<a href="/front/php/b/board_read_new.php?board_no='+res[i].board_no+'&no='+res[i].no+'">'+res[i].subject+'</a>';
           oTd2 = oTr.insertCell(1);
           oTd2.className = 'tbm_2';
           oTd2.innerHTML = res[i].write_date.substr(0,10);
        }
    } catch(e) {
        alert('°Ô½Ã¹°ÀÌ ¾ø½À´Ï´Ù.');
        iVistPage = iVistPage-1
    }
}

/**
 *  ÃßÃµ¼ö º£½ºÆ®
 */
function getRecoBBS(iPage)
{
    if (iPage < 1) {
        iRecoPage = 1;
    } else {
        iRecoPage = iPage;
    }
    sendRequest(setRecoBBS, '&reco_page='+iPage,'GET', sUrl, true, true);
}

function setRecoBBS(oj)
{
    try {
        eval("var res = " + oj.responseText);
        dorpRow(reco_list,5);
        for (i =0; i < res.length; i++) {
           oTr = reco_list.insertRow(0);
           oTd1 = oTr.insertCell(0);
           oTd1.className = 'tbm_1';
           oTd1.innerHTML = '<img src="http://img.cafe24.com/images/ec_hosting/front/bul_014.gif" align="absmiddle" style="display:inline-block" />&nbsp;&nbsp;&nbsp;<a href="/front/php/b/board_read_new.php?board_no='+res[i].board_no+'&no='+res[i].no+'">'+res[i].subject+'</a>';
           oTd2 = oTr.insertCell(1);
           oTd2.className = 'tbm_2';
           oTd2.innerHTML = res[i].write_date.substr(0,10);
        }
    } catch(e) {
        alert('°Ô½Ã¹°ÀÌ ¾ø½À´Ï´Ù.');
        iRecoPage = iRecoPage-1
    }
}

/** 
 *  Å×ÀÌºí Á¦°Å
 */
function dorpRow(obj,iRowCnt)
{
    for (i =0; i < iRowCnt; i++) {
        try {
        obj.deleteRow(0);
        } catch(e) {
        }
    }
}
