$(function () {
	var imgTab, src, period, rollover, index;
	var tabContainers = $('div.tab');
	var imgSrc = $('img').attr('src'); 

	for (index = 1; index < 6; index++) {
		imgTab   = document.getElementById("img_tab" + index);
		src      = imgTab.src;
		imgTab.setAttribute("originalSrc", src);
		period   = src.lastIndexOf(".");
		rollover = src.substring(0, period) + "_rollover" + src.substring(period, src.length);
		imgTab.setAttribute("rolloverSrc", rollover);
	}

	tabContainers.hide().filter(':first').show();

	$('div.tabs ul.group_overview_tabs a').click(function () {
	
		var imgTab, index;

		tabContainers.hide();
		tabContainers.filter(this.hash).show();

		for (index = 1; index < 6; index++) {
			imgTab   = document.getElementById("img_tab" + index);
			imgTab.src = imgTab.getAttribute("originalSrc");
		}
		imgTab = document.getElementById("img_" + this.hash.substring(1));
		imgTab.src = imgTab.getAttribute("rolloverSrc");
			
		return false;
	}).filter(':first').click();
});