function confirmDelete(objectName) {
    if(confirm('Are you sure you want to delete the '+objectName))
        return true;
    else
        return false;
}

function toggleDisplay(objectId, objectStatus) {
    if(objectStatus == 'display')
        document.getElementById(objectId).style.display='block';
    else if(objectStatus == 'remove')
        document.getElementById(objectId).style.display='none';

}

function toggleQuestionTypeDisplay(currentObject, objectsList) {
    var currentObjectId = 'questionType_'+currentObject.value;
    var objectsArr = objectsList.split(',');
    for(var i=0; i < objectsArr.length;i++) {
        var objectId = 'questionType_'+objectsArr[i];
        if(objectId == currentObjectId)
            document.getElementById(objectId).style.display='block';
        else
        document.getElementById(objectId).style.display='none';
    }
}

function toggleDisplayAndButton(callerDiv, objectId, objectStatus) {
    if(objectStatus == 'display') {
        document.getElementById('callerDiv').innerHTML = '<a href="javascript:toggleDisplayAndButton(\'callerdiv\', \'questionTypeSample\',\'remove\');" class="skyblue">Hide Display</a>';
    } else {
        document.getElementById('callerDiv').innerHTML = '<a href="javascript:toggleDisplayAndButton(\'callerdiv\', \'questionTypeSample\',\'display\');" class="skyblue">Show Display</a>';
    }
    toggleDisplay(objectId, objectStatus);

}


function openContentWindow(divId, divTitle, divWidth, divHeight){
    contentwindow=dhtmlmodal.open('Contents', 'div', divId, divTitle, 'width='+divWidth+',height='+divHeight+',center=1,resize=0,scrolling=1')
}

function removeItemRelation (relationId, parentId, itemId, submitPage) {
    var agree=confirm('Are you sure you wish to remove this entry?');
    if (agree)
        var myAjax = new Ajax.Updater('itemKidsList', submitPage, { parameters:'action=deleteRelation&relationId='+relationId+'&parentId='+parentId+'&itemId='+itemId, evalScripts:true, asynchronous:false});
}

function changeItemRelationStatus (relationId, parentId, itemId, itemStatus, submitPage) {
    var myAjax = new Ajax.Updater('itemKidsList', submitPage, { parameters:'action=changeRelationStatus&relationId='+relationId+'&parentId='+parentId+'&itemId='+itemId+'&status='+itemStatus, evalScripts:true, asynchronous:false});
}

function displayOptionBoxes (selectBox, submitPage) {
    var questionTypeId = selectBox.value;
    var myAjax = new Ajax.Updater('optionBoxes', submitPage, { parameters:'action=displayOptionBoxes&questionTypeId='+questionTypeId, evalScripts:true, asynchronous:false});
}

function displayTitlesOfTab (selectBox, submitPage) {
    var parentId = selectBox.value;
        document.getElementById('sectionsOfTitle').innerHTML ='';
    var myAjax = new Ajax.Updater('titlesOfTab', submitPage, { parameters:'action=displayKidsOfParent&parentItem=tab&parentId='+parentId, evalScripts:true, asynchronous:false});
}

function displaySectionsOfTitle (selectBox, submitPage, parentTabId) {
    var parentId = selectBox.value;
    var myAjax = new Ajax.Updater('sectionsOfTitle', submitPage, { parameters:'action=displayKidsOfParent&parentItem=tab_title_relation&parentId='+parentId+'&parentTabId='+parentTabId, evalScripts:true, asynchronous:false});
}

