// Gestion des boîtes arrondies 

(function($) {
	$.fn.cornerRound = function(){
		$(this).html('<div class="top">&nbsp;</div><div class="content">'+$(this).html()+'</div><div class="bottom">&nbsp;</div>');
		return $(this);
	}
})(jQuery);

$(function(){
	$('#global div.shadow3c').each(function(){$(this).cornerRound();});
	$('#global div.shadow4c').each(function(){$(this).cornerRound();});
	$('#global div.indexTerritoire').each(function(){$(this).cornerRound();});
});


// Thumb Masks

(function($) {
	$.fn.thumbMask302226Create = function(){
		$(this).html('<div class="pic">'+$(this).html()+'</div><div class="maskoverlay"><img src="../images/mask302226.gif" alt="" /></div>');
		return $(this);
	}
})(jQuery);

$(function(){
	$('#global div.mask302226').each(function(){$(this).thumbMask302226Create();});
});

(function($) {
	$.fn.thumbMask215140Create = function(){
		$(this).html('<div class="pic">'+$(this).html()+'</div><div class="maskoverlay"><img src="../images/mask215140.gif" alt="" /></div>');
		return $(this);
	}
})(jQuery);

$(function(){
	$('#global div.mask215140').each(function(){$(this).thumbMask215140Create();});
});

(function($) {
	$.fn.thumbMask215highlightCreate = function(){
		$(this).html('<div class="pic">'+$(this).html()+'</div><div class="maskoverlay"><img src="../images/mask215highlight.gif" alt="" /></div>');
		return $(this);
	}
})(jQuery);

$(function(){
	$('#global div.mask215highlight').each(function(){$(this).thumbMask215highlightCreate();});
});


// Appel des fonctions 

$(document).ready(function() {

	// Colorbox 

	$(".colorbox").colorbox();

	// Navigation 

	$(".lavaLamp").lavaLamp({ fx: "backout", speed: 700 });

	// Colorbox

	$("a.sendTo").colorbox({width:"500px", height:"400px", iframe:true});
	$("input.sendToMe").colorbox({width:"500px", height:"400px", iframe:true});
	$("a.CDVsendTo").colorbox({width:"850px", height:"550px", iframe:true});
	$("input.CDVsendToMe").colorbox({width:"850px", height:"550px", iframe:true});
	$("a.showWeather").colorbox({width:"450px", height:"550px", iframe:true});

	// Icon Bar

	$(".iconbar li a").hover(
	function(){
	var iconName = $(this).children("img").attr("src");
			$(this).animate({ width: "110px" }, {queue:false, duration:"normal"} );
			$(this).children("span").animate({opacity: "show"}, "fast");
		},
	function(){
	var iconName = $(this).children("img").attr("src");
			$(this).animate({ width: "24px" }, {queue:false, duration:"normal"} );
			$(this).children("span").animate({opacity: "hide"}, "fast");
		});

	// Toggle Lists
	
	$('#mapSearch #search #form01box').hide();
	$('a#form01toggle').click(function() {
		$('#form01box').toggle(300);
		$('#form02box').hide();
		$('#form03box').hide();
		return false;
	});

	$('#mapSearch #search #form02box').hide();
	$('a#form02toggle').click(function() {
		$('#form01box').hide();
		$('#form02box').toggle(300);
		$('#form03box').hide();
		return false;
	});

	$('#mapSearch #search #form03box').hide();
	$('a#form03toggle').click(function() {
		$('#form01box').hide();
		$('#form02box').hide();
		$('#form03box').toggle(300);
		return false;
	});

	$('a#form123hide').click(function() {
		$('#form01box').hide();
		$('#form02box').hide();
		$('#form03box').hide();
		return false;
	});

	$('#mapSearch #search #labelHebBox').hide();
	$('#labelHebToggle').click(function() {
		$('#labelHebBox').toggle(300);
		return false;
	});

	$('#mapSearch #search #labelResBox').hide();
	$('#labelResToggle').click(function() {
		$('#labelResBox').toggle(300);
		return false;
	});






	// choose text for the show/hide link - can contain HTML (e.g. an image)
	var showText='<img src="../images/bt-afficher.gif" alt="Afficher" />';
	var hideText='<img src="../images/bt-masquer.gif" alt="Masquer" />';

	// initialise the visibility check
	var is_visible = false;

	// append show/hide links to the element directly preceding the element with a class of "toggle"
	$('.toggle').prev().append(' <a href="#" class="toggleLink">'+showText+'</a>');

	// hide all of the elements with a class of 'toggle'
	$('.toggle').hide();

	// capture clicks on the toggle links
	$('a.toggleLink').click(function() {

	// switch visibility
	is_visible = !is_visible;

	// change the link depending on whether the element is shown or hidden
	$(this).html( (!is_visible) ? showText : hideText);

	// toggle the display - uncomment the next line for a basic "accordion" style
	//$('.toggle').hide();$('a.toggleLink').html(showText);
	$(this).parent().next('.toggle').toggle('fast');

	// return false so any link destination is not followed
	return false;
	});




});

