function showNewsContent ( $newsobj ) {
	// remove all active classes
	$('.newslist_entry').removeClass('active');
	
	// update news details
	$('.newscontent_date').html ( $newsobj.find('.newslist_date').html() );
	$('.newscontent_title').html ( $newsobj.find('.newslist_title').find('a').html() );
	$('.newscontent_content').html ( $newsobj.find('.newslist_content').html() );
	
	// activate news entry
	$newsobj.addClass('active');
	
	// scroll to top
	$('.newscontent_container').animate({scrollTop:0}, 1);
}

function showArticleContent ( $articleobj ) {
	// remove all active classes
	$('.oldarticlelist_entry').removeClass('active');
	
	// update article details
	$('.oldarticlecontent_title').html ( $articleobj.find('.oldarticlelist_title').find('a').html() );
	$('.oldarticlecontent_content').html ( $articleobj.find('.oldarticlelist_content').html() );
	
	// activate article entry
	$articleobj.addClass('active');
	
	// scroll to top
	$('.oldarticlecontent_container').animate({scrollTop:0}, 1);
}

function showNews() {
	showNewsContent ( $(this) );
}

function showArticle() {
	showArticleContent ( $(this) );
}

$(document).ready(function() {
	// add click events
	$('.newslist_entry').click(showNews);
	$('.oldarticlelist_entry').click(showArticle);
	
	// select text by a click for all input fields
	$('input').click( function() {
		$(this).select();
	});

	// show first entry
	showNewsContent ( $('.newslist_entry:first') );
	
	if ( $('.oldarticlelist_entry').is(".active") ) {
		showArticleContent ( $('.oldarticlelist .active') );
	} else {
		showArticleContent ( $('.oldarticlelist_entry:first') );
	}
});
