$(function(){

$("h3.services").click(function(){
$("h3.services").not(this).removeClass("selected");
$(this).toggleClass("selected");
$(this).parent().children("div").removeClass('active');
$(this).next(".ctn").slideToggle("slow");
$(this).next(".ctn").addClass('active');	
	$(".ctn:not(.active)").hide("slow");
		
	});
	
	$("h3.faq").click(function(){
	$("h3.faq").not(this).removeClass("selected");
	$(this).toggleClass("selected");
	$(this).parent().children('.ctn').removeClass('active');
	$(this).next(".ctn").slideToggle("slow");
	
	$(this).next().addClass('active');
	$(".ctn:not(.active)").hide("slow");
	});

	
	// Page scrolling
	$('.page_actions a,#menu a:not(.over)').click(function(){
	  $('#menu a.active').removeClass('active');
	  $(this).addClass('active');	
		
	  $('html, body').animate({ 
	                 scrollTop: $($(this).attr("href"))
	                 .offset().top - 160 }, 1000);
	   return false;
	 });
	
	
	
	// FAQ
	$('dt').click(function(){
		$(this).parent().children('dd').removeClass('active');
		$(this).next().slideDown();
		$(this).next().addClass('active');
		$(this).parent().children('dd:not(.active)').slideUp();
	});
	
	
	// Portfolio
	$('#portfolio a').unbind('click');
	$('#portfolio a').click(function(){
		$('#testimonial').hide();
		$('#imgfull').html('<a href="'+$('img:first', this).attr('alt')+'" target="_blank"><img src="'+$(this).attr('href')+'" alt="" /></a>');
		$('#testimonial').text($(this).next().text());
		$('#testimonial').fadeIn();
		return false;
	});
	$('#portfolio a:first').click();
	
	
	// Devis
	$('#budget-field').hide();
	$('#boui').click(function(){ $('#budget-field').slideDown(); });
	$('#bnon').click(function(){ $('#budget-field').slideUp(); });
	
	$('#submitDevis').unbind('click');
	$('#submitDevis').click(function(){
		//console.log($('#devisform').serialize());
		
		$.get($('#devisform').attr('action'), $('#devisform').serialize(), function(d){eval(d)});
		
		
		return false;
	});

});

jQuery(window).load(function(){

  // Lazy Load images below the fold
  jQuery(".content img.thumbnail").lazyload();

  // The magic sliding panels
	jQuery('.entry-content a span.slide-title').css({
		opacity : '0.0' , position: 'absolute' , top: '100px',color: 'white' , 'text-decoration' : 'none' , 'text-transform' : 'capitalize'
	}).parent('a').append('<span class="cover-up"></span>');
	jQuery('.entry-content a').mouseover(function(e){
      jQuery(this).find('img.thumbnail').stop().animate({
	  	marginTop : '-25px'
	  }, 100).parent('a').find('span.slide-title').stop().fadeTo("slow",1.0);
	});
	jQuery('.entry-content a').mouseout(function(e){
      jQuery(this).find('img.thumbnail').stop().animate({
	  	marginTop : '0'
	  }, 100).parent('a').find('span.slide-title').stop().fadeTo("slow",0.0);
	});
	}); 



$(document).ready(function(){
$(".ctn").hide();
$(".bancarous").jCarouselLite({
    auto: 4000,
    speed: 1000,
    visible:1
});
$(".nabil").jcarousel({
    auto: 5,
    speed: 1000,
	 wrap: 'both',
    visible:1,
 	size: 7,
    scroll: 1
});
$(".sousP span").click(function(){

        $.blockUI({ 
            message: $('#modalview'), 
            css: { top: '20%' } 
        }); 
 
        
   
 
});

$("#modalview").click(function(){$.unblockUI();


});

}); 
	
	




