
/* Target blank */
$(function() { $("a[rel$='external']").click( function() { this.target = "_blank"; }); });


jQuery(document).ready(function() {
	jQuery('#reclamation form input:text').each(function() {
		var default_value = this.value;
		jQuery(this).focus(function() {
            if(this.value == default_value) {
                this.value = '';
            }
        });
        jQuery(this).blur(function() {
            if(this.value == '') {
                this.value = default_value;
            }
        });
	});
	
	// menu déroulant dans le header
	jQuery('#nav-aside ul li a').each(function() {
		jQuery(this).click(function() {
			if (jQuery(this).parent().find('ul.children').length != 0) {
//				$('#nav-aside ul li a').not($(this)).removeClass('current').parent().children('ul').slideUp();
				jQuery(this).parent().children('ul').slideToggle();
//				if ($(this).hasClass('current')) {
//					$(this).removeClass('current');
//				} else {
//					$(this).addClass('current');				
//				}
				return false;
			}
		});
	});
	jQuery('li.current_page_ancestor ul').show();	


	$( '#flip' ).jcoverflip({
		current: 4,
		beforeCss: function( el, container, offset ){
			return [
	  			$.jcoverflip.animationElement( el, { left: ( container.width( )/2 - 235 - 150 * offset + 20 * offset ) + 'px', bottom:'20px' }, { } ),
	  			$.jcoverflip.animationElement( el.find( 'img' ), { width: Math.max(10, 140 - 20 * offset * offset) + 'px' }, {} )
			];
		},
		afterCss: function( el, container, offset ){
			return [
	  			$.jcoverflip.animationElement( el, { left: ( container.width( )/2 + 150 + 150 * offset ) + 'px', bottom:'20px' }, { } ),
	  			$.jcoverflip.animationElement( el.find( 'img' ), { width: Math.max(10, 140 - 20 * offset * offset) + 'px' }, {} )
			];
		},
		currentCss: function( el, container ){
			return [
	  			$.jcoverflip.animationElement( el, { left: ( container.width( )/2 - 100 ) + 'px', bottom: 0 }, { } ),
	  			$.jcoverflip.animationElement( el.find( 'img' ), { width: '225px' }, { } )
			];
		},
		change: function(event, ui){
			$('#scrollbar').slider('value', ui.to * 12.5);
		}
	});

	$('#scrollbar').slider({
		value: 50,
		stop: function(event, ui) {
			if(event.originalEvent) {
				var newVal = Math.round(ui.value / 12.5);
				$( '#flip' ).jcoverflip( 'current', newVal );
				$('#scrollbar').slider('value', newVal * 12.5);
			}
		}
	});
});

//  Coverflow
/*
var myMooFlowPage = {
	start: function(){
		var mf = new MooFlow($('MooFlow'), {
			startIndex: 4,
			useSlider: true,
			useAutoPlay: true,
			useCaption: true,
			useMouseWheel: true,
			useKeyInput: true,
			bgColor: "transparent",
			reflection:0,
			factor:50,
			heightRatio:0.262
		});
	}
}
window.addEvent('domready', myMooFlowPage.start);
*/

