

function MakePages(totalpages, currentpage)
{

	var maxPagesToShow=6;

    if ( totalpages < 2 ){
        return;
    }

    pagePrefix = pagePrefix.replace(/\.P\d+/,"");
    //    szBaseUrl = szBaseUrl.replace(/\.hotel\.ksp/,"");

    var link;

    if(1 < currentpage) {
        var prevpage = currentpage -1;
        link = pagePrefix + 'P' + prevpage + pageSuffix;

        document.write("&nbsp;" + "<a class=\"seolink\" href='" + link + "'>&laquo;" + prevMsg + "</a>");
    }
    
    var i = Math.max((currentpage - 1), 1);
    
    if (i > 1) {
          link = pagePrefix + 'P1' + pageSuffix;
          document.write("&nbsp;<a class='seolink' href='" + link + "'>" + 1 + "</a>");
          if (i > 2) {
                document.write("&nbsp;&hellip;");
          }
    }
    
    for (; i<=totalpages && maxPagesToShow > 0; i++)
    {
        if (i==currentpage) {
            document.write("&nbsp;" + i + "");
        } else {
            link = pagePrefix + 'P' + i + pageSuffix;
            document.write("&nbsp;<a class='actionlink' href='" + link + "'>" + i + "</a>");
        }
        maxPagesToShow--;
    }
    // Show ellipsis and last page number if we didn't get to end
    if (i < totalpages) {
            document.write("&nbsp;&hellip;");
            link = pagePrefix + 'P' + totalpages + pageSuffix;
            document.write("&nbsp;<a class='actionlink' href='" + link + "'>" + totalpages + "</a>");
    }

    if(totalpages > currentpage) {
        var nextpage = currentpage +1;
        link = pagePrefix + 'P' + nextpage + pageSuffix;
        document.write("&nbsp;" + "<a class=\"seolink\" href='" + link + "'>" + nextMsg + "&raquo;</a>&nbsp;");
    }

}
