
function init() {

	var i = 0;
	// Hide article summaries
	$('.articleSummary').each(function() {
		if ( i == 0 ) {
			//ignore for now
		} else {
			this.style.display = 'none';
		}

		i++;
	});

	// Attach mouseover handler to each small image
	var ss = document.getElementById('summaryScroller');
	var thumbs = ss.getElementsByTagName('img');
	for ( i = 0; i < thumbs.length; i++ )
	{
		$(thumbs[i]).bind( 'mouseover', {id: i+1}, function(event) {
			swapContent(event.data.id);
		} );
	}

}

function swapContent(id) {
	var as = document.getElementById('as' + id);
	var si = document.getElementById('si' + id);
	var siImage = si.getElementsByTagName('img')[0];

	if ( siImage.src.toString().indexOf('Screen.jpg') != -1 ) {
		// We're swapping new content here
		$('.scrollerImage').each(function() {
			var img = this.getElementsByTagName('img')[0];
			if ( img.src.toString().indexOf('Screen.jpg') == -1 ) {
				img.src = img.src.toString().replace('.jpg', 'Screen.jpg');
			}
		});
		siImage.src = siImage.src.toString().replace('Screen', '');

		$('.articleSummary').each(function() {
			this.style.display = 'none';

		});
		as.style.display = '';
	}
}

$(document).ready(function() {

	init();

});

