window.onload = prepare_elements;

function prepare_elements() {
  var headerspopup = document.getElementsByTagName("h3");
  for (var i=0; i<headerspopup.length; i++) {
	if ((headerspopup[i].className == "feedback")||(headerspopup[i].className == "help")||(headerspopup[i].className == "review")) {
      headerspopup[i].onclick = function () { 
		var next = getNextSibling(this);
		var next_again = getNextSibling(next);
		toggle(this); 
		toggle(next);
		toggle(next_again);
		};
	}
	if ((headerspopup[i].className == "hidefeedback")||(headerspopup[i].className == "hidehelp")||(headerspopup[i].className == "hidereview")) {
      headerspopup[i].onclick = function () { 
		var prev = getPrevSibling(this);
		var next = getNextSibling(this);
		toggle(this); 
		toggle(prev);
		toggle(next);
		};
	}
  }  
}

function toggle(x)
{
	if (x.style.display == "none") 
	{ x.style.display = "" ;}
	else
	{ x.style.display = "none" ;}
}

function getNextSibling(startBrother){
  endBrother=startBrother.nextSibling;
  while(endBrother.nodeType!=1){
    endBrother = endBrother.nextSibling;
  }
  return endBrother;
}
function getPrevSibling(startBrother){
  endBrother=startBrother.previousSibling;
  while(endBrother.nodeType!=1){
    endBrother = endBrother.previousSibling;
  }
  return endBrother;
}