function displayQTypeSpecificData (selectBox, submitPage) {
    var display = selectBox.value;

    if(display == 'tabular') {
        document.getElementById('questionRowCountErr').style.visibility = 'visible';
        document.getElementById('questionColumnCountErr').style.visibility = 'visible';
        document.getElementById('questionFieldErr').style.visibility = 'hidden';
        document.getElementById('questionBoxesAddDiv').innerHTML = '';
    } else if(display == 'single') {
        document.getElementById('questionRowCountErr').style.visibility = 'hidden';
        document.getElementById('questionColumnCountErr').style.visibility = 'hidden';
        document.getElementById('questionFieldErr').style.visibility = 'visible';
        document.getElementById('questionRowCountDiv').innerHTML = '';
        document.getElementById('questionColumnCountDiv').innerHTML = '';
    } else if(display == 'inline') {
        document.getElementById('questionRowCountErr').style.visibility = 'hidden';
        document.getElementById('questionColumnCountErr').style.visibility = 'hidden';
        document.getElementById('questionFieldErr').style.visibility = 'hidden';
        document.getElementById('questionRowCountDiv').innerHTML = '';
        document.getElementById('questionColumnCountDiv').innerHTML = '';
    } else if(display == 'person' || display == 'salesperson') {
        document.getElementById('questionRowCountErr').style.visibility = 'hidden';
        document.getElementById('questionColumnCountErr').style.visibility = 'hidden';
        document.getElementById('questionFieldErr').style.visibility = 'visible';
        document.getElementById('questionRowCountDiv').innerHTML = '';
        document.getElementById('questionColumnCountDiv').innerHTML = '';
    } else {
        document.getElementById('questionRowCountErr').style.visibility = 'hidden';
        document.getElementById('questionColumnCountErr').style.visibility = 'hidden';
        document.getElementById('questionFieldErr').style.visibility = 'hidden';
        document.getElementById('questionBoxesAddDiv').innerHTML = '';
        document.getElementById('questionRowCountDiv').innerHTML = '';
        document.getElementById('questionColumnCountDiv').innerHTML = '';
    }

    if(display == 'inline') {
        var myAjax = new Ajax.Updater('questionBoxesAddDiv', submitPage, { parameters:'action=displayQuestionFields&display='+display, evalScripts:true, asynchronous:false});
    } else if(display == 'single') {
        var myAjax = new Ajax.Updater('questionBoxesAddDiv', submitPage, { parameters:'action=displayQuestionFieldsToggle', evalScripts:true, asynchronous:false});
    } else if(display == 'tabular') {
        var myAjax = new Ajax.Updater('questionRowCountDiv', submitPage, { parameters:'action=displayRowCount&display='+display, evalScripts:true, asynchronous:false});
    
        var myAjax = new Ajax.Updater('questionColumnCountDiv', submitPage, { parameters:'action=displayColumnCount&display='+display, evalScripts:true, asynchronous:false});
    } else if(display == 'person' || display == 'salesperson') {
        var myAjax = new Ajax.Updater('questionBoxesAddDiv', submitPage, { parameters:'action=displayNewPersonDataGroup', evalScripts:true, asynchronous:false});
    }

}

function displayPersonDataGroups (selectBox, submitPage) {
    var questionFieldId = selectBox.value;
    var myAjax = new Ajax.Updater('displayPersonDataGroups', submitPage, { parameters:'action=displayPersonDataGroups&questionFieldId='+questionFieldId, evalScripts:true, asynchronous:false});

}

function displayAddQuestionBoxForm (submitPage, parentDivId, contentsDiv, questionFieldId) {
    optionCounter =0;
    var myquestionFieldId = '';
    openContentWindow(parentDivId, 'Add QuestionBox', '650', '450');
    if(questionFieldId)
        myquestionFieldId = questionFieldId;
    var myAjax = new Ajax.Updater(contentsDiv, submitPage, { parameters:'action=displayAddQuestionFieldForm&questionDisplay=inline&questionFieldId='+myquestionFieldId, evalScripts:true, asynchronous:false});

}


function openFormWindow(parentDivId, divTitle, questionId, datatype, row, column, submitPage){

    if(datatype == 'cleardata') {
        if(confirm('Are you sure you want to clear this cell')) {
            var myAjax = new Ajax.Updater('data_'+row+'_'+column, submitPage, { parameters:'action=clearQuestionCell&row='+row+'&column='+column+'&questionId='+questionId, evalScripts:true, asynchronous:false});
        }
    } else {
        contentwindow = dhtmlmodal.open('Contents', 'div', parentDivId, divTitle, 'width=450,height=350,center=1,resize=0,scrolling=1')
    
        var divId = 'data_' +row + '_' + column;
    
        if(datatype == 'label') {
            var myAjax = new Ajax.Updater('contentDiv', submitPage, { parameters:'action=displayAddLabelForm&row='+row+'&column='+column+'&questionId='+questionId, evalScripts:true, asynchronous:false});
        } else if(datatype == 'question') {
            var myAjax = new Ajax.Updater('contentDiv', submitPage, { parameters:'action=displayAddQuestionFieldForm&row='+row+'&column='+column+'&questionId='+questionId, evalScripts:true, asynchronous:false});
        } else if(datatype == 'person') {
            var myAjax = new Ajax.Updater('contentDiv', submitPage, { parameters:'action=displayAddPersonFieldForm&row='+row+'&column='+column+'&questionId='+questionId, evalScripts:true, asynchronous:false});
        }
    }

}

