/** javascript functions **/
/** updated : 2011-02-14 **/

/** erase searched item **/
function show_eraser() {
	if (document.getElementById('recherche-annuaire').value != "") {
		document.getElementById('eraser').style.display = "block";
	}
	else {
		document.getElementById('eraser').style.display = "none";
	}
}
	
function erase() {
	document.getElementById('recherche-annuaire').value = "";
	document.getElementById('eraser').style.display = "none";
}

/** hide and show list **/
$(document).ready(function(){
	$(".children2").show();
	$(".showhide_on h3").hover(function (){
		var $thishover		= $(this);
		var $thistexteh3	= $thishover.children(".hideshowdashed");
		var TexteH3			= $thistexteh3.text();
		if( $thishover.is('.parent2') ) {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour replier ' + TexteH3);
		}
		else {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour déplier ' + TexteH3);
		}
	});
	$(".showhide_on li div").hover(function (){
		var $thishover		= $(this);
		var $thistexteli	= $thishover.children(".hideshowdashed");
		var TexteLi 		= $thistexteli.text();
		if( $thishover.is('.parent2') ) {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour replier ' + TexteLi);
		}
		else {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour déplier ' + TexteLi);
		}
	});
	$(".showhide_on legend").hover(function (){
		var $thishover = $(this);
		var $thislegend	= $thishover.children(".hideshowdashed");
		var TexteLegend = $thislegend.text();
		if( $thishover.is('.parent2') ) {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour replier ' + TexteLegend);
		}
		else {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour déplier ' + TexteLegend);
		}
	});
	$(".showhide_on h3").click(function(){
		var $this = $(this);
		if( $this.is('.parent2') ) {
			$this.next(".children2").slideUp("slow");
			$this.removeClass('parent2');
			$this.addClass('parent2off');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[+]');
		}
		else {
			$this.next(".children2").slideDown("slow");
			$this.removeClass('parent2off');
			$this.addClass('parent2');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[-]');
		}
		return false;
	});
	$(".showhide_on li div").click(function(){
		var $this = $(this);
		if( $this.is('.parent2') ) {
			$this.next(".children2").slideUp("slow");
			$this.removeClass('parent2');
			$this.addClass('parent2off');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[+]');
		}
		else {
			$this.next(".children2").slideDown("slow");
			$this.removeClass('parent2off');
			$this.addClass('parent2');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[-]');
		}
		return false;
	});
	$(".showhide_on legend").click(function(){
		var $this = $(this);
		if( $this.is('.parent2') ) {
			$this.next(".children2").slideUp("slow");
			$this.removeClass('parent2');
			$this.addClass('parent2off');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[+]');
		}
		else {
			$this.next(".children2").slideDown("slow");
			$this.removeClass('parent2off');
			$this.addClass('parent2');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[-]');
		}
		return false;
	});

});

$(document).ready(function(){
	$(".children").hide();
	$(".showhide_off h3").hover(function (){
		var $thishover		= $(this);
		var $thistexteh3	= $thishover.children(".hideshowdashed");
		var TexteH3			= $thistexteh3.text();
		if( $thishover.is('.parent') ) {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour déplier ' + TexteH3);
		}
		else {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour replier ' + TexteH3);
		}
	});
	//$(".showhide_off li span").hover(function (){
	$(".showhide_off li div").hover(function (){
		var $thishover 		= $(this);
		var $thistexteli	= $thishover.children(".hideshowdashed");
		var TexteLi = $thistexteli.text();
		if( $thishover.is('.parent') ) {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour déplier ' + TexteLi);
		}
		else {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour replier ' + TexteLi);
		}
	});
	$(".showhide_off legend").hover(function (){
		var $thishover	= $(this);
		var $thislegend	= $thishover.children(".hideshowdashed");
		var TexteLegend = $thislegend.text();
		if( $thishover.is('.parent') ) {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour déplier ' + TexteLegend);
		}
		else {
			$thishover.removeAttr('title');
			$thishover.attr('title','cliquer pour replier ' + TexteLegend);
		}
	});
	$(".showhide_off h3").click(function(){
		var $this = $(this);
		if( $this.is('.parent') ) {
			$this.next(".children").slideDown("slow");
			$this.removeClass('parent');
			$this.addClass('parentoff');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[-]');
		}
		else {
			$this.next(".children").slideUp("slow");
			$this.removeClass('parentoff');
			$this.addClass('parent');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[+]');
		}
		return false;
	});
	$(".showhide_off li div").click(function(){
		var $this = $(this);
		if( $this.is('.parent') ) {
			$this.next(".children").slideDown("slow");
			$this.removeClass('parent');
			$this.addClass('parentoff');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[-]');
		}
		else {
			$this.next(".children").slideUp("slow");
			$this.removeClass('parentoff');
			$this.addClass('parent');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[+]');
		}
		return false;
	});
	$(".showhide_off legend").click(function(){
		var $this = $(this);
		if( $this.is('.parent') ) {
			$this.next(".children").slideDown("slow");
			$this.removeClass('parent');
			$this.addClass('parentoff');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[-]');
		}
		else {
			$this.next(".children").slideUp("slow");
			$this.removeClass('parentoff');
			$this.addClass('parent');
			var $thisopenclose = $this.children(".openclose");
			$thisopenclose.html('[+]');
		}
		return false;
	});
});

/** pop-up register **/
function lookup(insc_raisoc) {
	if(insc_raisoc.length == 0) {$('#suggestions').hide();}
	else {$.post("inc-content/insc_autocomplete.php",{queryString: ""+insc_raisoc+""},function(data){if(data.length >0) {$('#suggestions').show();$('#autoSuggestionsList').html(data);}});}
}

/** AddThis functions **/
var addthis_config = {
     ui_language: "fr"
}

/** rounded images **/
function roundedImages(selector){
    $$(selector).each(function(img){
        new Element("span", {
            "class": "roundedimg",
            styles: {
                "background-image": "url(" + img.getProperty('src') + ")",
                height: img.getProperty('height') + "px",
                width: img.getProperty('width') + "px"
            }
        }).wraps(img);
    });
}
window.addEvent("domready", function (){                       
    roundedImages(".image img");
	roundedImages(".bigimglibr img");
});

$(document).ready(function(){
	$("img.imgune").imgr({size:"0px",color:"",radius:"7px 0"});
	$("img.smallimglibr").imgr({size:"0px",color:"",radius:"7px"});
});

