(function ($) {

/*
	Hyphenator.config({
		classname : 'content',
		dohyphenation : false
	});

	Hyphenator.run();
*/
	$(document).ready(function() {

		
		if(screen.width > 1024 || (screen.width > 480 && (window.orientation == 90 || window.orientation == -90))){
			updateWindow(true);
			//resizeWindow();
		}else if(screen.width > 480){
			updateWindow(false);
		}
		
		$(window).scroll(function() {
			// updateScrolledWindow();
		});
		
		$(window).resize(function() {
			if(screen.width > 1024 || (screen.width > 480 && (window.orientation == 90 || window.orientation == -90))){
				updateWindow(true);
				//resizeWindow();
			}else if(screen.width > 480){
				updateWindow(false);
			}
		});
		
		$('.switch-font-size-10px').click(function(){
			$('body').addClass('font-size-10px');
			$('body').removeClass('font-size-11px');
			$('body').removeClass('font-size-12px');
			$('body').removeClass('font-size-13px');
		});
		
		$('.switch-font-size-11px').click(function(){
			$('body').addClass('font-size-11px');
			$('body').removeClass('font-size-10px');
			$('body').removeClass('font-size-12px');
			$('body').removeClass('font-size-13px');
		});
		
		$('.switch-font-size-12px').click(function(){
			$('body').addClass('font-size-12px');
			$('body').removeClass('font-size-10px');
			$('body').removeClass('font-size-11px');
			$('body').removeClass('font-size-13px');
		});
		
		$('.switch-font-size-13px').click(function(){
			$('body').addClass('font-size-13px');
			$('body').removeClass('font-size-10px');
			$('body').removeClass('font-size-11px');
			$('body').removeClass('font-size-12px');
		});
		
		function resizeWindow(){
			var window_height = $(window).height();
			var content_height = $('#main-wrapper').outerHeight();
			var header_height = $('#header').outerHeight();
			var logo_wrapper_height = $('#logo-wrapper').outerHeight();
			var region_page_top_height = $('.region-page-top').outerHeight();

			var offset = 2.4 * 11;

			var footer_height = window_height - content_height - header_height - logo_wrapper_height - region_page_top_height - offset;
			document.title = window_height + " - " + content_height + " - " + header_height + " - " + logo_wrapper_height + " - " + region_page_top_height + " - " + offset + " = " + footer_height;
			$("#footer .section").height(footer_height);
		}
		
		function updateWindow(resize_second_sidebar){
			var content_height = $("#content .section").outerHeight(true);
			
			$(".region-sidebar-first .section").height(content_height);
			if(resize_second_sidebar){
				$(".region-sidebar-second .section").height(content_height);
			}else{
				$(".region-sidebar-second .section").css('height', 'auto');
			}
			
		}

	});
	
})(jQuery);;

