﻿
function GetElement(tagName, elemName) {
    //get tags

    //alert(tagName);
    //alert(elemName);

    var arrElements = document.getElementsByTagName(tagName);
    var theElem = null;
    //alert(arrElements.length);

    for (var i = 0; i < arrElements.length; i++) {
        var elem = arrElements[i];

        var str = new String(elem.name);
        //alert(str);

        if (str.indexOf(elemName) > 5) {
            theElem = elem;
            break;
        }
    }

    return theElem;
}

function NextControl(sourceInput, maxLen, nextControlName) {

    //alert("1");
    if (sourceInput.value.length == maxLen) {
        var elem = GetElement("input", nextControlName);
        elem.focus();
    }
}

function ShowPopUp(configId, w, h, name, scroll, status, resize) {
    var url = "HelpPopup.aspx?id=" + configId;

    var left = (screen.width) ? (screen.width - w) / 2 : 0;
    var top = (screen.height) ? (screen.height - h) / 2 : 0;
    if (!name) { name = "puw"; }
    if (!scroll) { scroll = "yes"; }
    if (!status) { status = "no"; }
    if (!resize) { resize = "no"; }
    var nw = window.open(url, name, "scrollbars=" + scroll + ",status=" + status + ",width=" + w + ",height=" + h + ",top=" + top + ",left=" + left + ",resizable=" + resize + "");
    nw.focus();
}
