function setSplashBackgrounds(){
	$('.slide img').each(function(){
		var bg = 'url(' + $(this).attr('src') + ') top center no-repeat';		
		$(this).parent('.slide').css('background', bg);		
		$(this).hide();

	});
}

function setContentHeights(){
	var leftHeights = [$('.tabBox01').innerHeight(), $('.tabBox02').innerHeight(), $('.tabBox03').innerHeight()];
	leftHeights.sort(function(a,b){return b - a});
	
	// if the height of the right side box is bigger than 240 pixels and 
	// is bigger than the height of the biggest left hand element plus the tabnav above it 	
	if($('#sideContentRight').innerHeight() > 200 && $('#sideContentRight').innerHeight() > (leftHeights[0] +  $('.tabBoxNav').height()) ){
		// console.log('first if fun');
		//alert('right content bigger - setting tabs to' + $('#sideContentRight').innerHeight() - $('.tabBoxNav').innerHeight());
		$('.tabBox').each( function(){
			$(this).height($('#sideContentRight').innerHeight() - $('.tabBoxNav').innerHeight());			
		});
	}
	// if a left side content height plus the tabnav above it
	// is bigger than the sideContentRight box.
	else if((leftHeights[0] + $('.tabBoxNav').innerHeight()) > 240 || $('.indexReleaseList').innerHeight() > 170){
		
		// console.log('if first if fails');		
		var newTabHeight = leftHeights[0] + 33; // 33px of space for the rss link
		$('.tabBox').each( function(){
			$(this).height(newTabHeight);
		});
		//alert('one tab bigger than 240 or release list bigger than 170 - setting tabs to ' + newTabHeight);
		var totalNewHeight = newTabHeight + $('.tabBoxNav').innerHeight();
		$('#sideContentRight').height(totalNewHeight);
		$('#sideContentRight .sideSection').height(totalNewHeight - 20);
		$('#sideContentRight .sideSection .wrap').height(totalNewHeight - 20); // minus the 20px of padding that the wrap has
	}
	else {
		// console.log('if all else fails');
	
		$('.tabBox').each( function(){			
			$(this).height((200 + 33)); // 33px of space for the rss link
		});
		//alert('default reached - setting tabs to 233');
		
		$('#sideContentRight').height($('.tabBox').innerHeight()  + $('.tabBoxNav').innerHeight()); // minus the 20px of padding that the wrap has
		$('#sideContentRight .sideSection').height($('.tabBox').innerHeight() +  $('.tabBoxNav').innerHeight() - 20); // minus the 20px of padding that the wrap has
		$('#sideContentRight .sideSection .wrap').height($('.tabBox').innerHeight()  +  $('.tabBoxNav').innerHeight() - 20); // minus the 20px of padding that the wrap has
	
	}
}	

$(document).ready(function(){	
	if($('#mainSplashArea').length > 0){
		setSplashBackgrounds();
		$('#mainSplashArea').cycle({
			fx:     'fade',
			speed:  'slow',
			timeout: 8000,
			pager:  '#splashNav',
			slideExpr: 'div.slide'
		});
	}
	if($('#sideContentRight').length > 0 && $('.tabBox01').length > 0){
		setContentHeights();
	}	
	
	if($.browser.msie && ($.browser.version <= 8)){
		$('ul.indexList li:nth-child(odd)').css('clear', 'left');
	}	
    //$("#splashNav a").pngfix();
});

