  function flip(index, display){
    var spanList = document.getElementsByTagName("span");
    var toolsList = [];
    
    var j=0;
    for (var i=0; i<spanList.length; i++){
      if (spanList[i].className == "headTools"){
        toolsList[j] = spanList[i];
        j++;
      }
    }
	
	var headHeight = $('gbHead').clientHeight;
	var offset = headHeight - 50;

    if (index==0){
      if (display == 1){
        document.getElementById("signGB").style.display = "none";
        toolsList[index].innerHTML = '<a href="#" onClick="flip(0, 0); return false;">Show</a>';
        document.getElementById("gbComments").style.height = (375 - offset)+"px";
      }
      else{
        document.getElementById("signGB").style.display = "block";
        toolsList[index].innerHTML = '<a href="#" onClick="flip(0, 1); return false;">Hide</a>';
        document.getElementById("gbComments").style.height = (195 - offset)+"px";
      }
    }
    else if (index==1){
      if (display == 1){
        document.getElementById("rejectedList").style.display = "none";
        toolsList[index].innerHTML = '<a href="#" onClick="flip(1, 0); return false;">Show</a>';
      }
      else{
        document.getElementById("rejectedList").style.display = "block";
        toolsList[index].innerHTML = '<a href="#" onClick="flip(1, 1); return false;">Hide</a>';
      }
    }
    else if (index==2){
      if (display == 1){
        document.getElementById("inactiveList").style.display = "none";
        toolsList[index].innerHTML = '<a href="#" onClick="flip(2, 0); return false;">Show</a>';
      }
      else{
        document.getElementById("inactiveList").style.display = "block";
        toolsList[index].innerHTML = '<a href="#" onClick="flip(2, 1); return false;">Hide</a>';
      }
    }    
  }
  window.onload =  function() {
		if ($('gbHead')){
			var headHeight = $('gbHead').clientHeight;
			var offset = headHeight - 70;
			document.getElementById("gbComments").style.height = (375 - offset)+"px";
		}
		if ($('errorsFound'))
		{
			flip(0, 0);
		}
	};