jQuery(document).ready(function() {
	// do something here
    initPg ( );
    if ( qstre != '' )
        doPg( 1, qstre );
});
    var myPg0 = 0;
    var maxPg0 = 1;
    var dispPg = 5;
    var qstre;

    function initPg ( ){
        tmp = "lxt1";
        if (!document.getElementById("srchProperties")) return;

        myPg0 = 1;
/* count all LI elements */
        j = 0;
        while (document.getElementById("lxt"+(j+1))) {
            j++;
        }
        maxPg0 = j;
    }

// display data for the location and sumbit form to zoom on his marker
    function showProp ( id ) {
        tmp = document.getElementById( "locdata" );
//        myurl = 'http://81.18.55.254:8098/';
        myurl = 'http://www.siepa.gov.rs/';
        tmp1 = $.ajax({
            type: "GET",
            url: myurl + "lib/getPropertyId.php?id=" + id,
            dataType: "html",
            timeout: 2000,
            async: false,
            error: function(msg){
                alert( "Data Error: " + msg );
            }
        }).responseText;
        tmp.innerHTML = tmp1;
        hasmap = 'myJSC' + id
        if ( tmp = document.getElementById(hasmap) ) {
            tmp.submit();
        }

        return false;
    }

// get and display page of locations, and submit form that will set markers on map
    function doPg( whichPg, qstring ) {
        if (!document.getElementById("srchProperties")) return;
        myPg0 = whichPg;
        maxPg = maxPg0;
        x1 = 1;
        for (j=1;j<=maxPg;j++){
                    if ( j == whichPg ) $("li#lxt"+''+j).css({"font-weight":"bold"});
                    else $("li#lxt"+''+j).css({"font-weight":"normal"});
        }
        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"+''+j).css({display:"block"});
                } else {
                    $("li#lxt"+''+j).css({display:"none"});
                }
            }
        }

        tmp = document.getElementById( "srchProperties" );
//        myurl = 'http://81.18.55.254:8098/';
        myurl = 'http://www.siepa.gov.rs/';
        tmp1 = $.ajax({
            type: "GET",
            url: myurl + "lib/getPropertyPg.php?" + qstring,
            dataType: "html",
            timeout: 2000,
            async: false,
            error: function(msg){
                alert( "Data Error: " + msg );
            }
        }).responseText;
        tmp.innerHTML = tmp1;
        if ( document.myJSC ) {
            document.myJSC.submit();
        }
        return false;
    }

// function to be called after map iFrame has been loaded
// call either doPg - if qstring is set
// or (if set) submit form for 1 exporter
    function firstPass() {
        if ( typeof( window[ 'qstring' ] ) != "undefined" ) {
            doPg( 1, qstring );
        } else {
            if( document.getElementById ( 'myJSCID' ))
            document.myJSCID.submit();
        }
    }

