/**
 * @classDescription	Common methods used throughout site
 * @author				Kevin Sweeney
 * @version				1.0
 */

var Global = {};

// Properties __________________________________________________________________

Global.initialNavBorderWidth = $('#navBorder').width();

// Methods _____________________________________________________________________



Global.registerEvents = function () {
	var abc = ['#mainMenu','#mainMenuEn'];
	for (x=0; x<abc.length; x++){
		$('a', abc[x]).hover(Global.onMenuItemOver, Global.onMenuItemOut);
	}
	$(window).bind('resize', Global.onWindowResized);
};
/*
Global.checkFooterPosition = function () {
	
	var bodyTallerThanWindow = $('div.wrapper').height() > window.innerHeight;
	if (bodyTallerThanWindow === false) {
		$('#pageFooter').addClass('anchored');
	}
	else if ($('#pageFooter').hasClass('anchored')) {
		$('#pageFooter').removeClass('anchored');
	}
	
};

Global.warnIE = function () {
	$.cookie('warnIE', '1');
	alert("Looks like you're using Internet Explorer. That's fine, but this site probably won't run as well because IE doesn't support HTML5 or CSS3. I recommend giving the site a spin with Firefox, Chrome or Safari!")
};*/

// Event Handlers ______________________________________________________________

Global.onMenuItemOver = function (e) {
	var newWidth = $(this).offset().left + $(this).width() - 10; //Ou la ligne se rend
	$('#navBorder').stop().animate({
		'width': newWidth + 'px'
	}, 125);
};

Global.onMenuItemOut = function (e) {
	$('#navBorder').stop().animate({
		'width': Global.initialNavBorderWidth + 'px'
	}, 500);
};
/*
Global.onWindowResized = function (e) {
	Global.checkFooterPosition();
	try {
		_gaq.push(['_trackEvent', 'User Interaction', 'Resize Browser']);
	}
	catch (e) {}
};

Global.onFooterLinkClick = function (e) {
	try {
		_gaq.push(['_trackEvent', 'Navigation', 'Footer Link Click', $(this).attr('href')]);
	}
	catch (e) {}
};*/

// Initialization ______________________________________________________________
Global.initialize = function () {
	Global.registerEvents();
	ua = navigator.userAgent.toLowerCase();
	isMSIE = ua.indexOf("msie") > -1;
	showwarn = document.cookie.indexOf('warnIE') > -1;
	if (isMSIE && !showwarn) {
	//if ($.browser.msie && (!$.cookie('warnIE'))) {
		//Global.warnIE();
	}
};

$(document).ready(Global.initialize);
