$(function(){
		   
	$('li.sm').each(function(e){
		$(this).hover(function(){
			$('ul.sm:eq('+e+')').show();
		},function(){
			$('ul.sm:eq('+e+')').hide();
		});
	});
	
	if($('span.mailme')[0]){
		$('span.mailme').mailme();
	}
	
	if($('.offres_items .small_items')[0]){
		var offres = $('.offres_items .small_items');
		offres.each(function(e){
			if((e+1)%4 == 0){
				$(this).css({marginRight:0})
			}
		})
	}
	
	$("a[rel^='prettyPhoto']").prettyPhoto({
		padding: 20, 
		counter_separator_label: ' sur ',
		hideflash: true,
		theme: 'light_rounded' /* light_rounded / dark_rounded / light_square / dark_square */
	});
	
	if($('#mycarousel')[0]){	   
		$('#mycarousel').jcarousel({
			/*auto: 5,*/
			wrap: 'last',
			scroll:4,
			animation:'slow'
		});
	}
	
	if($('#slideShow')[0]){
		$('#slideshow img').css({opacity:0});
		$('#slideshow img.active').css({opacity:1});
	}
	
	if($('#news')[0]){	
		$('#news').accordion({	
			header: '.news'
		});
	}
	
	if($('#lecteur')[0]){	
		var tabs = $('#lecteur ul li a');
		$('.tab1').show();
		var slideshow;
		tabs.each(function(e){
			$(this).click(function(){
				var id = $(this).attr('id');
				tabs.removeClass('actif');
				$('#lecteur div').hide();
				$(this).addClass('actif');
				$('#lecteur div.'+id+'').show();
				
				if(e==1){
					$('#slideshow').cycle({
						fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
						timeout: 5000
					});
				}
				return false;
			});
		});
		
	}
	
	$('.backTop').click(function(){
		if( $.browser.safari){
			$('body').animate({scrollTop: 0}, "slow");
		}else{
			$('html').animate({scrollTop: 0}, "slow");
		}
		return false;
	});
	
	$('#sub_menu a, #footer_flottes a').click(function(){
		var id = $(this).attr('rel');
		var target = $(id).offset().top;
		$('body, html').animate({scrollTop: target}, "slow");
		return false;
	});
	
	
	if($('#form_contact')[0]){
		$("#form_contact").validate({
			
			highlight: function(element, errorClass) {
				$(element).fadeIn("slow",function() {
				$(element).addClass(errorClass);
				$(element).prev().animate({marginLeft: 5},"fast",
					function(){
						$(this).animate({marginLeft: 0},"fast" );
					});
				});
			},
			unhighlight: function(element, errorClass) {
				$(element).removeClass(errorClass);
			}
			
			/*submitHandler: function(form) {

				$.post(CHEMIN_SITEWEB+'include/content/inc_ajax_contact.php', {civilite : form.civilite.value, nom : form.nom.value, prenom : form.prenom.value, cp : form.cp.value, tel : form.tel.value, email : form.email.value, commentaire : form.commentaire.value }, function(html){$('#msg').fadeIn().html(html);} );

			}*/
			
		});
	}


});
