﻿
var theForm = document.forms['Form'];
if (!theForm) {
    theForm = document.Form;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}


function swapVisibility(obj,itemId) {
if (obj.style.display=="none")
    obj.style.display = "";
else
    obj.style.display = "none";
}

function expandAll(tblI,ctlID) {
    var tbls = document.getElementsByTagName('table');
    for (var tbl=0; tbl<tbls.length; tbl++) {
        if ((tbls[tbl].id.indexOf('tblQA')>=0) && tbls[tbl].style.display=='') {            for (var x=0; x<tbls[tbl].rows.length; x++) {
                if (tbls[tbl].rows[x].id.indexOf(ctlID + "A")==0)
                    tbls[tbl].rows[x].style.display="";
            }
        }
    }
}

function collapseAll(tblI,ctlID) {
    var tbls = document.getElementsByTagName('table');
    for (var tbl=0; tbl<tbls.length; tbl++) {
        if ((tbls[tbl].id.indexOf('tblQA')>=0) && tbls[tbl].style.display=='') {            for (var x=0; x<tbls[tbl].rows.length; x++) {
                if (tbls[tbl].rows[x].id.indexOf(ctlID + "A")==0)
                    tbls[tbl].rows[x].style.display="none";
            }
        }
    }
}

function showVisibility(obj) {
    obj.style.display = "";
}

function hideVisibility(obj) {
    obj.style.display = "none";
}


function findParent(startElement,findID) {
    try {
    while (startElement.parentNode!=null) {
        if (startElement.parentNode.id==findID) { return true;}
        startElement = startElement.parentNode;}
    return false;
    } catch (e) {
       alert('Error:' + e.description); return false;
    }
}

function showTable(tblID,ctlID) {
    try {
    var tbls = document.getElementsByTagName('table');
    for (var x=0; x<tbls.length; x++) {
        if ((tbls[x].id.indexOf('tblQA')>=0) && (findParent(tbls[x],ctlID))) {
           if (tbls[x].id.indexOf('tblQA' + tblID)>=0) {
               tbls[x].style.display='';
           }
           else {
               tbls[x].style.display='none';
           }
       }
    }
    } catch (e) {
       alert(e.description); return false;
    }
}
