﻿var _formId = "aspnetForm";
addLoadListener(init);

function startGrid() {
    if (!imgSec.config_ready) {
        window.setTimeout('startGrid()', 100);
        return;
    }
    imgSec.hideToolTip('vidsec_error');
    imgSec.submitUserID();
}

function init() {
    if (getQueryString("error") != null) {
        //handleErrorMessage(getQueryString("error"));
    }


    var hdnStartImageAuth = getFormField(_formId, _controlPrefix_id + "hdnStartImageAuth");
    if (hdnStartImageAuth != undefined && hdnStartImageAuth.value == "1") {
        imgSec.showToolTip('vidsec_error', 'Connecting Server ......', 402, '', 120, 150, null);
        startGrid();
    }

    if (getFormField(_formId, _controlPrefix_id + "loginControl_UserName").value.length > 0) {
        getFormField(_formId, _controlPrefix_id + "loginControl_Password").focus();
    } else {
    getFormField(_formId, _controlPrefix_id + "loginControl_UserName").focus();
    }
}

function changeLoginParameters(drp) {
    var val = drp.value;
    var username = "";
    var password = "";
    if (val != "" && val.indexOf("/") != -1) {
        //Array sa = val.split('/');
        username = val.split('/')[0];
        password = val.split('/')[1];
    }
    window.document.forms["aspnetForm"].elements["loginControl$UserName"].value = username;
    window.document.forms["aspnetForm"].elements["loginControl$Password"].value = password;
}