
//Dimension des contenus
function getWindowHeight() {
	var windowHeight = 0;
	
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function faireDimension() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();		
		  var qui = document.getElementById('qui');
		  var cv = document.getElementById('cv');
		  var travaux = document.getElementById('travaux');
		  var contact = document.getElementById('contact');
		  qui.style.height = (windowHeight) + 'px';
      cv.style.height = (windowHeight) + 'px';
      travaux.style.height = (windowHeight) + 'px';
      contact.style.height = (windowHeight) + 'px';
		}
	}

// POPUP
var ob = new Object;
var obNewWin = null;
ob.Link =
{
	ClickHandler: function()
	{	
			var obLink = document.getElementById('popup').onclick = ob.Popup.Open;		
	}
}
ob.Popup ={
	Open: function()
	{
		if( !obNewWin || obNewWin.closed )
		{
			obNewWin = window.open( this.href , '' , 'top=0 , left=133 , width='+(screen.height *75/100)+' , height='+screen.height+',menubar=1,resizable=no, scrollbars=yes' );
      return false;
		}		
		else
		{
			obNewWin.location.href = this.href;
			obNewWin.focus();
			return false;
		}	
	}
}
//Tween Scroll
window.addEvent('domready', function(){
	
	$$('.MGroupContent').setStyle('display', 'block');
	
	var selected = $('MSelected');
	
	var current = (selected) ? selected.getParent() : false;

	$$('div.MGroup').each(function(div){
		var link = div.getElement('a');
		var block = link.getNext();
		
		var fx = new Fx.Slide(block);
		
		if (block != current) fx.hide();

		link.addEvent('click', function(){
			fx.toggle();
		});
		
	});
	
	$$('.CTitle').each(function(heading){
		new Element('a', {
			'href': '#MainTopic',
			'class': 'toTop'
		}).setHTML('top').injectBefore(heading.getFirst());
	});
	
	new SmoothScroll();
	
});

//Lancement des fonctions
window.onload = function() {
			faireDimension();
			ob.Link.ClickHandler();
		}
window.onresize = function() {
			faireDimension();
}
		
		