function Trim(str) {
    return LTrim(RTrim(str));
}
function LTrim(str) { 
    for (var ii=0; ii<str.length && str.charAt(ii)<=" " ; ii++) ;
        return str.substring(ii,str.length);
}
function RTrim(str) {
    for (var ii=str.length-1; ii>=0 && str.charAt(ii)<=" " ; ii--) ;
        return str.substring(0,ii+1);
}


function addQuestionLabel(submitPage) {

    var a_errors = new Array();
    if(Trim(document.getElementById('questionLabel').value) =='') {
        document.getElementById('errdiv_questionLabel').innerHTML='Please Enter the question label';
        return false;
    } else {

        var row = document.getElementById('row').value;
        var column = document.getElementById('column').value;
        var questionId = document.getElementById('questionId').value;
        var questionLabel = encodeURIComponent(document.getElementById('questionLabel').value);
        var myAjax = new Ajax.Updater('data_'+row+'_'+column, submitPage, { parameters:'action=addQuestionLabel&row='+row+'&column='+column+'&questionId='+questionId+'&questionLabel='+questionLabel, evalScripts:true, asynchronous:false});

        dhtmlmodal.close(contentwindow);
    }
}

function addQuestionFieldToCell(submitPage) {
   var a_errors = new Array();
    if(Trim(document.getElementById('questionField').value) =='') {
        document.getElementById('errdiv_questionField').innerHTML='Please select a Question Field';
        return false;
    } else {
        var questionFieldId = document.getElementById('questionField').value;
        var row = document.getElementById('row').value;
        var column = document.getElementById('column').value;
        var questionId = document.getElementById('questionId').value;

        var mandatory =  document.getElementsByName('questionFieldMandatory');
        var questionFieldMandatory = 'yes';
        for(i in mandatory) {
            if(mandatory[i].checked)
                questionFieldMandatory = mandatory[i].value;
        }
        var myAjax = new Ajax.Updater('data_'+row+'_'+column, submitPage, { parameters:'action=addQuestionFieldToCell&row='+row+'&column='+column+'&questionId='+questionId+'&questionFieldId='+questionFieldId+'&questionFieldMandatory='+questionFieldMandatory, evalScripts:true, asynchronous:false});
    }
    dhtmlmodal.close(contentwindow);

}

function addPersonFieldToCell(submitPage) {
    var a_errors = new Array();
    var personDataGroupId = Trim(document.getElementById('personDataGroupId').value);
    var newPersonDataGroup = encodeURIComponent(Trim(document.getElementById('newPersonDataGroup').value));

    if(Trim(document.getElementById('personField').value) =='') {
        document.getElementById('errdiv_personField').innerHTML='Please select a Person Field';
        return false;
    } else {
        if(personDataGroupId !='' || newPersonDataGroup !=''){
            var questionFieldId = document.getElementById('personField').value;
            var row = document.getElementById('row').value;
            var column = document.getElementById('column').value;
            var questionId = document.getElementById('questionId').value;
            var myAjax = new Ajax.Updater('data_'+row+'_'+column, submitPage, { parameters:'action=addPersonFieldToCell&row='+row+'&column='+column+'&questionId='+questionId+'&questionFieldId='+questionFieldId+'&personDataGroupId='+personDataGroupId+'&newPersonDataGroup='+newPersonDataGroup, evalScripts:true, asynchronous:false});
        } else {
            document.getElementById('errdiv_personData').innerHTML='Please select a personDataGroupId Name or add a new personDataGroupId Name';
            return false;
        }
    }
    dhtmlmodal.close(contentwindow);

}

var optionCounter =0;

