 /**
	Uniwits System, 2011
	http://www.uniwits.com
**/ function focus_on_question() { switch_focus(document.getElementById('questionlistpanel'),document.getElementById('questionnairelistpanel')); return false; } function focus_on_questionnaire() { switch_focus(document.getElementById('questionnairelistpanel'),document.getElementById('questionlistpanel')); return false; } var question_manage_switch_focus_busy=0; function on_switch_focus_done() { question_manage_switch_focus_busy--; } function switch_focus(toPanel,fromPanel) { var tPos=UNIWITS.Toolbox.absPos(toPanel); var fPos=UNIWITS.Toolbox.absPos(fromPanel); var topy=Math.min(tPos.y,fPos.y); var height=UNIWITS.Toolbox.clientHeight()-topy; question_manage_switch_focus_busy+=2; UNIWITS.Toolbox.gradualResize(toPanel,{ toHeight: height-30-20, dHeight: 50, intervalms: 50, onFinish: on_switch_focus_done }); UNIWITS.Toolbox.gradualResize(fromPanel,{ toHeight: 30, dHeight: 50, intervalms: 50, onFinish: on_switch_focus_done }); } function switchview() { var qn=document.getElementById('questionnairelistpanel'); var q=document.getElementById('questionlistpanel'); if (qn.clientHeight>q.clientHeight) switch_focus(q,qn); else switch_focus(qn,q); return false; } function switchview_onresize() { if (question_manage_switch_focus_busy>0) return; var qn=document.getElementById('questionnairelistpanel'); var q=document.getElementById('questionlistpanel'); if (qn.clientHeight<q.clientHeight) switch_focus(q,qn); else switch_focus(qn,q); return false; } function oncheckall_questions() { var checkboxes=document.getElementsByName('question_select[]'); var somechecked=false; for (var i=0;i<checkboxes.length;i++) somechecked=somechecked || checkboxes[i].checked; for (var i=0;i<checkboxes.length;i++) checkboxes[i].checked=!somechecked; var checkall_questions=document.getElementById('checkall_questions'); checkall_questions.checked=!somechecked; } function oncheckall_questionnaires() { var checkboxes=document.getElementsByName('questionnaire_select[]'); var somechecked=false; for (var i=0;i<checkboxes.length;i++) somechecked=somechecked || checkboxes[i].checked; for (var i=0;i<checkboxes.length;i++) checkboxes[i].checked=!somechecked; var checkall_questionnaires=document.getElementById('checkall_questionnaires'); checkall_questionnaires.checked=!somechecked; } function oncheck_question() { var checkboxes=document.getElementsByName('question_select[]'); var allchecked=true; for (var i=0;i<checkboxes.length;i++) allchecked=allchecked && checkboxes[i].checked; var checkall_questions=document.getElementById('checkall_questions'); checkall_questions.checked=allchecked; } function oncheck_questionnaire() { var checkboxes=document.getElementsByName('questionnaire_select[]'); var allchecked=true; for (var i=0;i<checkboxes.length;i++) allchecked=allchecked && checkboxes[i].checked; var checkall_questionnaires=document.getElementById('checkall_questionnaires'); checkall_questionnaires.checked=allchecked; } function onrequireall_questions() { var requireboxes=document.getElementsByName('question_required[]'); var somerequired=false; for (var i=0;i<requireboxes.length;i++) somerequired=somerequired || requireboxes[i].checked; for (var i=0;i<requireboxes.length;i++) requireboxes[i].checked=!somerequired; var requireall_questions=document.getElementById('requireall_questions'); requireall_questions.checked=!somerequired; } function onrequire_question() { var requireboxes=document.getElementsByName('question_required[]'); var allrequired=true; for (var i=0;i<requireboxes.length;i++) allrequired=allrequired && requireboxes[i].checked; var requireall_questions=document.getElementById('requireall_questions'); requireall_questions.checked=allrequired; } 