<?
function get_neu_paginate($write_pages, $cur_page, $total_page, $url, $add="") {
        $str = "";
        if ($cur_page < 2) $str .= "<div class=\"neu_paginate center\"><span class=\"pre\">맨앞</span>";
        else if ($cur_page > 1) $str .= "<div class=\"neu_paginate center\"><a href='".$url.($start_page)."' class=\"pre\">맨앞</a>";

        $start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
        $end_page = $start_page + $write_pages - 1;

        if ($end_page >= $total_page) $end_page = $total_page;

        if ($start_page > 1) $str .= "<a href='".$url.($start_page-1)."{$add}' class=\"pre\">이전</a>";
        else if ($start_page = 1) $str .= "<span class=\"pre\">이전</span>";

        if ($total_page > 1)
        {
                for ($k=$start_page;$k<=$end_page;$k++)
                {
                        if ($cur_page != $k)
                        $str .= "<a href='$url$k{$add}'><span>$k</span></a>";
                        else
                        $str .= "<strong>$k</strong> ";
                }
        }

        if ($total_page > $end_page) $str .= "<a href='".$url.($end_page+1)."{$add}' class=\"next\">다음</a>";
        else $str .= "<span class=\"next\">다음</span>";

        if ($cur_page < $total_page) $str .= "<a href='$url".($total_page)."' class=\"next\">맨뒤</a></div>";
        else $str .= "<span class=\"next\">맨뒤</span></div>";

        $str .= "";
        return $str;
}

?>