jQuery().ready(function(){
	// ACCORDION
		// simple accordion
		jQuery('#list1a').accordion({
			autoheight: false,
			active: '.selected2',
			header: '.head2',
			animated: 'easeslide'
		});
		
		jQuery('#list1b').accordion({
			autoheight: false,
			active: '.selected',
			header: '.head',
			animated: 'easeslide'
		});
		
		// second simple accordion with special markup
		jQuery('#navigation').accordion({
			autoheight: false,
			active: false,
			header: '.head',
			event: 'mouseover',
			animated: 'easeslide'
	
		});
		
		// first simple accordion with special markup
		jQuery('#list3').accordion({
			autoheight: false,
			active: '.selected3',
			header: '.head3',
			animated: 'easeslide'
		});
		
		var wizard = $("#wizard").accordion({
			header: '.title',
			event: false
		});
		
		var wizardButtons = $([]);
		$("div.title", wizard).each(function(index) {
			wizardButtons = wizardButtons.add($(this)
			.next()
			.children(":button")
			.filter(".next, .previous")
			.click(function() {
				wizard.accordion("activate", index + ($(this).is(".next") ? 1 : -1))
			}));
		});
		
		// bind to change event of select to control first and seconds accordion
		// similar to tab's plugin triggerTab(), without an extra method
		var accordions = jQuery('#list1a, #listb, #list2, #list3, #navigation, #wizard');
		
		jQuery('#switch select').change(function() {
			accordions.accordion("activate", this.selectedIndex-1 );
		});
		jQuery('#close').click(function() {
			accordions.accordion("activate", -1);
		});
		jQuery('#switch2').change(function() {
			accordions.accordion("activate", this.value);
		});
		jQuery('#enable').click(function() {
			accordions.accordion("enable");
		});
		jQuery('#disable').click(function() {
			accordions.accordion("disable");
		});
		jQuery('#remove').click(function() {
			accordions.accordion("destroy");
			wizardButtons.unbind("click");
		});
	// Fin ACCORDION
	
	// Page Téléchargement
	$("a.sitemaplink").addClass("closedContent");
	$(".siteMapDisplay .sitemapParent h3 span a.sitemaplink").removeClass("closedContent");
	$(".siteMapSwitchDisplay").css("display","none");
	$("a.sitemaplink").toggle(function(){
		switchBlockDisplay(this.hash);
		return(false);
	},function(){
		switchBlockDisplay(this.hash);
		return(false);
	});
	// FIN Page Téléchargement
	
	$("td[@bgcolor='#ffd1c2']").css("color","#3B6E88");
	$("td[@bgcolor='#ffd1c2'] .text").css("color","#3B6E88");
});

function LTrim( value ) {
   	var re = /\s*((\S+\s*)*)/;
    return value.replace(re, "$1");
}
 
// Removes ending whitespaces
function RTrim( value ) {
    var re = /((\s*\S+)*)\s*/;
    return value.replace(re, "$1");
}
 
// Removes leading and ending whitespaces
function trim( value ) {
     return LTrim(RTrim(value));
}

function switchBlockDisplay(a) {
	$(a).toggle();
}

function printThisPage(){
	window.open(document.location.href+"&print=1","Print",'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0,width=600,height=600');
}


 

