﻿
function onKeyDown() {
    // current pressed key 
    var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();
    if (event.ctrlKey && (pressedKey == "c" || pressedKey == "v")) {
        // disable key press porcessing 
        event.returnValue = false;
    }
}
function VisibilityShow(controlId) {
    var control = document.getElementById(controlId);
    if (control.style.visibility != "visible" || control.style.visibility != "")
        control.style.visibility = "visible";

}
function VisibilityHide(controlId) {
    var control = document.getElementById(controlId);
    if (control.style.visibility == "visible" || control.style.visibility == "")
        control.style.visibility = "hidden";
}
function ShowVisibility(controlOne, controlTwo) {
    var FirstId = document.getElementById(controlOne);
    var SecoundId = document.getElementById(controlTwo);
    if (FirstId.style.visibility != "visible" || FirstId.style.visibility != "")
        FirstId.style.visibility = "visible";
    if (SecoundId.style.visibility != "visible" || SecoundId.style.visibility != "")
        SecoundId.style.visibility = "visible";
}
function HideVisibility(controlOne, controlTwo) {
    var FirstId = document.getElementById(controlOne);
    var SecoundId = document.getElementById(controlTwo);
    if (FirstId.style.visibility == "visible" || FirstId.style.visibility == "")
        FirstId.style.visibility = "hidden";
    if (SecoundId.style.visibility == "visible" || SecoundId.style.visibility == "")
        SecoundId.style.visibility = "hidden";
}

function DivShow(FirstcontrolId) {
    var controlFirst = document.getElementById(FirstcontrolId);

    if (controlFirst.style.display != "inline") {
        controlFirst.style.display = "inline";

    }

}
function DivHide(FirstcontrolId) {
    var controlFirst = document.getElementById(FirstcontrolId);
    if (controlFirst.style.display == "inline") {
        controlFirst.style.display = "none";
    }
}
function ShowBrowseDialog(id) {
    var originalFileUploadRef = document.getElementById('ctl00_ContentPlaceHolderMaster_originalFileUpload' + id);
    originalFileUploadRef.click();
}
function SetTxtSelectedFile(id) {
    var txtSelectedFileRef = document.getElementById('ctl00_ContentPlaceHolderMaster_txtSelectedFile' + id);
    txtSelectedFileRef.value = document.getElementById('ctl00_ContentPlaceHolderMaster_originalFileUpload' + id).value;
}
function CheckedChanged() {

    var BtnApprove = document.getElementById("ctl00_ctl00_ContentPlaceHolderMaster_ContentNestedMaster_BtnApprove");
    var CheckBoxApprove = document.getElementById("ctl00_ctl00_ContentPlaceHolderMaster_ContentNestedMaster_CheckBoxApprove");
    if (CheckBoxApprove.checked == false)
        BtnApprove.disabled = true;
    else
        BtnApprove.disabled = false;
}
function popWin(PageName, width, height) {
    window.open(PageName.toString(), "EmbassiesWindow", "width=" + width.toString() + ",height=" + height.toString() + ",status=1,scrollbars=1,menubar=0,resizable=0,directories=0,toolbar=0,location=0");
    return false;
}
function popWinAllDisabled(PageName, width, height) {
    window.open(PageName.toString(), "EmbassiesWindow", "width=" + width.toString() + ",height=" + height.toString() + ",status=1,scrollbars=0,menubar=0,resizable=0,directories=0,toolbar=0,location=0");
    return false;
}
function OpenerImage(FormName, ControlName, ValueString) {
    var StringName = "window.opener.parent." + FormName + "." + ControlName + ".src='" + ValueString + "'";
    if (window.opener && !window.opener.closed)
        eval(StringName);
    window.close();
}
function OpenerImageValues(ImageUrl, ImageId) {

    if (window.opener && !window.opener.closed) {
        window.opener.parent.aspnetForm.ctl00_ContentPlaceHolderMaster_Image1.src = ImageUrl;
        window.opener.parent.aspnetForm.ctl00_ContentPlaceHolderMaster_Image1.alt = ImageId;
    }
    window.close();
}

function IEresolution(Table) {
    if (screen.width >= 1024) {
        var element = getElementById(Table);
        element.setAttribute("class", LogoExtend);
    }
}
var latinKeys = new Array(1584, 1588, 1575, 1572, 1610, 1579, 1576, 1604, 1575, 1607, 1578, 1606, 1605, 1577, 1609, 1582, 1581, 1590, 1602, 1587, 1601, 1593, 1585, 1589, 1569, 1594, 1574);
var shftLatinKeys = new Array(1617, 1616, 1570, 125, 93, 1615, 91, 1571, 1571, 247, 1600, 1548, 47, 8271, 1570, 215, 1563, 1614, 1612, 1613, 1573, 8216, 123, 1611, 1618, 1573, 126);
var specialKeys = new Array(new Array(39, 44, 46, 47, 59, 91, 93, 126, 40, 41, 123, 125, 58, 34, 60, 62, 63), new Array(1591, 1608, 1586, 1592, 1603, 1580, 1583, 1617, 41, 40, 60, 62, 58, 34, 44, 46, 1567));
var sd;

function EngToArabic() {
    var seek = 0;
    var addL = false;

    if (event.keyCode == 13) {
        return false;
    }
    if (event.keyCode > 47 && event.keyCode < 59) {
        if (indianNumberFormat) {
            event.keyCode += 1584;
        }
        return false;
    }
    else if (event.keyCode > 95 && event.keyCode < 123) {
        seek = 96;
    }
    else if (event.keyCode > 64 && event.keyCode < 91)
        seek = 64;
    if (event.keyCode == 98 || event.keyCode == 66 || event.keyCode == 71 || event.keyCode == 84)
        addL = true;
    if (seek > 0) {
        if (event.shiftKey)
            event.keyCode = shftLatinKeys[event.keyCode - seek];
        else {
            event.keyCode = latinKeys[event.keyCode - seek];

        }
        if (addL)
            event.srcElement.value += String.fromCharCode(1604);
    }
    else {
        for (var i = 0; i < specialKeys[0].length; i++) {
            if (specialKeys[0][i] == event.keyCode) {
                event.keyCode = specialKeys[1][i];
                break;
            }
        }
    }
}
function isEnglishOnly(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if ((charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || (charCode == 32))
        return true;
    return false;
}
function isEnglishOnlyAddress(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if ((charCode >= 48 && charCode <= 57) || (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122)
     || (charCode == 32))
        return true;
    return false;
}
function isEnglish(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if ((charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122))
        return true;
    return false;
}
