﻿function ShowHide(elementName) {
    if (document.getElementById(elementName).style.visibility == 'hidden') {
        document.getElementById(elementName).style.visibility = 'visible';
    } else {
        document.getElementById(elementName).style.visibility = 'hidden';
    }
}

function ShowHideBlock(elementName) {
    if (document.getElementById(elementName).style.display == 'none' || document.getElementById(elementName).style.display == '') {
        document.getElementById(elementName).style.display = 'block';
    } else {
    document.getElementById(elementName).style.display = 'none';
    }
}

function ShowUpdateProgress(elementName) {
    document.getElementById(elementName).className = 'UpdateProgressBlockShow';
}

function ShowWait(elShow, elHide) {
    document.getElementById(elShow).style.visibility = 'visible';
    document.getElementById(elHide).style.visibility = 'hidden';
}

function ShowWaitBlock(elShow, elHide) {
    document.getElementById(elShow).style.display = 'block';
    document.getElementById(elHide).style.display = 'none';
}

function ShowWaitWithConfirm(elShow, elHide) {
    if (confirm('Are you sure you wish to delete this?') == true) {
        document.getElementById(elShow).style.visibility = 'visible';
        document.getElementById(elHide).style.visibility = 'hidden';
        return true
    } else {
        return false
    }
    
}

function HideUpdatePanel(elementName) {
    document.getElementById(elementName).style.display = 'none';
}

function Hide(elementName) {
    document.getElementById(elementName).style.visibility = 'hidden';
}

function HideBlock(elementName) {
    document.getElementById(elementName).style.display = 'none';
}

function ShowBlock(elementName) {
    document.getElementById(elementName).style.display = 'block';
}

function ConfirmCancel() {
    return confirm('Any changes to the information will not be saved.\n\nAre you sure you wish to cancel?');
}

function ConfirmCancelHide(elHide) {
    if (confirm('Any changes to the information will not be saved.\n\nAre you sure you wish to cancel?')) {
        document.getElementById(elHide).style.visibility = 'hidden';
    }
}
function ConfirmAction() {
    return confirm('This action will now be carried out.');
}
function ConfirmDelete() {
    return confirm('Once deleted, the item cannot be recovered.\n\nAre you sure you wish to delete?');
}

function ConfirmRemove() {
    return confirm('This item is about to be removed.\n\nAre you sure you wish to remove this item?');
}

function ConfirmGeneral(str) {
    return confirm(str);
}

function ToggleElement(elName) {
    var e = document.getElementById(elName);
    var OriginalStyle = e.style.display;
    HideAllBlocks();
    if (OriginalStyle == "block") {
        e.style.display = "none";
    } else {
        e.style.display = "block";
    }
}

function OpenHelperWindow(w, h, t, l, url) {
    var winRef;
    var strProperties;
    strProperties = 'width=' + w + ',height=' + h + ',top=' + t + ',left=' + l + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes'
    winRef = window.open(url, 'HelperWindow', strProperties);
    winRef.focus();
}





