﻿function showAlert(msg, url) {
    alert(msg);
    if (url != '') {
        redirectWindow(url);
    }

}

function CloseWindow(msg, url) {
    alert(msg);
    window.close();
}

function redirectWindow(url) {

    if (navigator.appName == 'Microsoft Internet Explorer') {
        location.href(url);
    }
    else if (navigator.appName == 'Netscape') {
        window.open(url, '_parent', 1);
        window.close();
    }
}

function deleteRecord(url) {

    redirectWindow(url);
}


function OpenPopupCenter(pageURL, title, w, h, scroll) {
    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=' + scroll + ', resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}

function redirectURL(url) {
    if (navigator.appName == 'Microsoft Internet Explorer') {
        window.location.href(url);
    } else if (navigator.appName == 'Netscape') {
        window.open(url, '_parent', 1);
        window.close();
    }
}



function IsLen(fld, minlen, maxlen, msg) {
    if (fld.value.length < minlen || fld.value.length > maxlen) {
        alert(msg);
        fld.focus();
        return false;
    }
    return true;
}
