jQuery(document).ready(function() {
	
	if(jQuery.browser.opera){
		jQuery("#content").css('marginRight', 0);
		}
	else if(jQuery.browser.msie && jQuery.browser.version<7){
		return;
		}
		
		
	jQuery('var.email').each(function(i){
		var c = this.innerHTML,
		arr=c.split(',');
		if(arr.length==3){
			var email=arr[0]+'@'+arr[1]+'.'+arr[2],
			new_content='<a href="mailTo:'+email+'">'+email+'</a>';
			jQuery(this).replaceWith( new_content );
		}
	});
	
	if(!jQuery('body').hasClass('front')){
		jQuery("#block-system-main-menu ul.menu li a")
			.each(function(index){
				jQuery(this).append('<span id="menu_sprite'+index+'" class="sprite menu_sprite"></span>');
			});
		
		jQuery("#bottom .region-bottom-slot1 li, #bottom .region-bottom-slot2 li, #bottom .region-bottom-slot3 li").each(function(){
				jQuery(this).append('<span class="sprite bottom_menu_sprite"></span>');
			});
		jQuery("#block-menu-menu-menu-du-bas-gauche > div > ul > li > .sprite").each(function(i){
				jQuery(this).attr('id', 'left_bottom_menu_sprite'+i);
			});
		jQuery("#block-menu-menu-menu-du-bas-milieu > div > ul > li > .sprite").each(function(i){
				jQuery(this).attr('id', 'milieu_bottom_menu_sprite'+i);
			});
	
		if(jQuery('div.node-foret-col3, #block-search-fp-search-fp-region').length==2 )
		{
			jQuery('#block-search-fp-search-fp-region').appendTo('div.node-foret-col3').addClass('green-block-menu');
		}
		
		jQuery("div.encart_mandats").append('<span class="sprite sprite_encart_mandats"></span>');
		
		if(jQuery.fancybox){
			jQuery('div.field-name-field-photo a').fancybox();
		}
		

		
		var bottom_blocks=jQuery('.cont_slot4and5 .block');
		if(bottom_blocks.length==2){
			var h=0;
			bottom_blocks.each(function(i){
				var block_height=jQuery(this).height();
				if(block_height>h){
						h=block_height;
					} 
				});
			bottom_blocks.css('height', h + 'px');
			}
		jQuery("#block-additional-fields-bottom-line").prepend('<span id="bottom_forest_icon" class="sprite"></span>');
		
		
		///*
		var foret_hint_container = jQuery("div.foret_hint_container");
		foret_hint_container
		.css('cursor', 'pointer')
		.click(function(e){
			if(e.target.nodeName && e.target.nodeName.toUpperCase()=='A')
			{
				return true;
			}
			else{
				e.preventDefault();
				var url=jQuery("ul li:first a", this).attr("href");
				if(url.indexOf('http://', 0)==-1){
					url = location.protocol + "//"+location.host + url;
				}
				window.location.assign(url);
			}
			

		});
		if(foret_hint_container.length>1){
			var h=0;
			foret_hint_container.each(function(i){
				var block_height=jQuery(this).height();
				if(block_height>h){
					h=block_height;
				}
			});
			foret_hint_container.css('height', h + 'px');
		}
		//*/
		
		
	}
});



;

