// cognopod - DHTML software for cognitive psychology experiments
// (C) 2005 Karl G. D. Bailey
// http://www.growlers.org/
// this is the css control function library
// it must be loaded in all application instances

// this function toggles which sidebar is showing
function toggle_side() {
// see what's currently displayed
   if (document.getElementById("debug").style.visibility == "hidden") {
      show_debug();
   } else {
      show_message();
   }
}

// this function hides the debug bar and shows the message bar
function show_message(){
   document.getElementById("debug").style.visibility = "hidden";
   document.getElementById("message").style.visibility = "visible";
   document.getElementById("side_img").src = "debug.png";
}

// this function shows the debug bar and hides the message bar
function show_debug(){
   document.getElementById("message").style.visibility = "hidden";
   document.getElementById("debug").style.visibility = "visible";
   document.getElementById("side_img").src = "mssg.png";
}

// this function toggles which main window is showing
function toggle_oggle() {
// see what's currently displayed
   if (document.getElementById("expt").style.visibility == "visible") {
    show_summ();
   }
   else if (document.getElementById("data").style.visibility == "visible") {
      show_expt();
   } else if (document.getElementById("summ").style.visibility == "visible") {
      show_expt();
   } else {
      show_summ();
   }
}

// this function shows the data window and hides the stimulus presentation window
function show_data(){
   document.getElementById("expt").style.visibility = "hidden";
   document.getElementById("summ").style.visibility = "hidden";
   document.getElementById("data").style.visibility = "visible";
   document.getElementById("big_img").src = "expt.png";
}

// this function hides the data window and shows the stimulus presentation window
function show_expt(){
   document.getElementById("data").style.visibility = "hidden";
   document.getElementById("summ").style.visibility = "hidden";
   document.getElementById("expt").style.visibility = "visible";
   document.getElementById("big_img").src = "data.png";
}

// this function hides the data window and shows the stimulus presentation window
function show_summ(){
   summarize_data();
   document.getElementById("data").style.visibility = "hidden";
   document.getElementById("expt").style.visibility = "hidden";
   document.getElementById("summ").style.visibility = "visible";
   document.getElementById("big_img").src = "expt.png";
}

// this function shows the control buttons if they are hidden, and hides them if they are showing
function toggle_buttons() {
   if (document.getElementById("control").style.visibility == "hidden") {
      document.getElementById("control").style.visibility = "visible";
   } else {
      document.getElementById("control").style.visibility = "hidden";
   }
}

// this function hides everything except the stimulus presentation window
function hide_all() {
document.getElementById("control").style.visibility = "hidden";
document.getElementById("data").style.visibility = "hidden";
document.getElementById("message").style.visibility = "hidden";
document.getElementById("debug").style.visibility = "hidden";
document.getElementById("expt").style.visibility = "visible";
document.getElementById("summ").style.visibility = "hidden";
}
