/* 
Created by  : Dr Dunc   June 2009
for WebSite : http://www.aussiesnrg.com/Surveys
*/

//Last objects may need hiding so keep them in these
var LastTab="";
var LastTabObj;
var LastTabBtn="XX";
var LastTabBtnObj;
var ObjBtn="";
var LastComment="";
var LastCommentObj;


//Show or hide a Tab
function toggleTab(ObjID) {
 if ((ObjID!="") && (ObjID!=null)) {
  ObjBtn=ObjID+"Btn";
 } else {
  ObjBtn="XX";
 } 
 if ((LastTab!="") && (LastTab!=ObjID)) {
  LastTabObj=document.getElementById(LastTab);
  LastTabObj.style.display="none";
 }
 if ((LastTabBtn!="XX") && (LastTabBtn!=ObjBtn)) {
  LastTabBtnObj=document.getElementById(LastTabBtn);
  LastTabBtnObj.style.padding="0px 10px 10px 10px";
  LastTabBtnObj.style.borderBottomWidth="0px";
  LastTabBtnObj.style.backgroundPosition="top left";
  LastTabBtnObj.style.fontSize="10pt";
 }
 if (ObjID!=null) {
  LastTab=ObjID;
  var TabObj=document.getElementById(ObjID);
  if((TabObj.style.display=="none") || (TabObj.style.display=="")) {
   TabObj.style.display="block";
  }
 }
 if (ObjBtn!="XX") {
  LastTabBtn=ObjBtn;
  var TabBtnObj=document.getElementById(ObjBtn);
  if (TabBtnObj!=null) {
   if((TabBtnObj.style.display=="none") || (TabBtnObj.style.display=="")) {
    TabBtnObj.style.padding="10px 10px 10px 10px";
    TabBtnObj.style.borderBottomWidth="1px";
    TabBtnObj.style.backgroundPosition="top right";
    TabBtnObj.style.fontSize="12pt";
   }
  }
 }
 return true;
}





//Show or hide a Comment
function toggleComment(ObjID) {
 if ((LastComment!="") && (LastComment!=ObjID)) {
//Hide the last Comment if it's not the same as the current Comment
  LastCommentObj=document.getElementById(LastComment);
  LastCommentObj.style.display="none";
 }
 
 if (ObjID!=null) {
  LastComment=ObjID;
  var CommentObj=document.getElementById(ObjID);
  if((CommentObj.style.display=="none") || (CommentObj.style.display=="")) {
//Is hidden so show it
   CommentObj.style.display="block";
  } else {
//Hide it again
   CommentObj.style.display="none";
  }
 }
 return true;
}





//Show or hide a Comment
function toggleSection(ObjID) {
 if (ObjID!=null) {
  var SectionObj=document.getElementById(ObjID);
  if((SectionObj.style.display=="none") || (SectionObj.style.display=="")) {
//Is hidden so show it
   SectionObj.style.display="block";
  } else {
//Hide it again
   SectionObj.style.display="none";
  }
 }
 return true;
}








