currentDiv = ""
debug = ""

function _DivObject_HLPR_Switch()
{
	if ( ! currentDiv  ) 
	  { 
		if ( debug == 1 ) { alert("currentDiv not set, setting it to the name of this Object\n Hopefully nothing was visible beforehand");}
	
	 currentDiv = this.name 
	  }

if ( debug == 1 ) { alert("Inside the switch function, our currentDiv is: "+currentDiv+"\n")}

	while (  ! eval(currentDiv).sibling == 0 )
	    {

	currentDiv = eval(currentDiv).sibling

		if ( debug == 1 ) { alert("We've changed currentDiv because it's sibling was not null. CurrentDiv is now: "+currentDiv)}
	    }

if ( debug == 1 ) { alert("We've reached a currentDiv \("+currentDiv+"\) where the sibling is null: "+eval(currentDiv).sibling)}

	while ( ! eval(currentDiv).parent == 0 && ! eval(currentDiv).parent == this.parent )
	    {
		if ( debug == 1 ) { alert("Inside: We're about to hide: "+currentDiv)}

		hideDiv(currentDiv)
		currentDiv = eval(currentDiv).parent

		if ( debug == 1 ) { alert("We've changed currentDiv because it's parent was not null. CurrentDiv is now: "+currentDiv)}
	    }
	
if ( debug == 1 ) { alert("Outside: We're about to hide: "+currentDiv) }

	hideDiv(currentDiv)

	currentDiv = this.name

if ( debug == 1 ) { alert("CurrentDiv is now set to \'this.name\', which is: "+currentDiv) }

	while ( ! eval(currentDiv).parent == 0 )
	   {

		currentDiv = eval(currentDiv).parent

		if ( debug == 1 ) { alert("2: We've changed currentDiv because it's parent was not null. CurrentDiv is now: "+currentDiv) }
	   }
if ( debug == 1 ) { alert("The currentDiv's parent should now be null, is it?\ncurrentDiv.parent="+eval(currentDiv).parent) }

	while ( ! eval(currentDiv).sibling == 0 )
	   {

		if (currentDiv == this.parent)
			{ 
			if ( debug == 1 ) { alert("We've found our parent! currentDiv is \("+currentDiv+"\) and this is the same as our own parent pointer, which is: "+this.parent) }

		eval(currentDiv).sibling = this.name

			if ( debug == 1 ) { alert("currentDiv is still \("+currentDiv+"\) but it's sibling: "+eval(currentDiv).sibling+" should now be the same as this.name: "+this.name);  }
			}

		if ( debug == 1 ) { alert("CurrentDiv is now: "+currentDiv+" and we're about to show it.") }

	showDiv(currentDiv)
	currentDiv = eval(currentDiv).sibling

		if ( debug == 1 ) { alert("We've now set currentDiv to the sibling as sibling was not null, so currentDiv is now: "+currentDiv) }
	   }

if ( debug == 1 ) { alert("The current Div: "+currentDiv+"'s sibling should be null, is it?\n currentDiv.sibling="+eval(currentDiv).sibling+"\n Let's hope it's the top of the list because it's the last one we're going to show.") }
		
		showDiv(currentDiv)
}
DivObject.prototype.Switch = _DivObject_HLPR_Switch;


function DivObject(div_this,div_parent,div_default)
	{
	if (!div_this) 
	  { 
	alert("You must tell this object which div it controls!"); return false  
	  }
	else { this.name = div_this; }

	if (div_parent) { this.parent = div_parent; }
	else { this.parent = 0; }

	if (div_default) { this.sibling = div_default; }
	else { this.sibling = 0; }
	}





