function popUp(Url, PopupName, dl_width, dl_height, scrollbars){

    if (dl_width == undefined) dl_width = 1000;
    if (dl_height == undefined) dl_height = 620;
    if (scrollbars == undefined) scrollbars = 'no';

     var x     = Math.round((screen.availWidth  - dl_width) / 2);
     var y     = Math.round((screen.availHeight - dl_height) / 2);

    window.open(
        Url,
        PopupName,
        "left=" + x + ",top=" + y + "," + 
        "scrollbars=" + scrollbars + "," + 
        "resizable=no," + 
        "width=" + dl_width + "," + 
        "height=" + dl_height + "," + 
        "menubar=no"
    );

}

// Validate EGN funcion

function jsUCNValidate(sender, args) {
    var ControlDigit = -1;
    var ControlSum = 0;

    ControlSum = parseInt(args.Value[0]) * 2;
    ControlSum = ControlSum + parseInt(args.Value[1]) * 4;
    ControlSum = ControlSum + parseInt(args.Value[2]) * 8;
    ControlSum = ControlSum + parseInt(args.Value[3]) * 5;
    ControlSum = ControlSum + parseInt(args.Value[4]) * 10;
    ControlSum = ControlSum + parseInt(args.Value[5]) * 9;
    ControlSum = ControlSum + parseInt(args.Value[6]) * 7;
    ControlSum = ControlSum + parseInt(args.Value[7]) * 3;
    ControlSum = ControlSum + parseInt(args.Value[8]) * 6;
    
    ControlDigit = ControlSum % 11;

    if (ControlDigit == 10) ControlDigit = 0;
    if (parseInt(args.Value[9]) != ControlDigit) {
        args.IsValid = false;
        return;
    }
    args.IsValid = true;
}

