
function fadePane(paneToShow, tabToSelect, secondaryPaneToShow) {

	//Create Array of All HTML Tags
	var allHTMLTags=document.getElementsByTagName('*');

	//Determine if a secondary pane is to be changed
	if (document.getElementById(secondaryPaneToShow).className == 'pane2-inactive') {
		changePane2=true; 
	}
	else {
		changePane2=false; 
	}

	
	for (i=0; i<allHTMLTags.length; i++) {

		if (allHTMLTags[i].className=='tab-selected') {
		
			allHTMLTags[i].className='tab-unselected';
	
		}
		
		if (allHTMLTags[i].className=='pane-active') {

			jQuery(allHTMLTags[i]).fadeOut(400, function () { jQuery('#'+paneToShow).fadeIn(400); 
														  } );
			allHTMLTags[i].className='pane-inactive';
	
		}
		

		
	}

	
	for (i=0; i<allHTMLTags.length; i++) {
		if (changePane2) {

			if (allHTMLTags[i].className=='pane2-active') {
		
				jQuery(allHTMLTags[i]).fadeOut(400, function () { jQuery('#'+secondaryPaneToShow).fadeIn(400); 
															  } );
				allHTMLTags[i].className='pane2-inactive';
		
			}
		}
	}

	jQuery('#'+tabToSelect).fadeOut(400, function() {
											  
											  document.getElementById(tabToSelect).className = 'tab-selected';
											  jQuery('#'+tabToSelect).fadeIn(400);


	document.getElementById(paneToShow).className = 'pane-active';

	if (changePane2)
		document.getElementById(secondaryPaneToShow).className = 'pane2-active';


												});

}