﻿var win = null;

function NewWindowCenter(mypage, myname, w, h, scroll) {
    LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
    TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;

    settings = 'height=' + h + ',width=' + w + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable=no, status=no';

    win = window.open(mypage, myname, settings)
}

function CheckForm(form, Ctrl, Msg) {

    if (StrTrim(form[Ctrl].value) == "") {
        alert(Msg); form[Ctrl].focus(); return false;
    } else {
        return true;
    }

}

function StrTrim(strText) {
    var txt = "";
    var i_tmp;

    for (i_tmp = 0; i_tmp <= strText.length - 1; i_tmp++) {
        if (strText.charAt(i_tmp) != " ") {
            txt = txt + strText.charAt(i_tmp);
        }
    }

    return txt;
}