
/* --------- Navigator event -----------*/
		$(window).load(function(){
		$("#loader").hide("fast");
		});
		
		$(document).ready(function(){
		
		
		
		
		$("#hide_this").click(function(){
			$("#loader").hide("fast");
		});
		$("#navbar , #menu_slide").hover(function(){
				clearTimeout(timeOut);
				$('#menu_slide').fadeOut('fast');
				$("#navbar").animate({marginTop:"0px",opacity: 0.9}, 500);
		   },function(){
				timeOut=setTimeout(hidenav,2000);
		   });
		   function hidenav(){
					$("#navbar").animate({marginTop:"-35px",opacity: 0.5}, 1000).queue(function(){
					$('#menu_slide').fadeIn('fast');
					$(this).dequeue();
		   });
		   }
		   $("#navbar li a").hover(function(){
				$(this).css("background-position","right");
		   },function(){
				$(this).css("background-position","left");
				}
		   );
		   timeOut=setTimeout(hidenav,4000);
		});
		  /* varying radii, IE only */
		  DD_roundies.addRule('.coupe1', '10px 0px 10px 0px');
		  DD_roundies.addRule('.coupe2', '0px 10px 0px  10px');
		  DD_roundies.addRule('.coupe3', '10px');
		  DD_roundies.addRule('.coupe5', '0 10px 10px 0');
		  DD_roundies.addRule('.coupe6', '0 0 10px 10px');
			/* ----------- Loading Image Function for Opera fail ----------- */
			jQuery.fn.onImagesLoaded = function(_cb) { 
				  return this.each(function() {
					var $imgs = (this.tagName.toLowerCase()==='img')?$(this):$('img',this),
						_cont = this,
							i = 0,
					_done=function() {
					  if( typeof _cb === 'function' ) _cb(_cont);
					};
					if( $imgs.length ) {
					  $imgs.each(function() {
						var _img = this,
						_checki=function(e) {
						  if((_img.complete) || (_img.readyState=='complete'&&e.type=='readystatechange') )
						  {
							if( ++i===$imgs.length ) _done();
						  }
						  else if( _img.readyState === undefined ) // dont for IE
						  {
							$(_img).attr('src',$(_img).attr('src')); // re-fire load event
						  }
						}; // _checki \\
						$(_img).bind('load readystatechange', function(e){_checki(e);});
						_checki({type:'readystatechange'}); // bind to 'load' event...
					  });
					} else _done();
				  });
				};
			/* -------- Portfolio Loader -----  */
			function LoadNewContent2(id_thumb){
				$("#ajax_text").animate({marginLeft:'-270px'},500).queue(function(){
				$.ajax({
				type:"GET",
				url:"portfolio_img.php",
				
				async:false, 
				data:({ id: id_thumb }),
				success:function(msg){
					obj = jQuery.parseJSON(msg);
					   $("#content_ajax").fadeOut(1000).queue(function(){
							$(obj.img).onImagesLoaded(function () {
									$("#content_ajax").html(obj.img);
									$("#ajax_text").html("<div><h3>"+obj.titre+"</h3>"+obj.text+"</div>");
									$("#content_ajax").fadeIn(1000).queue(function(){
												$("#ajax_text").animate({marginLeft:'0px'},500);
												$(this).dequeue();
									});
							});
							$(this).dequeue();
						});
					}});
				$(this).dequeue();
				});
			}

	/* --------- Scrollbar ------------ */
$(document).ready(function() {
$("#mcs_container").mCustomScrollbar("vertical",100,"easeOutCirc",1.05,"auto","yes","yes",10);
$("#mcs_container2").mCustomScrollbar("vertical",100,"easeOutCirc",1.05,"auto","yes","yes",10);
$("#mcs_container3").mCustomScrollbar("vertical",100,"easeOutCirc",1.05,"auto","yes","yes",10);
$("#mcs4_container").mCustomScrollbar("vertical",10,"easeOutCirc",1.05,"fixe","yes","yes",10);
$("#mcs6_container").mCustomScrollbar("vertical",100,"easeOutCirc",1.05,"auto","yes","yes",10);
$("#mcs5_container").mCustomScrollbar("horizontal",10,"easeOutCirc",1.05,"auto","yes","yes",10); 
});

