/*

This function will handle this type of layout (increment 1 for several links!):
<div id="hide_internal_1" class="hide_internal">
 <div id="hide_internal_1_title" class="hide_internal_title">Title</div>
 <div id="hide_internal_1_description" class="hide_internal_description">
  Content
 </div>
</div>

*/
function hide_internal(){
	mydivs = document.getElementsByTagName("div");
	for(count_mydivs=0; count_mydivs < mydivs.length; count_mydivs++){
		if(mydivs[count_mydivs].className == "hide_internal_title"){
			addListener(mydivs[count_mydivs],"onclick",hide_internal_click);
			mydivs[count_mydivs].style.cursor = "pointer";
		}
		if(mydivs[count_mydivs].className == "hide_internal_description"){
			mydivs[count_mydivs].style.display="none";
		}
	}
}

function hide_internal_click(e){
	my_event = (e?e:window.event);
	my_target = (my_event.target?my_event.target:my_event.srcElement);
	if(getElementByID(my_target.parentNode.id+"_description").style.display != "block"){
		getElementByID(my_target.parentNode.id+"_title").className = "hide_internal_title_open";
		getElementByID(my_target.parentNode.id+"_description").style.display = "block";
	}
	else{
		getElementByID(my_target.parentNode.id+"_title").className = "hide_internal_title";
		getElementByID(my_target.parentNode.id+"_description").style.display = "none";
	}
}

/*

This function will handle this type of layout (increment 1 for several links!):
<div id="hide_external" class="hide_external">
 <div id="hide_external_title_1" class="hide_external_title">First Heading</div>
 <div id="hide_external_description_1" class="hide_external_description">First paragraph</div>
 <div id="hide_external_title_2" class="hide_external_title">Second Heading</div>
 <div id="hide_external_description_2" class="hide_external_description">Second paragraph</div>
 <div id="hide_external_title_3" class="hide_external_title">Third Heading</div>
 <div id="hide_external_description_3" class="hide_external_description" style="display:none;">Third paragraph</div>
</div>

It turns it into this:

<div id="hide_external" class="hide_external">
 <div id="hide_external_title_1" class="hide_external_title hide_external_title_open">First Heading</div>
 <div id="hide_external_title_2" class="hide_external_title">Second Heading</div>
 <div id="hide_external_title_3" class="hide_external_title">Third Heading</div>
</div>
<div id="hide_external_content" class="hide_external_content">
 <div id="hide_external_description_1" class="hide_external_description">First paragraph</div>
 <div id="hide_external_description_2" class="hide_external_description" style="display:none;">Second paragraph</div>
 <div id="hide_external_description_3" class="hide_external_description" style="display:none;">Third paragraph</div>
</div>

This function takes EVERY OTHER DIV and puts it in the content DIV!

*/
function hide_external(){
	if(!getElementByID("hide_external"))
		return;
	mydiv = getElementByID("hide_external");
	for(count_mydiv=mydiv.childNodes.length-1; count_mydiv >= 0; count_mydiv--){
		if(mydiv.childNodes[count_mydiv].nodeType == 3)
			mydiv.removeChild(mydiv.childNodes[count_mydiv]);
	}
	new_div = document.createElement("div");
	new_div.id = "hide_external_content";
	new_div.className = "hide_external_content";
	for(count_mydiv=mydiv.childNodes.length-1; count_mydiv >= 0; count_mydiv--){
		if(mydiv.childNodes[count_mydiv].nodeType == 3)
			mydiv.removeChild(mydiv.childNodes[count_mydiv]);
	}
	for(count_mydiv=mydiv.childNodes.length-1; count_mydiv >= 0; count_mydiv--){
		if((count_mydiv+1)%2 == 0){
			if(count_mydiv+1 != 2)
				mydiv.childNodes[count_mydiv].style.display="none";
			mychild = mydiv.removeChild(mydiv.childNodes[count_mydiv]);
			new_div.appendChild(mychild);
		}
		else{
			mydiv.childNodes[count_mydiv].style.cursor = "pointer";
			addListener(mydiv.childNodes[count_mydiv],"onclick",hide_external_click);
			if(count_mydiv == 0)
				mydiv.childNodes[count_mydiv].className += " hide_external_title_open";
		}
	}
	mydiv.parentNode.insertBefore(new_div,mydiv.nextSibling);
}

function hide_external_click(e){
	my_event = (e?e:window.event);
	my_target = (my_event.target?my_event.target:my_event.srcElement);
	my_id = my_target.id.split("_")[my_target.id.split("_").length-1];
	mydiv = getElementByID("hide_external");
	for(count_mydiv = 0; count_mydiv < mydiv.childNodes.length; count_mydiv++){
		this_id = mydiv.childNodes[count_mydiv].id.split("_")[mydiv.childNodes[count_mydiv].id.split("_").length-1];
		if(this_id == my_id)
			mydiv.childNodes[count_mydiv].className = "hide_external_title hide_external_title_open";
		else
			mydiv.childNodes[count_mydiv].className = "hide_external_title";
	}
	mydiv = getElementByID("hide_external_content");
	for(count_mydiv = 0; count_mydiv < mydiv.childNodes.length; count_mydiv++){
		this_id = mydiv.childNodes[count_mydiv].id.split("_")[mydiv.childNodes[count_mydiv].id.split("_").length-1];
		if(this_id == my_id)
			mydiv.childNodes[count_mydiv].style.display="block";
		else
			mydiv.childNodes[count_mydiv].style.display="none";
	}
}