var ActiveTab = null;

/**
 * Function to display a tab and hide the old active
 * @param TabName The name of the tab
 * @return void
 */
function showTab( TabName, DefaultTab ) {

    if (ActiveTab == null)
       ActiveTab = DefaultTab;	
	var NewActiveTab 		= document.getElementById( 'Tab_' + TabName );
	var NewActiveContent 	= document.getElementById( 'Content_' + TabName );
	
	if( NewActiveTab && NewActiveContent) {
		/*
		 * Make current tab inactive
		 */
		if ( ActiveTab != null ) { 
			
			var OldTab 		= document.getElementById( 'Tab_' + ActiveTab );
			var OldContent 	= document.getElementById( 'Content_' + ActiveTab );
			if ( OldTab && OldContent ) {
				
				OldContent.className 	= "Hide";
				OldTab.className 		= "Inactive";
				/*
				 * Empty ActiveTab, will be set later on
				 */
				ActiveTab 				= null;
			} else {
				throw 'One of the requested objects was not found!1 ';
			}
		}
		
		/*
		 * Make new tab active
		 */
		NewActiveContent.className 		= "Show";
		NewActiveTab.className 			= "Active";
		/*
		 * Was empty, now set new again 
		 */
		ActiveTab 						= TabName;
		
	} else {
		throw 'One of the requested objects was not found!2';
	}
}

