﻿function ShowLoadingPercentage(percentage) {
    $('.spanLoadingPercentage').show(0);
    $('.spanLoadingPercentage').text(parseInt(percentage) + '%');
}

function ShowGlobalProgress() {
    $('.spanLoadingPercentage').hide(0);
    $('.tblBackgroundProgress').show(0);
}

function HideGlobalProgress() {
    $('.tblBackgroundProgress').hide(0);
}

function DisplayTextInStatusBar(text)
{
    window.status = text;
}
function ClearTextFromStatusBar()
{
    //window.status = '';
}

function DisplayUrlInStatusBar(url)
{
    var uriBase = new URI(document.location.href);
    var uriRel = new URI(url);
    var uriAbs = uriRel.resolve(uriBase);
    DisplayTextInStatusBar(uriAbs.toString());
}
function ClearUrlFromStatusBar()
{
    ClearTextFromStatusBar();
}

function NavigateTo(url)
{
    document.location.href = url;
}

function GetAbsoluteUrl(url)
{
    var uriBase = new URI(document.location.href);
    var uriRel = new URI(url);
    var uriAbs = uriRel.resolve(uriBase);
    return uriAbs.toString();
}

function GetAuthority() {
    var uriBase = new URI(document.location.href);
    var uriRel = new URI('');
    var uriAbs = uriRel.resolve(uriBase);
    return uriAbs.authority.toString();
}

function ValidateDate(day, month, year) {

    var dateVal = month + "/" + day + "/" + year;
    var dt = new Date(dateVal);

    if (dt.getDate() != day) {
        return false;
    }
    else if (dt.getMonth() != month - 1) {
        return false;
    }
    else if (dt.getFullYear() != year) {
        return false;
    }

    return true;
}

function StringIsNullOrEmpty(str)
{
    return str == null || str.length == 0;
}
