function LoadCategoryPopup(IsDuplicateCatName) {
    //copy of landmark script
    var isIE = CheckBrowser();
    var pnlCategory = document.getElementById("pnlAddEditLandmarkCategory");
    pnlCategory.style.display = "block";

    if (IsDuplicateCatName == "True") {
        TrinetraCustomAlerts(categoryNameExists);
        document.getElementById("txtCustomerNme").focus();
        document.getElementById('txtCustomerNme').style.backgroundColor = 'lightyellow';
    }
    else {
        document.getElementById('txtCustomerNme').style.backgroundColor = 'white';
    }
}


function CloseCategoryPopup() {
    var pnlCategory = document.getElementById("pnlAddEditLandmarkCategory");
    var lnkadd = document.getElementById("lnkAdd");
    pnlCategory.style.display = "none";
    setFocusToControl('ddlCategory');
    lnkadd.style.display = "block";
    //ShowHideCategoryIcons();
}

function ValidateCategory() {
    var isError = false;
    var alertMessage = '';
    var controlToBeFocussed = '';
    if (RemoveSpaces(document.getElementById("txtCustomerNme")).length == 0) {
        isError = true; alertMessage = "Please enter the Customer Name";
        controlToBeFocussed = document.getElementById("txtCustomerNme");
        document.getElementById("txtCustomerNme").style.backgroundColor = 'lightyellow';
    }
    else {
        document.getElementById("txtCustomerNme").style.backgroundColor = 'white';
    }

    if (isError) {
        TrinetraCustomAlerts(alertMessage);
        try {
            controlToBeFocussed.focus();
        }
        catch (Error) { }
    }
    return !isError;
}

function AddCategory() {
    var isIE = CheckBrowser();
    ClearCategoryDetails();
    LoadCategoryPopup("False");

    //document.getElementById("hdnCategoryOprType").value = 'Add';

    if (document.getElementById("lnkAdd") != null) {
        document.getElementById("lnkAdd").style.display = "block";
        
        document.getElementById('txtCustomerNme').focus();
    }
     
    HidePopUp();
}
function ClearCategoryDetails() {
    document.getElementById("txtCustomerNme").value = "";
    document.getElementById("txtLocation").value = "";     
}

function ValidateCustomerdetails() {
    var CustomerName = document.getElementById('txtCustomerName');
    var Email = document.getElementById('txtEmail');
    var MobileNo = document.getElementById('txtMobileNo');
    var txtCustomerCode = document.getElementById('txtCustomerCode');
    var txtAddress = document.getElementById('txtAddress');

    var isError = false;
    var controlToBeFocused;
    var alertMessage = '';

    if (RemoveSpaces(CustomerName).length == 0) {
        alertMessage += (alertMessage.length == 0 ? '' : '</br>') + 'Please enter the Customer Name.';
        if (!isError) {
            controlToBeFocused = CustomerName;
            isError = true;
        }
        CustomerName.style.backgroundColor = 'lightyellow';
    }

    if (RemoveSpaces(Email).length == 0) {
        alertMessage += (alertMessage.length == 0 ? '' : '</br>') + 'Please enter the Email ID.';
        if (!isError) {
            //controlToBeFocused = Email;
            isError = true;
        }
       Email.style.backgroundColor = 'lightyellow';
    }


    if (RemoveSpaces(MobileNo).length == 0) {
        alertMessage += (alertMessage.length == 0 ? '' : '</br>') + 'Please enter the Mobile Number.';
        if (!isError) {            
            isError = true;
        }
        controlToBeFocused = MobileNo;
        MobileNo.style.backgroundColor = 'lightyellow';
    }
    if (RemoveSpaces(txtCustomerCode).length == 0) {
        alertMessage += (alertMessage.length == 0 ? '' : '</br>') + 'Please enter the Customer Code.';
        if (!isError) {
            isError = true;
        }
        controlToBeFocused = txtCustomerCode;
        txtCustomerCode.style.backgroundColor = 'lightyellow';
    }
    if (RemoveSpaces(txtAddress).length == 0) {
        alertMessage += (alertMessage.length == 0 ? '' : '</br>') + 'Please enter the Customer Address.';
        if (!isError) {
            isError = true;
        }
        controlToBeFocused = txtAddress;
        txtAddress.style.backgroundColor = 'lightyellow';
    }
    if (isError) {
        controlToBeFocused.focus();
        TrinetraCustomAlerts(alertMessage);
        return false;
    }
    else {
        return true;
    }
}