//Image resize and column height functions
jQuery(document).ready(function() {
	
	//Splash page image resize
	jQuery('.splash-img-cont').height(jQuery(window).height());
	jQuery('.splash-img-cont').width(jQuery(window).width());
	jQuery('.splash-img').width(jQuery(window).width());
	
	var splashHeight = jQuery('.splash-img-cont').height();
	var splashWidth = jQuery('.splash-img-cont').width();
	//-------------------------------------------------------------------------------------------------
	
	//Placing Ajax loader in center
	jQuery('.ngg-slideshow-loader img').css('top', jQuery(window).height()/2.3);
	jQuery('.ngg-slideshow-loader img').css('right', jQuery(window).width()/4.4);
	
	//-------------------------------------------------------------------------------------------------
	
	//If right column(content) height is smaller than window height, right col height = window height
	if(jQuery('#right').height()<jQuery(window).height()) {
		jQuery('#left').height(jQuery(window).height());
		jQuery('#right').height(jQuery(window).height());
	}
	else {
		jQuery('#left').height(jQuery('#right').height());
	};
	//-------------------------------------------------------------------------------------------------
	
	//Resizings onload and variable definition
	var imageWidth = jQuery('#left img').width();
	var imageHeight = jQuery('#left img').height();
	
	
	jQuery('#left img, #left .ngg-slideshow img, ').css('width', 'auto');
	jQuery('#left img, #left .ngg-slideshow img, #left .ngg-slideshow').height(jQuery('#left').height());
	jQuery('#left .ngg-slideshow').width(jQuery('#left').width());
	
	var defaultImgHeight = jQuery('#left').height();
	var defaultImgWidth = jQuery('#left').width();
	
	var oldImgHeight = defaultImgHeight;
	var oldImgWidth = defaultImgWidth;
	
	var defaultColumnHeight = jQuery('#right').height();
	//-----------------------------------------------------------------------------------------------------
	
	//Home page logo always in the middle of screen
	jQuery('.splash-page .splash').css("margin-top",jQuery(window).height()/2.75);
	var defaultMargin = jQuery(window).height()/2.75;
	//-----------------------------------------------------------------------------------------------------
	
	//Resize Function
	
	jQuery(window).resize(function () {
		
		jQuery('.slideshow-nav').css('right', jQuery(window).width()/4.4);
		
		//Splash page resize
		if(jQuery(window).width()>=splashWidth*0.7) {
		
			jQuery('.splash-img-cont').height(jQuery(window).height());
			jQuery('.splash-img-cont').width(jQuery(window).width());
			jQuery('.splash-img').width(jQuery(window).width());
			
		}
		//---------------------------------------------------------------------------------------------
		
		//Home page logo and splash logo on zoom always in middle
		jQuery('.splash-page .splash').css("margin-top",jQuery(window).height()/2.75);
		if(jQuery(window).height()/2.75<defaultMargin) {
			jQuery('.splash-page .splash').css("margin-top",defaultMargin);
		}
		else {
			jQuery('.splash-page .splash').css("margin-top",jQuery(window).height()/2.75);
		}
		//---------------------------------------------------------------------------------------------
		
		//If window height bigger than columns, st columns h as window h
		jQuery('#right').height(jQuery(window).height());
		jQuery('#left').height(jQuery(window).height());
		//If not, column height as onload
		if(jQuery(window).height()<defaultColumnHeight) {
			jQuery('#right').height(defaultColumnHeight);
			jQuery('#left').height(defaultColumnHeight);
		}
		//---------------------------------------------------------------------------------------------
	
		//If use resize by height
		jQuery('#left .ngg-slideshow').width(jQuery('#left').width());
		jQuery('#left .ngg-slideshow img, #left .ngg-slideshow, #left .wp-post-image, #hover_image').height(jQuery('#left').height());
		jQuery('#left img, #hover_image').width('auto');
		
	});
	
});



