jQuery(
	function() {
		renderfix();
		navigationAutoShow();
/*	
		jQuery('.sideBarElement').children('ul').wrap('<div class="sideBarContent"></div>'); //For general list-based widgets
		jQuery('.sideBarElement').children('.textwidget').wrap('<div class="sideBarContent"></div>'); //For text widgets
		jQuery('.sideBarElement').children('#searchform').wrap('<div class="sideBarContent"></div>'); //For search form
		jQuery('.sideBarElement').children('a[class*="tag"]').wrapAll('<div class="sideBarContent" id="tagcloud"></div>'); //For tag cloud
		jQuery('#tagcloud').children('a').after(' ');
		
		//Alter the look of the search form
		jQuery('#searchform').parent('.sideBarContent').before('<h3 class="sideBarHeader">' + jQuery('#searchform').children('label[for="s"]').html() + '</h3>');
*/
		jQuery(':submit').addClass("buttons");
		jQuery(':text').addClass("textFields");

		//Set the auto-focus function of text fields and text areas
		jQuery(':text').hover(
			function() {
				jQuery(this).focus();
			},
			function() {
				jQuery(this).blur();
			}
		);
		jQuery('textarea').hover(
			function() {
				jQuery(this).focus();
			},
			function() {
				jQuery(this).blur();
			}
		);
		jQuery(':password').hover(
			function() {
				jQuery(this).focus();
			},
			function() {
				jQuery(this).blur();
			}
		);
	}
);

jQuery(window).resize(
	function(){
		renderfix();
		navigationAutoShow();
	}
);

function renderfix(){
//Workaround for overflow problem of "Navigation"
	jQuery('#prevEntries').removeAttr("style");
	if ( ( parseInt(jQuery('#prevEntries').width()) + parseInt(jQuery('#prevEntries').width()) ) > ( parseInt(jQuery('#entries').width()) * 0.8 ) ) {
		jQuery('#prevEntries').width( parseInt(jQuery('#entries').width()) * 0.9 );
	}
	jQuery('#entriesContainer').removeAttr("style");
	jQuery('#sideBarContainer').removeAttr("style");
	if ( ( parseInt(jQuery('#entriesContainer').width()) + parseInt(jQuery('#sideBarContainer').width()) ) > parseInt(jQuery(window).width()) ) {
		jQuery('#entriesContainer').width( parseInt(jQuery('#entriesContainer').width()) - 1 );
	}
}

function navigationAutoShow(){
//Hide "Navigation" if there is no hyperlinks inside
	jQuery('#navigationContainer .copyrightHeader div').each(
		function(){
			if( jQuery(this).html() != '' ) {
				jQuery(this).show();
				jQuery('#navigationContainer').show();
			}
		}
	);	
}