﻿var deleteConfirm = "Are you sure you want to delete?";
var archieveConfirm = "Are you sure you want to archive?";

function selectString(str) {
    return "Please select " + str + ".";
}

function requiredString(str) {
    return "Please enter value of " + str + ".";
}

//var dFeatures = 'dialogHeight: 200px; dialogWidth: 400px; dialogTop: 646px; dialogLeft: 220px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;'; //default features
var dFeatures = 'dialogHeight: 200px; dialogWidth: 400px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;'; //default features

var modalWin = "null";
var returnValue = "";
var pHeight, pWidth;
function xShowModalDialog(sURL, vArguments, sFeatures) {
    if (sURL == null || sURL == '') {
        alert("Invalid URL input.");
        return false;
    }
    if (vArguments == null || vArguments == '') {
        vArguments = '';
    }
    if (sFeatures == null || sFeatures == '') {
        sFeatures = dFeatures;
    }
    //alert("window.navigator.appVersion="+window.navigator.appVersion);
    if (window.navigator.appVersion.indexOf("MSIE") != -1) {
        returnValue = window.showModalDialog(sURL, vArguments, sFeatures);
        return false;
    }
    sFeatures = sFeatures.replace(/ /gi, '');
    aFeatures = sFeatures.split(";");
    sWinFeat = "directories=0,menubar=0,titlebar=0,toolbar=0,";
    for (x in aFeatures) {
        aTmp = aFeatures[x].split(":");
        sKey = aTmp[0].toLowerCase();
        sVal = aTmp[1];
        switch (sKey) {
            case "dialogheight":
                sWinFeat += "height=" + sVal + ",";
                pHeight = sVal.replace('px', '');
                break;
            case "dialogwidth":
                sWinFeat += "width=" + sVal + ",";
                pWidth = sVal.replace('px', '');
                break;
            case "dialogtop":
                sWinFeat += "screenY=" + sVal + ",";
                break;
            case "dialogleft":
                sWinFeat += "screenX=" + sVal + ",";
                break;
            case "resizable":
                sWinFeat += "resizable=" + sVal + ",";
                break;
            case "status":
                sWinFeat += "status=" + sVal + ",";
                break;
            case "center":
                if (sVal.toLowerCase() == "yes") {
                    sWinFeat += "screenY=" + ((screen.availHeight - pHeight) / 2) + ",";
                    sWinFeat += "screenX=" + ((screen.availWidth - pWidth) / 2) + ",";
                }
                break;
        }
    }
    modalWin = window.open(String(sURL), "", sWinFeat);
    if (vArguments != null && vArguments != '') {
        modalWin.dialogArguments = vArguments;
    }
}
// Input box functions...
function CheckAlpha(e) {
    var k;
    document.all ? k = e.keyCode : k = e.which;
    return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k == 0);
}
function CheckAlphaWithSpace(e) {
    var k;
    document.all ? k = e.keyCode : k = e.which;
    return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k == 0 || k == 32);
}
function CheckNumeric(e, cnt) {
    var k;
    document.all ? k = e.keyCode : k = e.which;
    var srcVal = e.srcElement.value;
    if (srcVal.indexOf('.') > -1) {
        if (k == 46) return false;
        if (srcVal.substring(srcVal.indexOf('.'), srcVal.length).length > cnt) {
            return false;
        }
    }
    return ((k >= 48 && k <= 57) || k == 46 || k == 8 || k == 0);
}
function CheckCompany(e) {
    var k;
    document.all ? k = e.keyCode : k = e.which;
    return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8 || k == 0 || k == 38 || k == 39 || k == 45 || k == 46 || k == 32);
}
function CheckContactNo(e) {
    var k;
    document.all ? k = e.keyCode : k = e.which;
    return ((k >= 48 && k <= 57) || k == 8 || k == 0);
}