function addMoreOptions(parentDivId, divBaseName, optionBaseName, count, step){
        if(count>0 && optionCounter==0)
            optionCounter = count;
        var optionkidcount =0;
        for (var i=0; i<document.getElementById(parentDivId).childNodes.length; i++) {
/*         for(i in document.getElementById(parentDivId).childNodes) {*/
            if(typeof document.getElementById(parentDivId).childNodes[i] == 'object') {
                if(document.getElementById(parentDivId).childNodes[i].nodeName == 'DIV')
                    optionkidcount++;
            }
        }
        var parentDiv = document.getElementById(parentDivId);
        var newDivId = divBaseName+optionCounter;
        var newDiv = document.createElement('div');
        newDiv.setAttribute('id',newDivId);

        newDiv.setAttribute('class','form_optionSet');
        if(step > 1)
            newDiv.style.padding='1px 0px 0px 25px';

        if(step > document.getElementById('questionOptionLevels').value)
            document.getElementById('questionOptionLevels').value = step;

//         newDiv.innerHTML ="<input type=\"text\" name=\""+optionBaseName+"["+optionCounter+"]\" id=\""+optionBaseName+"["+optionCounter+"]\"  class=\"form_input\" \"/>";

        inputBox = document.createElement("input");
        inputBox.type = "text";
        inputBox.name = optionBaseName+"["+optionCounter+"]";
        inputBox.id = optionBaseName+"["+optionCounter+"]";
        inputBox.className = "form_input";
        newDiv.appendChild(inputBox);


        removeLink = document.createElement("a");
        removeLink.href = "javascript:removeOption('"+parentDivId+"','"+newDivId+"');";
        removeLink.className = "skyblue";
        removeLink.appendChild(document.createTextNode("(Remove)"));
        newDiv.appendChild(removeLink);

//         newDiv.innerHTML+="<a href=\"javascript:\" class=\"skyblue\" onclick=\"removeOption('"+parentDivId+"','"+newDivId+"');\"> (Remove) </a>";
        if(step >= 1) {
            suboptionLink = document.createElement("a");
            suboptionLink.href = "javascript:addMoreOptions('"+newDivId+"', '"+newDivId+"_', '"+optionBaseName+"["+optionCounter+"][kids]', '"+optionkidcount+"', '"+(++step)+"');";
            suboptionLink.className = "skyblue";
            suboptionLink.appendChild(document.createTextNode("(Add sub-option)"));
            newDiv.appendChild(suboptionLink);

//             newDiv.innerHTML+="<a href=\"javascript:\" class=\"skyblue\" onclick=\"addMoreOptions('"+newDivId+"', '"+newDivId+"_', '"+optionBaseName+"["+optionCounter+"][kids]', '"+optionkidcount+"', '"+(++step)+"');\"> (Add sub-option) </a>";
        }

        parentDiv.appendChild(newDiv);
        optionCounter++;
}

function removeOption(parentDivId, divName){
        var parentDiv = document.getElementById(parentDivId);
        var divName = document.getElementById(divName);
        parentDiv.removeChild(divName);
}

function collectDataRecursively(baseName, baseCount, optionCounter, questionOptions) {
    var steps = document.getElementById('questionOptionLevels').value;
    var i = baseCount;
    var newbaseCount = baseCount ;
    for(i; i< optionCounter ; i++) {
        var element = baseName+'['+i+']';
//  alert(element);
        if(document.getElementById(element)) {
            questionOptions += '\n&'+element+'[parent]='+encodeURIComponent(document.getElementById(element).value);
            if(newbaseCount < steps) {
                var element = baseName+'['+i+'][kids]';
                questionOptions += collectDataRecursively(element, (i), optionCounter, '');
            }
        }
    }

    return questionOptions;
}

