﻿// JScript File

function INVCSubEmCB(result) {
    var clientId = result.context;
    if (result) {
        PBStr(gs(clientId,'esb'),0);
        if (result.value) {
            var l = result.value.split("|");
            if (l.length>1) {
                AL(l[1]);
                if (l[0]=='1') {
                    var e = dge(gs(clientId,'etb'));
                    if (e) {
                        e.value = '';
                    }
                }
            }
        }
    }
}

function INVCSubEm(clientId) {

    PBStr(gs(clientId,'esb'),1);

    var l = gs(clientId,'l');
    var lngs = dge(gs(clientId,'lngs') + '_LNGS');
    if (lngs) {
        l = lngs.value;
    }
    
    var cp = 0;
    var cb = dge(gs(clientId,'cb'));
    if (cb) {
        if (cb.checked) {
            cp = 1;
        }
    }

    var e = dge(gs(clientId,'etb'));
    if (e) {
        AjaxPro.timeoutPeriod = 240000;
        Webscene.UI.INVC.INVCSubEm(clientId, sessionId, nodeId, e.value, gs(clientId,'d'), l, cp, INVCSubEmCB, clientId);
    }
    
}

function INVCSubPro(clientId) {

    // Create an array for all the selected properties

    var result = Webscene.UI.INVC.INVCSubPro(clientId, sessionId, nodeId, p, gs(clientId,'d'), gs(clientId,'l'));
    if (result) {
        if (result.value) {
            var l = result.value.split("|");
            if (l.length>1) {
                AL(l[1]);
                if (l[0]=='1') {
                    e.value = '';
                }
            }
        }
    }
}

