var wdim = {
	setHeight: function() {
		window_h = $(window).height();
		wrapper_h = $('.wrapper-right').eq(0).height() + 31; //wrapper + topbar
		
		if($('.wrapper-right-col2').is(':visible')) {
			// Fix wrapper-cols height
			tallest = 0;
			if($('.wrapper-right-col1').height() > tallest) {
				tallest = $('.wrapper-right-col1').height();
			}
			if($('.wrapper-right-col2').height() > tallest) {
				tallest = $('.wrapper-right-col2').height();
			}
			$('.wrapper-right-col1, .wrapper-right-col2').height(tallest);
			
			// Set wrapper_h
			wrapper_h = $('.wrapper-right-col2').eq(0).height() + 248 + 31; //wrapper + intro + topbar
		}
		
		if(window_h > wrapper_h) {
			h = window_h;
			$('.wrapper-right').height(window_h);
		} else {
			h = wrapper_h;
		}

		$('.container, .wrapper').height(h);
		$('.wrapper-left').height(window_h);
	}
};

$(window).resize(function() {
	wdim.setHeight();
});

$(document).ready(function() {
	/* *************************** */
	/*        Basic Actions        */
	/* *************************** */
	// height
		wdim.setHeight();
	
	// subnav
	$.getScript(BASEDIR + 'custom/subnav.js');
	
	// modal
	var modalPanel;
	$.getScript(BASEDIR + 'custom/modal.js');
	$.getScript(BASEDIR + 'custom/gmap.js');
	
	// Pop-ins
	$.getScript(BASEDIR + 'custom/popins.js');
	
	/* ZEBRA pour les tableaux */
	$('table').each(function() {
		$('tr:even', this).addClass('pair');
	});
	
	/* *************************** */
	/*      Specifics Actions      */
	/* *************************** */

	if(URI == BASEURL) {
		$.getScript(BASEDIR + 'custom/search.js');
		$.getScript(BASEDIR + 'custom/pdfreader.js');
	}
	
	if(URI.match(/rothe-entreprise/) || URI.match(/tout-comprendre/)) {
		$.getScript(BASEDIR + 'custom/imageBlockFx.js');
	}
	
	if(URI.match(/portails/)) {
		$.getScript(BASEDIR + 'custom/carousels.js');
		$.getScript(BASEDIR + 'custom/productsAjax.js');
	}
	
	if(URI.match(/portafolie/)) {
		
	}
});