function addQuestionField(submitPage, optionCount, questionDisplay) {

    if(optionCount>0 && optionCounter==0)
        optionCounter = optionCount;
   var a_errors = new Array();
    if(Trim(document.getElementById('questionType').value) =='') {
        document.getElementById('errdiv_questionType').innerHTML='Please Enter the question type';
        return false;
    } else if(Trim(document.getElementById('questionName').value) =='') {
        document.getElementById('errdiv_questionName').innerHTML='Please Enter the question Name';
        return false;
    } else {
        var questionFieldId = '';
        if(Trim(document.getElementById('questionFieldId').value) !='')
            questionFieldId = document.getElementById('questionFieldId').value;


        var questionName = encodeURIComponent(document.getElementById('questionName').value);
        var questionType = document.getElementById('questionType').value;
        var questionValidation = document.getElementById('questionValidation').value;
        var questionCssclass = document.getElementById('questionCssclass').value;
        var questionOptions = '';
        var questionOptionLevels = '';
        var questionOptions = collectDataRecursively('questionOptions', 0, optionCounter, '');
        var questionOptionLevels = '&questionOptionLevels='+ document.getElementById('questionOptionLevels').value;
// alert(questionOptions);
/*
        for(var i=0; i< optionCounter ; i++) {

            var optionId = 'questionOptions['+i+']';
            if(document.getElementById(optionId)) {
                questionOptions += '&questionOptions['+i+']='+encodeURIComponent(document.getElementById(optionId).value);
            }
            for(var j=0; j< optionCounter ; j++) {
    
                var optionkidId = 'questionOptionsKids['+i+']['+j+']';
                if(document.getElementById(optionkidId)) {
                    questionOptionsKids += '&questionOptionsKids['+i+'][]='+encodeURIComponent(document.getElementById(optionkidId).value);
                }
    
            }

        }
*/

        if(questionDisplay == 'inline') {
            document.getElementById('questionBoxesAddDiv').style.display = 'block';

            var myAjax = new Ajax.Updater('questionBoxesAddDiv', submitPage, { parameters:'action=addInlineQuestionField&questionFieldId='+questionFieldId+'&questionName='+questionName+'&questionType='+questionType+'&questionValidation='+questionValidation+'&questionCssclass='+questionCssclass+questionOptions, evalScripts:true, asynchronous:false});
        } else {
            var myAjax = new Ajax.Updater('questionFieldsListDiv', submitPage, { parameters:'action=addQuestionField&questionFieldId='+questionFieldId+'&questionName='+questionName+'&questionType='+questionType+'&questionValidation='+questionValidation+'&questionCssclass='+questionCssclass+questionOptions+questionOptionLevels, evalScripts:true, asynchronous:false});

        }
        dhtmlmodal.close(contentwindow);
    }
}


function removeStrayQuestionField (submitPage, questionFieldId) {
    var agree=confirm('Are you sure you wish to remove this entry?');
    if (agree)
        var myAjax = new Ajax.Updater('questionBoxesAddDiv', submitPage, { parameters:'action=deleteStrayQuestionField&questionFieldId='+questionFieldId, evalScripts:true, asynchronous:false});
}

function removeQuestionField (submitPage, questionFieldId) {
    var agree=confirm('Are you sure you wish to remove this entry?');
    if (agree)
        var myAjax = new Ajax.Updater('questionFieldsListDiv', submitPage, { parameters:'action=deleteQuestionField&questionFieldId='+questionFieldId, evalScripts:true, asynchronous:false});
}


function changeTabStatus(submitPage, tabId,relationId,tabstatus) {
    var myAjax = new Ajax.Updater('tabs_list_box', submitPage, { parameters:'action=changeStatus&tabId='+tabId+'&relationId='+relationId+'&status='+tabstatus, evalScripts:true, asynchronous:false});
}

function deleteTab(submitPage, tabId) {
    if(confirmDelete('Tab')) {
        var myAjax = new Ajax.Updater('tabs_list_box', submitPage, { parameters:'action=delete&tabId='+tabId, evalScripts:true, asynchronous:false});
    }
}


function displayItemLinkContent (submitPage, linkId, divBaseName) {
    var myAjax = new Ajax.Updater(divBaseName+linkId, submitPage, { parameters:'action=showContents&linkId='+linkId, evalScripts:true, asynchronous:false});
    openContentWindow('popupWindow', 'Link Data', '500px', '400px');

}

function checkSelected(checkBox, divId) {
    var boxes = document.getElementsByName(checkBox);
    var box_checked = false;
    for (var i in boxes) 
    {
        if (boxes[i].checked) 
            box_checked = true
    }
    
    if(box_checked) {
        if(document.getElementById(divId).style.display = 'none')
            document.getElementById(divId).style.display = 'block';
    } else {
        if(document.getElementById(divId).style.display = 'block')
            document.getElementById(divId).style.display = 'none';
    }
    
}

function disableKidBoxes(checkboxObj, boxName) {
    var kidBoxes = document.getElementsByName(boxName);
    if(checkboxObj.checked == true) {
        for (var i=0; i<kidBoxes.length; i++) {
            if(kidBoxes[i].checked == true)
                kidBoxes[i].checked = false;
            kidBoxes[i].disabled = true;
        }
    } else {
        for (var i=0; i<kidBoxes.length; i++) {
            kidBoxes[i].disabled = false;
        }
    }
}

