/*
	lib-tabs.js
	Javascript functions for activating tab selections

	2006-03-24  

	Javascript

	John Burwell
	Southern Newspapers, Inc. - Online Services
	support@sninews.com
	
	Updated by Israel Thompson - 2006-06-30
*/

// works for the body/content of the tab box
var activePane;
var newPane;

function activatePane( elementID ) {
  
  newPane = document.getElementById( elementID );
  
  // Hide the current pane:
  
  if ( activePane != null ) {
    hidePane( activePane );
  }
  
  
  // Show the selected pane:
  
  if ( newPane != null ) {
    showPane( newPane );
    activePane = newPane;
  }
  
}


function showPane( element ) {

  element.style.display='block';

}


function hidePane( element ) {

  element.style.display='none';

}

// works for the tabs on the tab box
var activeTab;
var newTab;

function activateTab( elementID ) {
  
  newTab = document.getElementById( elementID );
  
  // deselect the current tab:
  
  if ( activeTab != null ) {
    hideTab( activeTab );
  }
  
  
  // select the selected pane:
  
  if ( newTab != null ) {
    showTab( newTab );
    activeTab = newTab;
  }
  
}


function showTab( element ) {
	element.style.backgroundImage='url(library/tabbox1/tabbox1_tab_sel_bkgd.gif)';
	element.style.backgroundPosition='left top';
	element.style.borderBottom='1px solid #ffffff';
}


function hideTab( element ) {
	element.style.backgroundImage='url(library/tabbox1/tabbox1_tab_unsel_bkgd.gif)';
	element.style.backgroundPosition='left bottom';
	element.style.borderBottom='1px solid #666666';
}

//changes the rollover color of the tabs when the mouse scrolls over
var activeRollover;
var newRollover;

function activateRollover( elementID ) {
  
  newRollover = document.getElementById( elementID );
  
  // deselect the current tab:
  
  if ( activeRollover != null ) {
    hideRollover( activeRollover );
  }
  
  
  // select the selected pane:
  
  if ( newRollover != null ) {
    showRollover( newRollover );
    activeRollover = newRollover;
  }
  
}


function showRollover( element ) {

if (newRollover == activeTab) {
	element.style.backgroundImage='url(library/tabbox1/tabbox1_tab_sel_bkgd.gif)';
	element.style.backgroundPosition='left top';
	element.style.borderBottom='1px solid #ffffff';
	}
	
if (newRollover != activeTab) {
	element.style.backgroundImage='url(library/tabbox1/tabbox1_tab_roll_bkgd.gif)';
	element.style.backgroundPosition='left bottom';
	element.style.borderBottom='1px solid #666666';
	}

}


function hideRollover( element ) {

if (activeRollover == activeTab) {
	element.style.backgroundImage='url(library/tabbox1/tabbox1_tab_sel_bkgd.gif)';
	element.style.backgroundPosition='left top';
	element.style.borderBottom='1px solid #ffffff';
	}
	
if (activeRollover != activeTab) {
	element.style.backgroundImage='url(library/tabbox1/tabbox1_tab_unsel_bkgd.gif)';
	element.style.backgroundPosition='left bottom';
	element.style.borderBottom='1px solid #666666';
	}
	

}

//changes the rollover color of the tabs when the mouse scrolls out
var activeRollout;
var newRollout;

function activateRollout( elementID ) {
  
  newRollout = document.getElementById( elementID );
  
  // unselect the selected rollover:
  
  if ( newRollout != null ) {
    showRollout( newRollout );
    activeRollout = newRollout;
  }
  
}


function showRollout( element ) {

if (newRollout == activeTab) {
	element.style.backgroundImage='url(library/tabbox1/tabbox1_tab_sel_bkgd.gif)';
	element.style.backgroundPosition='left top';
	element.style.borderBottom='1px solid #ffffff';
	}
	
if (newRollout != activeTab) {
	element.style.backgroundImage='url(library/tabbox1/tabbox1_tab_unsel_bkgd.gif)';
	element.style.backgroundPosition='left bottom';
	element.style.borderBottom='1px solid #666666';
	}

}


