var isIE6 = ((navigator.userAgent.indexOf("MSIE 6.") != -1) && (navigator.userAgent.indexOf("Opera") == -1));
var isIE7 = ((navigator.userAgent.indexOf("MSIE 7.") != -1) && (navigator.userAgent.indexOf("Opera") == -1));
var isChrome = ((navigator.userAgent.indexOf("Chrome") != -1));
var isSafari = ((navigator.userAgent.indexOf("Safari") != -1));

$(document).ready(function(){
	//init lightbox
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
	//Mozaique Campaign page img effect
	$(".opac_effect a").hover(function(){
		//$(".opac_elt").show();
		//$(this).find(".opac_elt").hide();
	});
	
	//Mozaique Team page img effect
	$(".team_link").hover(function(){
		$(this).find(".team_elt").stop(true, true).slideUp("slow");
 	},function(){
	   	$(this).find(".team_elt").stop(true, true).slideDown("slow");
	});
	
	//mange style last element in menu left level 3
	var html_2nd_level = $(".menu_left ul ul").html();
	$(".menu_left ul ul").html(html_2nd_level+"<li class='color'>&mdash;</li>");
	$(".menu_left ul ul li:last").css("border","0");
	$(".menu_left ul ul li:last").css("padding-bottom","0");
	
	//background for input on hover anf focus
	$("input").hover(function(){
		$(this).addClass("write_hover");
	},function(){
		$(this).removeClass("write_hover");
	});
	
	$("input").click(function(){
		$(this).addClass("write");
	});
	
	$("input").blur(function(){
		$(this).removeClass("write");
	});
	
	$("input").focus(function(){
		$(this).addClass("write");
	});
	
	$("textarea").hover(function(){
		$(this).addClass("write_hover");
	},function(){
		$(this).removeClass("write_hover");
	});
	
	$("textarea").click(function(){
		$(this).addClass("write");
	});
	
	$("textarea").blur(function(){
		$(this).removeClass("write");
	});
	
	$("textarea").focus(function(){
		$(this).addClass("write");
	});
	
	$("#contact_form #name").addClass("write");
	$("#contact_form #name").focus();
	
	
	//INVITE PLAY ON SHOWREEL THUMB
	$(".title_over").prev().find("img").before("<span class='play_invite'></span>");
	
	$(".title_over").prev().hover(function(){
		$(this).find(".play_invite").addClass("play_invite_hover");
	},function(){
		$(this).find(".play_invite").removeClass("play_invite_hover");
	});
	
	$(".title_over").hover(function(){
		$(this).prev().find(".play_invite").addClass("play_invite_hover");
	},function(){
		$(this).prev().find(".play_invite").removeClass("play_invite_hover");
	});
	// END INVITE PLAY
	
});

$(function(){
	// custom scroll.
	if($("#scrollpane").jScrollPane != undefined){
		$("#scrollpane").jScrollPane({scrollbarWidth: 4});
	}
	
	//init carousel Banner
	if($(".carousel_js").infiniteCarousel != undefined){
		if(isChrome || isSafari){//temps de chargement supplémentaire sinon marche pas!
			setTimeout("$('.carousel_js').infiniteCarousel({imagePath: '/img/carousel/',displayThumbnails : 1,displayProgressBar : 1,transitionSpeed: 1000,displayTime: 6000,inView:1,advance:1,easeLeft: 'easeInOutBack',easeRight:'easeInOutBack'});",700);
		}
		else{
			$(".carousel_js").infiniteCarousel({
				imagePath: '/img/carousel/',
				displayThumbnails : 1,
				displayProgressBar : 1,	
				transitionSpeed: 1300,
				displayTime: 6000,
				inView:1,
				advance:1,
				easeLeft: 'easeInOutBack',
				easeRight:'easeInOutBack'
			});
		}
	}
	
	//init carousel News
	if($(".news_js").carousel != undefined){
		$(".news_js").carousel({ 
			direction: "vertical",
			loop: true,
			autoSlide: true,
			nextBtn: "<span></span>",
			prevBtn: "<span></span>",
			effect : "slide",
			animSpeed: "slow",
			autoSlideInterval: 8500
		});
	}
	
	/**  FADDING EFFECT -- Yorick **/
$(".page_campaigne img").stop().fadeTo(1, 0.85); 
	
	//anime img
	$(".page_campaigne img").hover(
		function (){
		
			$(this).stop().fadeTo(100, 1); 
		},function(){
			$(this).stop().fadeTo(100, 0.85); 
		}
	);

/* END FADDING EFFECT */
	
	
});

/********* SIFR ***********/
var fenice = {
	src: '/flash/sifr/ITCFenice.swf'
};

//sIFR.domains = ['asya.cross-systems.ch'] // Don't check for domains in this demo
sIFR.useStyleCheck = true;
sIFR.activate(fenice);
  
sIFR.replace(fenice, {
	selector: '.sifr_fenice_white'
	,css: [
	  '.sIFR-root { color: #ffffff; }'
	  ,'a { text-decoration: none; }'
	  ,'a:link { color: #ffffff; }'
	  ,'a:hover { color: #ffffff; }'
	]
	,selectable: true
	,transparent: true
});

sIFR.replace(fenice, {
	selector: '.sifr_fenice_grey'
	,css: [
	  '.sIFR-root { color: #7e7e7e; }'
	  ,'a { text-decoration: none; }'
	  ,'a:link { color: #7e7e7e; }'
	  ,'a:hover { color: #7e7e7e; }'
	]
	,selectable: true
	,transparent: true
});

/********* END SIFR ***********/

