<!--

//'Show and Hide code'
//Written by Frank Gasking
//toggleBox borrowed slightly from the web for various browsers

//Javascript to make div based information invisible or not.

//IMPORTANT.. Change this according to where you are storing your arrow images
var loc = "/courses/images/"; //Specify where images are stored, starting from root!!

//This function shows/hides a div... ensure its a ID based div
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
       document.layers[szDivID].display = iState ? "block" : "none";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
        obj.style.display = iState ? "block" : "none";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
        document.all[szDivID].style.display = iState ? "block" : "none";
    }
}

//Determine the button type.. mostly internal useage for createButton(), but should be used if some of your div's
//Are to be shown by default with a show/hide button.

function buttonSelect(display, theid, change, butname){
	
	//Whack in some HTML code into the show/hide link div... depending on if we are showing or hiding...
	if(display==1){
		document.getElementById(""+theid).innerHTML = "<img style=\"margin-bottom: 3px;\" src=\""+loc+"gfx_arrowdown.gif\" />&nbsp;<a href=\"javascript: buttonSelect(0,'"+theid+"', '"+change+"', '"+butname+"');\" value=\"Hide Div\">"+butname+"</a><br><br>"; 
		toggleBox(''+change,1);
	}
	else if(display==0){
		document.getElementById(""+theid).innerHTML = "<img style=\"margin-bottom: 1px; margin-right: 3px;\" src=\""+loc+"gfx_arrowright.gif\" />&nbsp;<a href=\"javascript: buttonSelect(1,'"+theid+"', '"+change+"', '"+butname+"');\" value=\"Show Div\">"+butname+"</a><br><br>"; 
		toggleBox(''+change,0);
	}
}

//Function to create a show/hide button.  Why?... well, if the Javascript is disabled in a browser, all information is not hidden and
//No buttons are shown either... meaning no useless buttons.

function createButton(theid, displayDiv, butname){
	var htmlCode = "";
	
	//Pass in where the button is going to go, and what ID it has.
	htmlCode += "<img style=\"margin-bottom: 1px;\" src=\""+loc+"gfx_arrowright.gif\" width=\"4\" height=\"7\" />"; 
	htmlCode += "<a href=\"javascript: buttonSelect(1,'"+displayDiv+"', '"+theid+"', '"+butname+"');\" value=\"Show Div\">"+butname+"</a><br><br>";
	
	//Whack it onto the screen within the designinated DIV.
	document.getElementById(""+displayDiv).innerHTML = htmlCode;
}

// -->
