/* File Created: August 13, 2014 */


function showAlertDialogYesNo(text) {
    text = decodeEntities(text);                    // AX-542
    var obj = $("#dialogText").text(text);          // 64930882 To allow new lines. text needs to include \n as new line
    obj.html(obj.html().replace(/\n/g, '<br/>'));   // 64930882 To allow new lines
    $("#alert-yes-no").show();
    $("#alert-yes-btn").prop('disabled', false);   
	$("#alert-ok").hide();
	$("#alert-cancel-save").hide();
	$("#alert-ok-cancel").hide();
	$("#alert-send-cancel").hide();                 // AX-1592
	$("#alert-background").show();
}

function showAlertDialogOk(text) {
    text = decodeEntities(text);                    // AX-542
    var obj = $("#dialogText").text(text);          // 64930882 To allow new lines. text needs to include \n as new line
    obj.html(obj.html().replace(/\n/g, '<br/>'));   // 64930882 To allow new lines
    $("#alert-yes-no").hide();
    $("#alert-ok").show();
    $("#alert-cancel-save").hide();
	$("#alert-ok-cancel").hide();
    $("#alert-send-cancel").hide();                 // AX-1592
	$("#alert-background").show();
}

function showAlertDialogOkCancel(text) {
    text = decodeEntities(text);                    // AX-542
    var obj = $("#dialogText").text(text);          // 64930882 To allow new lines. text needs to include \n as new line
    obj.html(obj.html().replace(/\n/g, '<br/>'));   // 64930882 To allow new lines
    $("#alert-yes-no").hide();
    $("#alert-ok").hide();
    $("#alert-cancel-save").hide();
    $("#alert-ok-cancel").show();
    $("#alert-okcancel-btn").prop('disabled', false);   
    $("#alert-send-cancel").hide();                 // AX-1592
	$("#alert-background").show();
}

function showAlertDialogCancelSave(text) {
    text = decodeEntities(text);                    // AX-542
    var obj = $("#dialogText").text(text);          // 64930882 To allow new lines. text needs to include \n as new line
    obj.html(obj.html().replace(/\n/g, '<br/>'));   // 64930882 To allow new lines
    $("#alert-yes-no").hide();
    $("#alert-ok").hide();
    $("#alert-cancel-save").show();
    $("#alert-send-cancel").hide();                 // AX-1592
    $("#alert-background").show();
}

// AX-1592
function showAlertDialogSendCancel(text) {
    text = decodeEntities(text);                    // AX-542
    var obj = $("#dialogText").text(text);          // 64930882 To allow new lines. text needs to include \n as new line
    obj.html(obj.html().replace(/\n/g, '<br/>'));   // 64930882 To allow new lines
    $("#alert-yes-no").hide();
    $("#alert-ok").hide();
    $("#alert-cancel-save").hide();
	$("#alert-ok-cancel").hide();
    $("#alert-send-cancel").show();
	$("#alert-background").show();
}

function hideAlertDialog() {
	$("#alert-background").hide();
}

// AX-542 Spanish, to manage tildes "Acentos"
function decodeEntities(input) {
    var y = document.createElement('textarea');
    y.innerHTML = input;
    return y.value;
}