/*
	Tabs functions by Joshua Lieberman
*/

////////////////////////////////////////////////////////////////////////////////
function hideLayer(id){ 
	if (document.getElementById){ obj = document.getElementById(id); }
	obj.style.display = "none"; 
}
function showLayer(id){ 
	if (document.getElementById){ obj = document.getElementById(id); }
	obj.style.display = "block"; 
}
////////////////////////////////////////////////////////////////////////////////
// For the work page
function swap(type,num,id)
{
	for (i=1;i<=num;i++)
	{
		//var listOn=type+"ListOn"+i;
		//var listOff=type+"ListOff"+i;
		var image=type+"Image"+i;
		var text=type+i;
		if (i!=id)
		{
			hideLayer(image);
			hideLayer(text);
			//showLayer(listOn);
			//hideLayer(listOff);
		} else {
			showLayer(text);
			showLayer(image);
			//showLayer(listOff);
			//hideLayer(listOn);
		}
	}
}
////////////////////////////////////////////////////////////////////////////////
function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
function toggleAllOtherLayersOff(whichLayer,n)
{
	for (i=1;i<=n;i++)
	{
		if (i!=whichLayer) { // Do this too all other tabs then the clicked on tab
			var divBlock="commentForm"+i;
			hideLayer(divBlock); // hide it's comment form
			var tabOnBlock="tab"+i+"on";
			hideLayer(tabOnBlock); // hide it's on state tab
			var tabOffBlock="tab"+i+"off";
			showLayer(tabOffBlock); // show it's off state tab
		}
	}
}
function tabs(t,n){
	toggleAllOtherLayersOff(t,n);
	var commentBlock="commentForm"+t;
	toggleLayer(commentBlock);
	var tabBlockOn="tab"+t+"on";
	var tabBlockOff="tab"+t+"off";
	showLayer(tabBlockOn);
	hideLayer(tabBlockOff);
}
////////////////////////////////////////////////////////////////////////////////
function toggleExtraWhich(state,which){
	var whichExtra="";
	if(which!=1){
		whichExtra=which;
	}
	var commentBlock="extraBlock"+whichExtra;
	toggleLayer(commentBlock);
	var tabBlockOn="extraTurnOn"+whichExtra;
	var tabBlockOff="extraTurnOff"+whichExtra;
	if(state=="turnOn"){
		showLayer(tabBlockOff);
		hideLayer(tabBlockOn);
	} else {
		showLayer(tabBlockOn);
		hideLayer(tabBlockOff);
	}
}
function toggleExtra(state){
	toggleExtraWhich(state,1)
}


