//** here you place the ids of every element you want.
//** http://support.internetconnection.net/CODE_LIBRARY/Javascript_Show_Hide.shtml

var currid=0;

var curr_el;

var slider = new Array();
var slider_index= new Array();
var next_index = 0;


window.addEvent('load', function(){
	var contents = $("viscontents").getChildren();
	var vc = $("viscontents");
	for(var i=0;i<contents.length;i++) {
		if(contents[i].getStyle('display') != "none") {
			slider_index[next_index] = contents[i].get('id');
			slide_el = $(contents[i]);
			slide_el.setStyle("height",vc.getStyle("height"));
			slider[next_index] = new Fx.Slide(contents[i].get('id'));
			next_index++;
			currid = contents[i].get('id');
		}
	}
});

function nav_slide(toslide) {

	if(Browser.Engine.trident) {
		return switchid(toslide);
	}

	var curr_index = -1;
	var found = -1;

	for (var i=0; i<slider_index.length; i++) {
		if(slider_index[i] == currid) {
			curr_index = i;
		}
		if(slider_index[i] == toslide) {
			found = i;
		}
	}
	
	color = 0;
	bgcolor = 0;
	
	if(currid!=0) {
		$("link_" + currid).removeClass('borderlinks_selected');
		if(currid == toslide) {
			slider[curr_index].slideOut();
			currid = 0;
			return;	
		}
		setTimeout("slider[" + curr_index + "].slideOut();",350);
	}
	
	if(found == -1) {
		slider_index[next_index] = toslide;
		slide_el = $(toslide);
		vc = $("viscontents");
		if(currid!=0) {
			slider[curr_index].hide();
		}
		showdiv(toslide);
		slide_el.setStyle("height",vc.getStyle("height"));
		hidediv(toslide);
		if(currid!=0) {
			slider[curr_index].show();
		}
		slide_el.slide('hide');
		slider[next_index] = new Fx.Slide(toslide);
		found = next_index++;
	}

	setTimeout("showdiv('" + toslide + "');slider[" + found + "].slideIn();",100);
	$("link_" + toslide).addClass('borderlinks_selected');
	currid=toslide;
}

function switchid(id){
	if(currid!=0) {
		$("link_" + currid).removeClass('borderlinks_selected');
		hidediv(currid);
		// IE sucks
		$(currid).classname = $(currid).classname;
	}
	if(currid!=id) {
		showdiv(id);
		$("link_" + id).addClass('borderlinks_selected');
		currid=id;
		// IE sucks
		$(id).classname = $(id).classname;
	}
	else {
		currid=0;
	}
}

function hide(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.visibility = 'hidden';
	}
}

function show(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.visibility = 'visible';
	}
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = '';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = '';
		}
		else { // IE 4
			document.all.id.style.display = '';
		}
	}
}

function togglediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		if(document.getElementById(id).style.visibility == 'hidden')
		{
			document.getElementById(id).style.visibility = 'visible';
		}
		else
		{
			document.getElementById(id).style.visibility = 'hidden';
		}
	}
	else {
		if (document.layers) { // Netscape 4
			if(document.id.display == 'none')
			{
				document.id.display = '';
			}
			else
			{
				document.id.display = 'none';			
			}
		}
		else { // IE 4
			if(document.all.id.style.display == 'none')
			{
				document.id.display = '';
			}
			else
			{
				document.id.display = 'none';			
			}
		}
	}
}