

	var tnum=0;
  
	function showhide (it, box, where) { 
	  var vis = (box.checked) ? "block" : "none"; 
	  document.getElementById(it).style.display = vis;
	} 
	
	
	function show (it) { 
	  document.getElementById(it).style.display = "block";
	} 		
	
	
	function hide (it) { 
	  document.getElementById(it).style.display = "none";
	} 	
	
	function triggerclick ( idname, divname ) {
		var box = document.getElementById(idname);
		showhide(divname, box, 0);
	}
	
	function showbottom(box, where) {
		
	  var vis = (box.checked) ? "block" : "none"; 
	  if (vis=='block') {
	  	tnum = tnum + 1;
	  }
	  else {
	  	if (where == 1) {
	  		tnum = tnum - 1;
	    }
	  }
	  if (tnum < 1) {
	  	tnum=0;
	  }
	  showhidebottom();		
		
	}
	
	function showhidebottom() {
		if (tnum < 1) {
			document.getElementById('botstuff').style.display = 'none';
		}
		else {
			document.getElementById('botstuff').style.display = 'block';
		}
	}
	
	function showopendivs(topnum) {
		
		var a=0;
		var d=0;
		var i=0;
		for (a=0;a<topnum;a++) {
			
			d = 'div' + a;
			i = 'sb' + a;
			triggerclick(i, d);
			
		}
	}
	
	function showbottomdivs(topnum) {
		
		var b=0;
		var box;
		for (a=0;a<topnum;a++) {
			
			b = 'cb' + a;
			box = document.getElementById(b);
			showbottom(box, 0);
			
		}
		
	}	
	
	
	