function reloadPage()
{
    window.location.reload();
}

function deleteRecord(url, question, targetUrl)
{
    if(window.confirm(question))
    {
        DinamicObj("hiddenAjaxObj", url, null, reloadPage)
   }
}

function divPicShow(obj, e)
{
    obj.style.position   = "absolute";
    obj.style.visibility = "visible";
    obj.style.display    = "block";
}

function divPicHide(obj)
{
    obj.style.visibility = 'hidden';
    obj.style.display    = 'none';
}

function filterhide()
{
    var filterDiv = document.getElementById("filtertable");
    var filterImage = document.getElementById("filterImage");
    var srcStr = filterImage.src;
    if(filterDiv.style.visibility!="visible")
    {
        filterDiv.style.visibility = "visible";
        filterDiv.style.display    = "block";
        filterImage.src = srcStr.replace("d_t.gif", "u_t.gif");
    }
    else
    {
        filterDiv.style.visibility = "hidden";
        filterDiv.style.display    = "none";
        filterImage.src = srcStr.replace("u_t.gif", "d_t.gif");
    }
}

function descOrder(url, paramIndex, descOreder)
{
    document.getElementById("descOrder").value = descOreder;
    var order = document.getElementById("orderby").value;
    applyFilter(url, paramIndex, order);
}

function orderBy(url, paramIndex)
{
    var order = document.getElementById("orderby").value;
    applyFilter(url, paramIndex, order);
}


function applyFilter(url, paramIndex, orderColumn)
{
    var pesteFilterId  = document.getElementById("pesteFilterId");
    var from = document.getElementById("cal_input_from");
    var to = document.getElementById("cal_input_to");
    var judid = document.getElementById("judid");
    var locid = document.getElementById("locid");
    var locpesid = document.getElementById("locpesid");
    var descOrder = document.getElementById("descOrder");
    var idun = document.getElementById("idun");
    
    /*url+=paramIndex
        +"pesteFilter="+pesteFilter.value
        +"&pesteFilterId="+pesteFilterId.value
        +"&judid="+judid.value
        +"&locid="+locid.value
        +"&from="+from.value
        +"&to="+to.value;*/
     var pfval=pesteFilter.value;
     var pfival = pesteFilterId.value;
     var jival = judid.value;
     var lival= locid.value;
     var fval = from.value;
     var tval = to.value;
     var lpval = locpesid.value;
     var dorder = descOrder.value
     var idunval = idun.value;
     
     if(pfival=="")
        pfival="-1";
     if(jival=="")
        jival=-1;
     if(lival=="")
        lival="-1";
     if(fval=="")
        fval="-1";
     if(tval=="")
        tval="-1";
     if(lpval=="")
        lpval="-1";
     if(idunval=="")
        idunval="-1";
        
     url+=paramIndex
        +"pesteFilterId"+pfival
        +"judid"+jival
        +"locid"+lival
        +"time"+fval+"ttt"+tval
        +"locpesid"+lpval
        +"order"+orderColumn
        +" "+dorder
        +"idun"+idunval
        +"pageindex1";
    var encodedUrl = encodeURI(url);
    window.location = encodedUrl;
}
