jQuery(document).ready(function() {
	// do something here
    initPg ( 0 );
    doPg( 1, 0 );
});
    function doMel( what, loc ) {
        tmp = document.getElementById( "col_2_content_full" );
        tmp1 = $.ajax({
            type: "GET",
            url: "http://www.harrison-solicitors.com/lib/news1.php?loc="+loc+"&page=" + what,
            dataType: "html",
            timeout: 2000,
            async: false,
            error: function(msg){
                alert( "Data Error: " + msg );
            }
        }).responseText;
        tmp.innerHTML = tmp1;
        return false;
    }
    var myPg0 = 0;
    var myPg1 = 0;
    var maxPg0 = 1;
    var maxPg1 = 1;
    var dispPg = 5;

    function initPg ( wnews ){
        tmp = "lxt"+wnews+"1";
        if (!document.getElementById("newswrap")) return;

        if ( wnews == 0 ) myPg0 = 1;
        else myPg1 = 1;
/* count all LI elements */
        j = 0;
        while (document.getElementById("lxt"+wnews+(j+1))) {
            j++;
        }
        if ( wnews == 0 ) maxPg0 = j;
        else maxPg1 = j;
/*
        maxPg = eval( 'maxPg' + wnews );
        for (j=1;j<=maxPg;j++) {
            if(j<=dispPg) {
            $("li#lxt"+wnews+''+j).css({display:"block"});
            } else {
                $("li#lxt"+wnews+''+j).css({display:"none"});
            }
        }
*/
    }
    function doPg( whichPg, wnews ) {
        if (!document.getElementById("newswrap")) return;
        if ( wnews == 0 ) myPg0 = whichPg;
        else myPg1 = whichPg;
        maxPg = eval( 'maxPg'+ wnews );
        for (j=1;j<=maxPg;j++){
                    if ( j == whichPg ) $("li#lxt"+wnews+''+j).css({"font-weight":"bold"});
                    else $("li#lxt"+wnews+''+j).css({"font-weight":"normal"});
        }
        tmp = document.getElementById( "newswrap" );
        tmp1 = $.ajax({
            type: "GET",
            url: "http://www.harrison-solicitors.com/lib/news1.php?loc="+loc+"&page=" + whichPg,
            dataType: "html",
            timeout: 2000,
            async: false,
            error: function(msg){
                alert( "Data Error: " + msg );
            }
        }).responseText;
        tmp.innerHTML = tmp1;
        if ( maxPg <= dispPg ) {
            for (j=1;j<=maxPg;j++) {
                if (j==whichPg) {
                    $("div#nav"+wnews+''+j).css({display:"block"});
                } else {
                    $("div#nav"+wnews+''+j).css({display:"none"});
                }
            }
            return;
        }
        x1 = 1;

        if ( whichPg > 0 && whichPg <= maxPg ) {
            if ( whichPg > 2 ) {
                x1 = whichPg - 2;
            }
            while ( x1 + dispPg > maxPg ) {
                x1--;
            }
            for (j=2;j<maxPg;j++) {
                if(j>x1 && j<x1+dispPg) {
                    $("li#lxt"+wnews+''+j).css({display:"block"});
                } else {
                    $("li#lxt"+wnews+''+j).css({display:"none"});
                }
            }
            for (j=1;j<=maxPg;j++) {
                if (j==whichPg) $("div#nav"+wnews+''+j).css({display:"block"});
                else $("div#nav"+wnews+''+j).css({display:"none"});
            }
        }
        return false;
    }

