
// Function to update the fields in MessagaCompose.aspx page. Used by ifram.230520.js
function MessageComposeUpdate(toTxt, ccTxt, toIds, ccIds, idsEncrypt) {
    $('#ToList').val(toTxt);
    $('#CcList').val(ccTxt);
    $('#hdnToIds').val(toIds);
    $('#hdnCcIds').val(ccIds);

    $('#ToList').attr('title', toTxt);      // Set ToolTip
    $('#CcList').attr('title', ccTxt);      // Set ToolTip

    $('#hdnIdsEncrypt').val(idsEncrypt);    //52924117 Encrypted Ids 

}


// Validate the form if there is any empty fields
function validateDeleteClick() {
    // check if current window has error window opened
    // this process will be terminated
    if (getParentWindow(window).isErrorWindowOpened() || getParentWindow(window).isConfirmWindowOpened())
        return;

    var total = $('#PatientMessageList input[type=checkbox]:checked').length;
    //create confirmation window
    var confirmHeader = "Do you want to delete?";
    var confirmMessage = "You are about to delete " + (total > 1 ? "messages" : "a message") + ". Are you sure you want to continue?";
    var cancelButtonText = "Cancel";
    var okButtonText = "Delete";

    getParentWindow(window).createConfirmWindow(confirmHeader, confirmMessage, cancelButtonText, okButtonText, function () {
        $('#hdnDeleteBtn').trigger('click');	        // AX-24898.24919.2 $('#hdnDeleteBtn').click();
    });
}

//52933097 Disable submit buttons, buttons and disable anchors adding a class
function disableInputBtn() {
    $('input[type=submit]').attr('disabled', 'disabled');
    $('input[type=button]').attr('disabled', 'disabled');
    // Add "disabled" class to anchors and if they have this class return false, so don't trigger server side click function. At server side remove this class 
    // This not work in IE8, because it never go to href after disable as in other browsers. So create hidden buttons
    $('a').addClass('disabled');
    $('a').click(function () {
        if ($(this).hasClass('disabled'))
            return false;
        return true;
    });
}

//53026117 When click anchor tag onclick hidden button
function callSentBtn() {
    $('#hdnSentBtn').trigger('click');	        // AX-24898.24919.2 $('#hdnSentBtn').click();
}

//53026117 When click anchor tag onclick hidden button
function callInboxBtn() {
    $('#hdnInboxBtn').trigger('click');	        // AX-24898.24919.2 $('#hdnInboxBtn').click();
}

