/* * * * * jQuery Tabs * * * * */

/* IMAGE SWAPPER */

$(document).ready(function() {
// INITIAL SETUP - Apply CSS class to "turn off" all tabs in imageSwapperBox, remove "tabOff" class from nested div's and initially selected tab, set CSS classes for first and last tabs, and finally "turn on" the first tab.
	$('div.imageSwapperBox div').addClass('tabOff');
	$('div.imageSwapperBox div div').removeClass('tabOff');
	$('div.imageSwapperBox div#image1').removeClass('tabOff');
	$('div.imageSwapperBox div#image1').addClass('tabOn');
	$('div.imageSwapperBox ul.thumbs li:first a').addClass('currentImage');

// CHANGING TABS ON CLICK - Reset selected tab, "turn off" all tabs in imageSwapperBox (again includes fix for nested div's), and "turn on" the first tab.
$('div.imageSwapperBox ul li a').click(function() {
	var imageBoxName = $(this).attr('name');
	$('div.imageSwapperBox div').removeClass('tabOn');
	$('div.imageSwapperBox div').addClass('tabOff');
	$('div.imageSwapperBox div div').removeClass('tabOff');
	$('div.imageSwapperBox div#' + imageBoxName).removeClass('tabOff');
	$('div.imageSwapperBox div#' + imageBoxName).addClass('tabOn');
	$('div.imageSwapperBox ul.thumbs li a').removeClass('currentImage');
	$(this).addClass('currentImage');
	});
});


/* TABBED PRODUCT BOXES */

$(document).ready(function() {
// INITIAL SETUP - Apply CSS class to "turn off" all tabs in tabbedBox, remove "tabOff" class from nested div's and initially selected tab, set CSS class for last tab, and finally "turn on" the first tab.
	$('div.tabbedBox div').addClass('tabOff');
	$('div.tabbedBox div div').removeClass('tabOff');
	$('div.tabbedBox div#tab1').removeClass('tabOff');
	$('div.tabbedBox div#tab1').addClass('tabOn');
	$('div.tabbedBoxTabs ul.tabs li:first').addClass('firstTab');
	$('div.tabbedBoxTabs ul.tabs li:last').addClass('lastTab');
	$('div.tabbedBoxTabs ul.tabs li:first a').addClass('currentTab');

// CHANGING TABS ON CLICK - Reset selected tab, "turn off" all tabs in tabbedBox (again includes fix for nested div's), and "turn on" the first tab.
$('div.tabbedBoxTabs ul li a').click(function() {
	var tabName = $(this).attr('name');
	$('div.tabbedBox div').removeClass('tabOn');
	$('div.tabbedBox div').addClass('tabOff');
	$('div.tabbedBox div div').removeClass('tabOff');
	$('div.tabbedBox div#' + tabName).removeClass('tabOff');
	$('div.tabbedBox div#' + tabName).addClass('tabOn');
	$('div.tabbedBoxTabs ul.tabs li a').removeClass('currentTab');
	$(this).addClass('currentTab');
	});
});



/* * * * * Misc. jQuery application of design * * * * */

/* PRODUCT PAGE TEMPLATE STYLES */

$(document).ready(function() {
// Set CSS class for last (rightmost) breadcrumb link.
	$('div.breadcrumbsBox a:last').addClass('currentPage');
// Set CSS class to allow alternating table row styling.
	$('table.specs1ColumnAlternatingTable tr:nth-child(odd)').addClass('altRow');
// Giving odd rows in alternating tables the necessary corresponding class.
	$('table.alternatingTable tr:odd').addClass('odd');
// Setting column classes in schedule table.
	$('table.scheduleTable tr td:nth-child(1)').addClass('column1');
	$('table.scheduleTable tr td:nth-child(2)').addClass('column2');
	$('table.scheduleTable tr td:nth-child(3)').addClass('column3');

});