﻿function CheckAll() {
    var inputs = document.aspnetForm.getElementsByTagName("input");
    for (iu = 0; iu < inputs.length; iu++) {
        if (inputs[iu].id == "chkall") {
            var indexs = iu;
        }
    }
    for (iu = 0; iu < inputs.length; iu++) {
        if (inputs[iu].getAttribute('type') == "checkbox") {
            inputs[iu].checked = inputs[indexs].checked;
        }
    }
}


function GetSelected() {

    var cansubmit = false
    //var flag = QueryString("Def")

    var tmp, sc, id
    var icount = 0
    //alert(flag);
    tmp = ""
    var inputs = document.aspnetForm.getElementsByTagName("input");
    for (iu = 0; iu < inputs.length; iu++) {
        if (inputs[iu].getAttribute('type') == "checkbox") {
            if (inputs[iu].checked == true) {
                sc = inputs[iu].id
                tmp = tmp + sc + "|";
                icount = icount + 1
            }
        }
    }

    //alert(tmp);
    document.aspnetForm.txtPerm.value = tmp;
    alert(document.aspnetForm.txtPerm.value);
    if (tmp == "") {
        cansubmit = false;
        alert("No Branch seleced! The user will not be able to see any data.");
    } else {
       // alert("CanSubmit");
        cansubmit = true
    }
    //alert(icount);
    //                if (flag == "true") {
    //                    if (icount > 1) {
    //                        alert("More than one account is selected! Only one account can be the default account");
    //                        cansubmit = false;
    //                    }
    //                }

    return cansubmit;
}




function validData() {
    var cansubmit = true;
    if (document.aspnetForm.ctl00$ContentPlaceHolder1$txtUName.value == "") {
        alert("The user name must be filled in!");
        cansubmit = false;
    } else {
    if (document.aspnetForm.ctl00$ContentPlaceHolder1$txtPwd.value == "") {
            alert("The password must be filled in!");
            cansubmit = false;
        }
    }

    return cansubmit;
}

function getPrint(obj) {
    //Search for the Element and assign it to x
    var x = document.getElementById(obj);
    // reference the stylesheet also so you can get maximum look and feel out of the print
    // Also after adding the stylesheet also put the innerHTML of Object X into the same variable
    var y = "<link href='../StyleSheet.css' rel='stylesheet' type='text/css'/> <br>" + x.innerHTML;
    // Create a new window and display the document in there.
    w = window.open();
    w.document.open();
    w.document.write(y);
    w.print();
    return true;
}


