// JavaScript Document
// Appel jquery

var pageHeight ;
var pageWidth ;
var isHome = false;

function testHeight () {
	if ($.browser.msie && $.browser.version < 7 ) {
		if ( $('.aeroport_desc').height() < 281 ) {
			$('.aeroport_desc').css({ height:'281px' });
		}
	}
}

function onResizePage ( isHome ) {
	
	

	var footerHeight = isHome?76:88;
	
	pageHeight = $('.page').height();
	if ( $.browser.msie && ($.browser.version < 7) ) {
		if ( pageHeight < $(window).height() ) {				
			$('.middleBlock-in').css('height', parseInt( $(window).height()- footerHeight ) + 'px');
			$('.bg-body ').css('height', '100%');		
		}else {
			$('.middleBlock-in').css('height', parseInt( pageHeight - footerHeight ) + 'px');
			$('.bg-body ').css('height', pageHeight + 'px');
		}
	} 
	else 
	{
		if ( pageHeight < $(window).height() ) {				
			$('.middleBlock-in').css('min-height', parseInt( $(window).height()- footerHeight ) + 'px');
			$('.bg-body ').css('min-height', '100%');		
		}else {
			$('.middleBlock-in').css('min-height', parseInt( pageHeight - footerHeight ) + 'px');
			$('.bg-body ').css('min-height', pageHeight + 'px');
		}
	}
	
	if ( pageWidth < $(window).width() ) {							
		$('.bg-body ').css('width', '100%');		
	} else {
		$('.bg-body ').css('width', pageWidth + 'px');
	}
}

$ ( function () {
	/*$('.menu-flash').flash({
		src: 'swfs/Nav2.swf',
		width: 240,
		height: 1020,
		wmode: 'transparent',
		flashvars: { menuactif: 1, smenuactif:4 }
	}, { version:8, update: false });*/
	
	// pageHeight = $('.page').height();

	//alert (pageHeight);
	pageWidth = $('#middleBlock').width() + 40;
	
	$(window).resize ( function() {
		//alert ( $(window).height(), pageHeight );
		onResizePage ( isHome );
	})
		
	$('li h3').click ( function () {
		if ( $(this).next('.aeroport_desc_content').is(':visible') ) {
			$(this).find('.open').removeClass().addClass('close');
			$(this).next('.aeroport_desc_content').hide();		
		} else {
			$('li h3').find('.open').removeClass().addClass('close');
			$('li h3').next('.aeroport_desc_content').hide();
			$(this).next('.aeroport_desc_content').show();	
			$(this).find('.close').removeClass().addClass('open');	
		}
		
		testHeight ();				
	});
		
	testHeight ();
	
	onResizePage ( isHome );

});
