/**
 * Retourne le base url de la fenêtre courante, eg. : http://www.mon-domaine.fr/
 */
window.location.baseUrl = function()
{
	var uri = window.location.protocol + '//' + window.location.hostname;
	if(window.location.port)
	        uri = uri + ':' + window.location.port;
	uri = uri + '/';

	return uri;
}

$(document).ready(function() {


	// liens d'evitement
	$("div.skip_link a").focus(function(){
		$(this).parents("div.skip_link").addClass('on');
	});
	$("div.skip_link a").blur(function(){

		$(this).parents("div.skip_link").removeClass('on');
	});

	//ouverture dans une nouvelle fenêtre des liens new_window
	$('a.new_window').click(function(){
	        var link_url = this.href;

		//le lien est déjà une URL absolue
		if(link_url.indexOf('http://') == 0 || link_url.indexOf('https://') == 0)
                {
                        window.open(this.href, '_blank');
                }
                //reconstruction de l'URL absolue
                else
                {
			if(link_url.indexOf('/') == 0)
			        link_url = link_url.substr(1, link_url.length);

                        window.open(window.location.baseUrl() + link_url, '_blank');
                }

		return false;
	});
});