try{document.execCommand('BackgroundImageCache',false,true);}catch(e){}

$('#brands a').hover(
	function() {
		var currentImageSource = $('img', this).attr('src');
		var newImageSource = currentImageSource.substring(0,
			currentImageSource.length - 4) + '_col' +
			currentImageSource.substring(currentImageSource.length - 4);
		$('img', this).attr('src', newImageSource);
	},
	function() {
		var currentImageSource = $('img', this).attr('src');
		var newImageSource = currentImageSource.substring(0,
			currentImageSource.length - 8) + currentImageSource.substring(
			currentImageSource.length - 4);
		$('img', this).attr('src', newImageSource);
	}
);

/*$('#timeline').append('<ul><li id="timeline_previous">« Previous</li><li id="timeline_next">Next »</li></ul>');
var timelineHeight = function() {
	var maxHeight = 0;
	$('#timeline dd').each(
		function(i) {
			var dd = $(this);
			if (i > 0) {
				dd.hide().css('left', '270px');
				dd.prev('dt').hide().css('left', '270px');
			}
			if (dd.height() > maxHeight) {
				maxHeight = dd.height() + 100;
			}
		}
	);
	return maxHeight;
}();
$('#timeline').addClass('js').css('height', timelineHeight);
$('#timeline ul').css('padding-top', (timelineHeight - $('#timeline h2').height() - $('#timeline ul').height() - 12) + 'px');

$('#timeline_next').click(function() {
	var dtVisible = $('#timeline dt:visible').eq(0);
	var ddVisible = dtVisible.next()
	dtVisible.animate({left: '-260px'}, false, false, function() {
		$(this).hide().css('left', '270px');
	});
	ddVisible.animate({left: '-260px'}, false, false, function() {
		$(this).hide().css('left', '270px');
	});
	var dtNew = ddVisible.next('dt');
	if (dtNew.length != 1) {
		dtNew = $('#timeline dt:first-child');
	}
	var ddNew = dtNew.next('dd');
	dtNew.css('right', '-80px').show().animate({left: '0'});
	ddNew.css('right', '-270px').show().animate({left: '0'});
});

$('#timeline_previous').click(function() {
	var dtVisible = $('#timeline dt:visible').eq(0);
	var ddVisible = dtVisible.next()
	dtVisible.removeAttr('style').css('left', '0').animate({left: '270px'}, false, false,
		function() {
			$(this).hide().css('left', '270px');
		}
	);
	ddVisible.removeAttr('style').animate({right: '-270px'}, false, false,
		function() {
			$(this).hide().css('left', '270px');
		}
	);
	var ddNew = dtVisible.prev('dd');
	if (ddNew.length != 1) {
		ddNew = $('#timeline dd:last-child');
	}
	var dtNew = ddNew.prev('dt');
	dtNew.show().css('left', '-270px').animate({left: 0});
	ddNew.show().css('left', '-270px').animate({left: 0});
});*/

$('#brandalternatives a').click(function() {
	var anchor = $(this);
	var hero = $('#brandhero img');
	if (anchor.attr('href') != hero.attr('src')) {
		hero.fadeOut(function() {
			hero.attr('src', anchor.attr('href'));
			hero.fadeIn();
		});
	}
	return false;
});
$(window).bind('load', function() {
	var images = [];
	$('#brandalternatives a').each(function(i) {
		images[i] = new Image();
		images[i].src = $(this).attr('href');
	});
});

