$(document).ready(function () {
	var thisTemplate = Template.extend();
	thisTemplate.init = function() {
		this.renderStraplines();
		this.renderTitles('#column1-of-2 h3');
		$(".tab-content").css("display","block");
		if( !jQuery.browser.safari ){
			this.renderTitles('.tab-content h4');
		}
		$(".tab-content").css("display","none");
	}
	thisTemplate.init();

	// match the heights of the "Related Links" panels when High Graphics is selected
	if( StyleSwitcher.mode == 'hi' ) {
		var maxHeight = 0;
		$('.glass-panel-295 .body').each( function() {
			if( $(this).height() > maxHeight ) 
				maxHeight = $(this).height();
		});
		$('.glass-panel-295 .body').height(maxHeight);
	}
	
	// low graphics amends
	StyleSwitcher.onNarrowband = function() {
		$('#straplines').css('clear','both');
		$('#nav-left').css('clear','both');
		$('#nav-left .t2 li').css('display','inline');
		$('.panel600').removeClass('pngfix');
		
		$('.tab-header').css('text-decoration','underline').hover( function() {
				$(this).css('cursor','pointer');
			}, 
			function() {
				$(this).css('cursor','none');
			});
		
		if( $.browser.msie && $.browser.version.substr(0,3) == "6.0" ) {
			$('.panel-card').css('position','relative').css('clear','both'); 
		}
	};
	
	// revert to high graphics
	StyleSwitcher.onBroadband = function() {
		$('.tab-header').css('text-decoration','none');
	};
	
	//concertina effects
	$(".tab-header").click(function() {
		$(this).siblings().removeClass("tab-header-expanded");
		$(this).toggleClass("tab-header-expanded");
		$(this).next().slideToggle("fast")
			.siblings('div.tab-content:visible').slideUp();
	});
});