function toggleDisplayOnCheck(parentObjectId, objectId, objectStatus) {
    if(parentObjectId.checked == true)
        document.getElementById(objectId).style.display='block';
    else
        document.getElementById(objectId).style.display='none';

}

function addMorePersonFields(divId, submitPage, questionDisplay, questionId, dataGroupId, maxFieldCount) {
    new Effect.Highlight(divId);
    var myAjax = new Ajax.Updater(divId, submitPage, { parameters:'action=getPersonFields&questionId='+questionId+'&dataGroupId='+dataGroupId+'&maxFieldCount='+maxFieldCount+'&questionDisplay='+questionDisplay, evalScripts:true, asynchronous:false});
    new Effect.Highlight(divId);

}


function addMorePersonQuestions(divId, submitPage, dataGroupId, questionSetCount) {
    new Effect.Highlight(divId);
    var myAjax = new Ajax.Updater(divId, submitPage, { parameters:'action=getAddMorePersonQuestions&dataGroupId='+dataGroupId+'&questionSetCount='+questionSetCount, evalScripts:true, asynchronous:false});
    new Effect.Highlight(divId);

}


function addMoreQuestions(divId, submitPage, questionId, questionSetCount) {
    new Effect.Highlight(divId);
    var myAjax = new Ajax.Updater(divId, submitPage, { parameters:'action=getAddMoreQuestions&questionId='+questionId+'&questionSetCount='+questionSetCount, evalScripts:true, asynchronous:false});
    new Effect.Highlight(divId);

}


function hideIssuerSize(thisObj, show, hide, check1, check2) {
    var showAggregate = false;
    if(thisObj.checked == true) {
        if(thisObj.value == check1 || thisObj.value == check2)
            showAggregate = true;
        else {
            var thisName = thisObj.name;
            var splitParent = thisName.split('[]');
            if(document.getElementById(splitParent[0])) {
                var parentObj = document.getElementById(splitParent[0]);
                if(parentObj.value == check1 || parentObj.value == check2)
                    showAggregate = true;
                else
                    hideIssuerSize(parentObj, show, hide, check1, check2);
            }
        }
        if(showAggregate) {
            if(document.getElementById(show)) {
                document.getElementById(show).style.display = 'block';
                if(document.getElementById('msg_'+show))
                    document.getElementById('msg_'+show).style.display = 'none';
            }
            if(document.getElementById(hide)) {
                document.getElementById(hide).style.display = 'none';
                if(document.getElementById('msg_'+hide))
                    document.getElementById('msg_'+hide).style.display = 'block';
            }
        } else {
            if(document.getElementById(show)) {
                document.getElementById(show).style.display = 'none';
                if(document.getElementById('msg_'+show))
                    document.getElementById('msg_'+show).style.display = 'block';
            }
            if(document.getElementById(hide)) {
                document.getElementById(hide).style.display = 'block';
                if(document.getElementById('msg_'+hide))
                    document.getElementById('msg_'+hide).style.display = 'none';
            }
        }
    }
}

function checkParentRadio(thisObj) {
    if(thisObj.checked == true) {
        var thisName = thisObj.name;
        var splitParent = thisName.split('[]');
        var parentId = splitParent[0];
        if(document.getElementById(parentId)) {
            document.getElementById(parentId).checked = true;
            uncheckOtherKidRadios(document.getElementById(parentId));
            checkParentRadio(document.getElementById(parentId));
        }
        uncheckOtherKidRadios(thisObj);
    }
}

function uncheckOtherKidRadios(thisObj) {
    var groupname = thisObj.name;
    var thisId = thisObj.id;
    var others = document.getElementsByName(groupname);
    for(i in others) {
        if(others[i].type == 'radio') {
            var otherId = others[i].id;
            if(otherId != thisId) {
                var othersKids = document.getElementsByName(otherId+'[]');
                for(j in othersKids) {
                    if(othersKids[j].type == 'radio') {
                        if(othersKids[j].checked == true)
                            othersKids[j].checked = false;
                    }
                    uncheckOtherKidRadios(othersKids[j]);
                }
            }
        }
    }
}

function showTextBox(thisObj, checkvalue, divId) {
    if(thisObj.value == checkvalue)
        document.getElementById(divId).style.display='block';
    else
        document.getElementById(divId).style.display='none';
}

