var $j = jQuery.noConflict();

$j(document).ready(function() {

<!-- Add hover image to portfolio box -->
$j(".portfolio_box").hover(function()
{ $j(this).css("background-image","url(images/portfolio_over.png)"); }, function(){ $j(this).css("background-image","none"); });

<!-- Animate opacity on images-->
$j(".portfolio_box img, .portfolio_box_slide img, .related_posts_box img, .sidebar img, .post_entry.blog img").hover(function()
{ $j(this).animate({opacity: .7,left: '0px'}, "500"); }, function(){ $j(this).animate({opacity: 1,left: '0px'}, "500"); });

<!--prettyPhoto -->
$j("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
<!--Menu -->
$j("ul.menu").superfish();


/* *********************************************************************
* Fade
* *********************************************************************/

$j(".noselected_site img").fadeTo("slow", 0.60);

$j(".selected_site img").mouseenter(function() {
  $j(this).stop().fadeTo("slow", 0.60);
});
$j(".selected_site img").mouseleave(function() {
  $j(this).stop().fadeTo("slow", 1);
});
$j(".noselected_site img").mouseenter(function() {
  $j(this).stop().fadeTo("slow", 1);
});
$j(".noselected_site img").mouseleave(function() {
  $j(this).stop().fadeTo("slow", 0.60);
});

$j(".noselected_etape img").fadeTo("slow", 0.60);

$j(".selected_etape img").mouseenter(function() {
  $j(this).stop().fadeTo("slow", 0.60);
});
$j(".selected_etape img").mouseleave(function() {
  $j(this).stop().fadeTo("slow", 1);
});
$j(".noselected_etape img").mouseenter(function() {
  $j(this).stop().fadeTo("slow", 1);
});
$j(".noselected_etape img").mouseleave(function() {
  $j(this).stop().fadeTo("slow", 0.60);
});

$j(".submit2").mouseenter(function() {
  $j(this).stop().fadeTo("slow", 0.70);
});
$j(".submit2").mouseleave(function() {
  $j(this).stop().fadeTo("slow", 1);
});




/* *********************************************************************
* Fancybox
* *********************************************************************/
$j(".modal-link").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
});


/* *********************************************************************
* Form validate
* *********************************************************************/
$j("#commentForm").validate();
$j("#commentForm2").validate();
$j("#connectFormClient").validate();
//$j("#commentForm4").validate();
	
$j.metadata.setType("attr", "validate");



/* *********************************************************************
* Scrollable Vertical
* *********************************************************************/
//$j(".scrollable").scrollable({ vertical: true, mousewheel: true });	





		
});

$j(function() {
		$j( "#tabs" ).tabs();
});

$j(function(){
	$j("#refreshimg").click(function(){
		$.post('newsession.php');
		$("#captchaimage").load('image_req.php');
		return false;
	});
	
	$j("#commentForm3").validate({
		rules: {
			captcha: {
				required: true,
				remote: "process.php"
			}
		},
		messages: {
			captcha: "votre saisie est incorrecte."	
		},
		success: function(label) {
			label.addClass("valid").text("")
		},
		onkeyup: false
	});
	
});


$j(function(){
	$j("#refreshimg").click(function(){
		$.post('newsession.php');
		$("#captchaimage").load('image_req.php');
		return false;
	});
	
	$j("#commentForm4").validate({
		rules: {
			captcha: {
				required: true,
				remote: "process.php"
			}
		},
		messages: {
			captcha: "votre saisie est incorrecte."	
		},
		success: function(label) {
			label.addClass("valid").text("")
		},
		onkeyup: false
	});
	
});


$j(function() {		
		
	// initialize scrollable with mousewheel support
	$j(".scrollable").scrollable({ vertical: true, circular: true, mousewheel: true }).navigator().autoscroll({
	interval: 7000		
    });	
	
	// initialize scrollable with mousewheel support
	$j(".scrollable2").scrollable({ circular: true, mousewheel: true }).navigator().autoscroll({
	interval: 4000		
    });	
	
	// initialize scrollable with mousewheel support
	$j(".scrollable3").scrollable({ vertical: true, mousewheel: true });
	
});





// Cufon font
Cufon.replace('h1, h2, h3, h4, h5, h6', {hover: true});

