$(document).ready(function(){
	
	monkeyNote = $("#newsBuzz").parent().parent().parent().parent().parent().parent().next();
	monkeyNote.hide();
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- COOKIES -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	
	var COOKIE_NAME = 'Ohara_Width';
	var hote = '.oharatree.com';
	
	//widthScreen=$.cookie(COOKIE_NAME);
	
	$("#myElement").slider({
			steps: 1,
			minValue: 0,
			maxValue: 1,
			startValue: SITE_CURSEUR_POSITION,
			values: [0, 1],
			slide: function(e, ui) {
				
				if(SITE_CURSEUR_POSITION!=ui.slider.curValue) {
					
					SITE_CURSEUR_POSITION=ui.slider.curValue;
					
					if(!IS_REGISTERED) { // utilisateur non connecté
						
						/* MISE A JOUR DES COOKIES */
						$.cookie(COOKIE_NAME, SITE_CURSEUR_POSITION, { path: '/', domain: hote, expires: 30 });
					}
                
					/* */
					switch(SITE_CURSEUR_POSITION) {
						
						case 0: widthBan = 990;
								positionCo = 350;
							break;
						case 1: widthBan = 1250;
								positionCo = 200;
							break;
						default: widthBan = 990;
								positionCo = 350;
							break;
						
					}					
					
					$('#all').animate({
						width:widthBan
					}, 'slow', 'linear');
				}
			}
		});
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- FIN COOKIES -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	
	$(".max_poll").click(function() {
		
		$(this).next("hr").next("div").slideToggle();
	});
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- CONNEXION -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	
	
	$(".connect").click(function() {
		
		if($("#topConnexion").css("top")=="0px") {
			
			$("#topConnexion").animate({top:"-60px"}, 'fast');
		}
		else {
			
			$("#topConnexion").animate({top:"0"}, 'fast');
		}
	});
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- FIN CONNEXION -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- MENU  -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	
	
	$("#menu li").mouseover(function() {

		$(this).children("div").show();
	});
	
	$("#menu li").mouseout(function() {

		$(this).children("div").hide();
	});
	
	$(".submenuContent").mouseover(function() {

		$(this).children("div").show();
	});
	
	$(".submenuContent").mouseout(function() {

		$(this).children("div").hide();
	});
	
	
	if(document.location.pathname=='/index.php' || document.location.pathname=='/') {
		
		$("#newsBuzz").click(function() {
			
			monkeyNote = $(this).parent().parent().parent().parent().parent().parent().next();
			if(monkeyNote.css('display')=='none') monkeyNote.show();
			else monkeyNote.hide();
		});
	}
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- INDEX -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/index.php' || document.location.pathname=='/' || document.location.pathname=='/search.php' || document.location.pathname=='/404.php') {
		
		/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		/* _-_-_-_-_-_-_-_-_-_-_-_--_-_-_-_-  NAKAMAS -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		$("#colNakama").wslide({
			width: 169,
			height: 380,
			duration:1000,
			horiz: true
		});
		
		$(".next").click(function() {
			
			temp = $(this).attr('href');
			temp = temp.split('-');
			
			num = temp[1];
			num++;
			
			nbreCol = $(this).prev().prev().children('ul').children('li').length;
			
			if(num <= nbreCol) {
				
				prevElem = $(this).prev().attr('href');
				prevElem = prevElem.split('-');
				prevElem = prevElem[1];
				
				$(this).attr('href', '#colNakama-'+ num);
				if(num > 3) $(this).prev().attr('href', '#colNakama-'+ ++prevElem);
			}
			else if(--num == nbreCol) $(this).prev().attr('href', '#colNakama-'+ --num);
		});
		
		
		$(".prev").click(function() {
			
			temp = $(this).attr('href');
			temp = temp.split('-');
			
			num = temp[1];
			
			nbreCol = $(this).prev().children('ul').children('li').length;
			
			if(num > 1) {
				
				nextElem = $(this).next().attr('href');
				nextElem = nextElem.split('-');
				nextElem = nextElem[1];
				
				$(this).attr('href', '#colNakama-'+ (num-1));
				if(nextElem-num==2) $(this).next().attr('href', '#colNakama-'+ --nextElem);
			}
			else $(this).next().attr('href', '#colNakama-'+ ++num);
		});
		
		
		/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		/* _-_-_-_-_-_-_-_-_-_-_-_--_-_-_-_-  SONDAGE -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		$(".actuContent input").click(function() {
		
		CLICK[$(this).val()] = (isNaN(CLICK[$(this).val()])) ? 1 : CLICK[$(this).val()]+1;
		
		$.ajax({
			   type: "POST",
			   url: "include/index/poll.php?ajax=1&clik="+ CLICK[$(this).val()],
			  
			   data: "poll="+ $(this).val(),
			   dataType: "text",
			   processData: false,
			   success: function(data){ //alert(data);
				   var result= data.split("&&");
					
					var pollId = "#poll_"+ result[0];
					var total = result[1];
					
					
					$(pollId).height($(pollId).height()-10);
					$(pollId +" tr").fadeOut("slow");
				 	
					$(pollId +" tr").queue(function() {
														  
						$(pollId).html('<tr><td colspan="2" style="text-align:center">'+ result[1] +' votes</td></tr>');
						
						for(i=2; i<result.length; i++) {
							
							$(pollId).append('<tr class="pollResult"><td width="25%">'+ result[i] +'</td><td><div class="PB" id="opt_'+ i +'" style="width:0%">&nbsp;</div></td></tr>');
						}
						$(this).dequeue();
						
						for(i=2; i<result.length; i++) {
							//alert(result[i]);
							$("#opt_"+ i).animate({ width: result[i] }, 500);
						}
						
					});
					
			   }
			   
			});
	});
	}
	
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- RECHERCHE -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/search.php') {
		
		
		$(":radio").click(function() {
			
			if($(this).attr('id') == 'lastRadio') {
				
				if($('.listCat').css("display") == "none") {
					
					$('.listCat').slideDown('fast');
				}
			}
			else {
				
				if($('.listCat').css("display") == "block") {
					
					$('.listCat').slideUp('fast');
				}
			}
		});
		
		$("#search").keyup(function(event) {
			
			if(event.keyCode == 13) {
			
				if($("#search").val() != '') {
					
					$("#mySearchForm").attr('action', '?s='+ $("#search").val());
					
					$("#mySearchForm").submit();
				}
				else {
					
					alert('le champ de recherche ne doit pas être vide');
				}
			}
		});
		
		$("#searchValid").click(function() {
			
			if($("#search").val() != '') {
				
				$("#mySearchForm").attr('action', '?s='+ $("#search").val());
				
				$("#mySearchForm").submit();
			}
			else {
				
				alert('le champ de recherche ne doit pas être vide');
			}
		});
	}
	
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-  ACCOUNT -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/account.php') {
		
		$(".delete").click(function() {
			
			$cat_visible = $(this).parent().next('div').children('.cat_visible');
			$cat_visible.val(0);
			
			$(this).removeClass('delete');
			$(this).addClass('add');
		});
		
		$(".add").click(function() {
			
			$cat_visible = $(this).parent().next('div').children('.cat_visible');
			$cat_visible.val(1);
			
			$(this).removeClass('add');
			$(this).addClass('delete');
		});
		
		
		
		$(".favoris").click(function() {
			
			$teams = $(".favorisList");
			$spoil = $(".spoilInfos");
			$site = $(".allSiteParams");
			
			
			if($teams.css("display") == "none") {
				
				if($spoil.css("display") == "block") {
					
					$spoil.slideUp("fast", $teams.slideDown("slow"));
				}
				else if($site.css("display") == "block") {
					
					$site.slideUp("fast", $teams.slideDown("slow"));
				}
				else $teams.slideDown("slow");
			}
			else $teams.slideUp("fast");
		});
		
		
		$(".spoil").click(function() {
			
			$teams = $(".favorisList");
			$spoil = $(".spoilInfos");
			$site = $(".allSiteParams");
			
			
			if($spoil.css("display") == "none") {
				
				if($teams.css("display") == "block") {
					
					$teams.slideUp("fast", $spoil.slideDown("slow"));
				}
				else if($site.css("display") == "block") {
					
					$site.slideUp("fast", $spoil.slideDown("slow"));
				}
				else $spoil.slideDown("slow");
			}
			else $spoil.slideUp("fast");
		});
		
		
		$(".params").click(function() {
			
			$teams = $(".favorisList");
			$spoil = $(".spoilInfos");
			$site = $(".allSiteParams");
			
			
			if($site.css("display") == "none") {
				
				if($teams.css("display") == "block") {
					
					$teams.slideUp("fast", $site.slideDown("slow"));
				}
				else if($spoil.css("display") == "block") {
					
					$spoil.slideUp("fast", $site.slideDown("slow"));
				}
				else $site.slideDown("slow");
			}
			else $site.slideUp("fast");
		});
		
		/* partie news */
		$("#liste_cat").sortable({ 
			axis: 'y',
			items: 'table',
			update: function (e, ui) {
				
				$cat = ui.item;
				
				serial = $("#liste_cat").sortable("serialize");
				
				//console.log("LOL : %s", serial);
				
				$.ajax({
				   type: "POST",
				   url: "include/account/cat_order.php",
				  
				   data: serial,
				   dataType: "script",
				   processData: false,
				   success: function(result){
					 //$("#loading").html(result);
					 
				   }
				});
			},
			placeholder: "cat-selected",
			revert: true,
		});
		
		/* partie spoil */
		if(SPOIL_CURSEUR_POSITION>0) {
			
			switch(SPOIL_CURSEUR_POSITION) { 
					
				case 1:
					
					$("#spoil").css({
						
						backgroundPosition:'center -20px'
					});
					
					$("#spoil div").css({
											
						backgroundPosition:'center -23px'
					});
					
					break;
				
				case 2:

					$("#spoil").css({
						
						backgroundPosition:'center -40px'
					});
					
					$("#spoil div").css({
											
						backgroundPosition:'center -46px'
					});
					
					break;
				
				case 3:

					$("#spoil").css({
						
						backgroundPosition:'center bottom'
					});
					
					$("#spoil div").css({
											
						backgroundPosition:'center bottom'
					});
					
					break;
			}
		}
		
		$("#spoil").slider({
			steps: 3,
			minValue: 0,
			maxValue: 3,
			startValue: SPOIL_CURSEUR_POSITION,
			slide: function(e, ui) {
				
				$("#spoil_level").val(ui.slider.curValue);
				
				switch(ui.slider.curValue) { 
					case 0:
					
						$("#spoil").css({
							
							backgroundPosition:'center top'
						});
						
						$("#spoil div").css({
												
							backgroundPosition:'center top'
						});
						
						break;
					
					case 1:
						
						$("#spoil").css({
							
							backgroundPosition:'center -20px'
						});
						
						$("#spoil div").css({
												
							backgroundPosition:'center -23px'
						});
						
						break;
					
					case 2:

						$("#spoil").css({
							
							backgroundPosition:'center -40px'
						});
						
						$("#spoil div").css({
												
							backgroundPosition:'center -46px'
						});
						
						break;
					
					case 3:

						$("#spoil").css({
							
							backgroundPosition:'center bottom'
						});
						
						$("#spoil div").css({
												
							backgroundPosition:'center bottom'
						});
						
						break;
				}

			}
		});
	
		$(".favorisList").hide();
		$(".spoilInfos").hide();
		$(".allSiteParams").hide();
		
		$(".deleteTeam").click(function() {
			
			infos = $(this).attr("id");
			infos = infos.split("_");
			infos = infos[1];
			
			$(this).parent().fadeOut('slow');
			
			$.ajax({
				type: "POST",
				url: "include/account/team_del.php?ajax=1",
				 
				data: "team="+ infos,
				dataType: "text",
				processData: false,
				success: function(data){
				 	
					$(this).parent().fadeOut('slow');
				}
			   
			});
		});
		
		$(".send").click(function() {
			
			$(".formName").submit();
		});
	}
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-  STAFF -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/staff.php') {
		
		$('.statut').click(function() {
			
			listeStaff = $(this).next();
			if(listeStaff.css("display") == "none") listeStaff.slideDown("slow");
			else listeStaff.slideUp("slow");
		});
	}
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- MANGA -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/manga.php') {
				
		$("#listTranche").wslide({
			width: 32* NBRE_TRANCHE,
			height: 375,
			liHeight: 30,
			pos: POS,
			duration:1000,
			horiz: true
		});
		
		$("#listTranche2").wslide({
			width: 32* NBRE_TRANCHE,
			height: 375,
			liHeight: 30,
			pos: POS,
			duration:1000,
			horiz: true
		});
	}
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- SHONEN JUMP -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/shonen_jump.php') {
		
		$('.liste_chap p:first-child').click(function() {
			
			chap_num = $(this).attr('id');
			chap_num = chap_num.split('chap_');
			chap_num = chap_num[1];
			
			$('.team').hide();
			$('#team_for_chap_'+ chap_num).slideDown();
			
			$('.chapTitle').hide();
			$(this).parent().children('.chapTitle').slideDown();
		});
		
		$('#liste_chap p:first-child').click(function() {
			
			chap_num = $(this).attr('id');
			chap_num = chap_num.split('chap_');
			chap_num = chap_num[1];
			
			$('.team').hide();
			$('#team_for_chap_'+ chap_num).slideDown();
			
			$('.chapTitle').hide();
			$(this).parent().children('.chapTitle').slideDown();
		});
	}
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- EPISODE -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/episode.php') {
		/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		/* _-_-_-_-_-_-_-_-_-_-_-_--_-_-_- MENU-RIGHT -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		$(".titreSaison").click(function(){
		
		$pageList = $(this).next();
		$saison = $(this).parent();
		
		if($saison.css("width")=="39px") { // on ouvre un onglet
			
			$saison.animate({width:"146px"}, 'fast');
			$saison.queue(function() {
				
				$pageList.slideDown('fast');
				$(this).dequeue();
			});
		}
		else { // on ferme l'onglet
			
			$pageList.slideUp('fast');
			$pageList.queue(function() {
        		
				$saison.animate({width:"39px"}, 'fast');
				$(this).dequeue();
			});
			
			
		}
	});
	
		$(".saisonNum").click(function() {
			
			$(this).next().slideToggle();
		});
	
		/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		/* _-_-_-_-_-_-_-_-_-_-_-_--_-_-_- MENU-LEFT  -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
		$(".titreSearch").click(function(){
		
			$parent = $(this).parent();
			
			if($parent.css("width")=="39px") { // on ouvre un onglet
				
				$(this).parent().animate({width:"215px"}, 'fast');
				$(this).next().slideDown('fast');
				//$(".epSaison").animate({width:"120px"}, 'fast');
			}
			
			else if($parent.css("width")=="215px") { // on ferme l'onglet
				
				$(this).next().slideUp('fast');
				$parent.animate({width:"39px"}, 'fast');
			}
		});
		
		$(".searchContent input[type=text]").keyup(function(event) {
			
			if(event.keyCode == 13 && $(this).val() != '') {
				
				showEpisode($(this).val());
			}
		});
		
		$("#searchInput").keyup(function(event) {
			
			if(event.keyCode == 13 && $(this).val() != '') {
				
				showEpisode($(this).val());
			}
		});
		
		$("#searchValid").click(function() {
			
			showEpisode($("#searchInput").val());
		});
		
		
		
		
		/* SUB MENU */
		$(".fansub").click(function() {
			
			$parent = $(this).parent().parent().parent();
			if($parent.children(".listeTeam").css("display")=="none") {
				
				// onglet son
				if($parent.children(".listeSon").css("display")=="block") 
					$parent.children(".listeSon").slideUp("fast", $parent.children(".listeTeam").slideDown());
				
				// onglet ost 
				else if($parent.children(".listeOst").css("display")=="block") 
					$parent.children(".listeOst").slideUp("fast", $parent.children(".listeTeam").slideDown());
				
				// onglet persos
				else if($parent.children(".listePerso").css("display")=="block") 
					$parent.children(".listePerso").slideUp("fast", $parent.children(".listeTeam").slideDown());
				
				// onglet infos
				else if($parent.children(".listeInfos").css("display")=="block") 
					$parent.children(".listeInfos").slideUp("fast", $parent.children(".listeTeam").slideDown());
					
				else $parent.children(".listeTeam").slideDown();
			}
			else $parent.children(".listeTeam").slideUp();
					
		});
		
		$(".son").click(function() {
			
			$parent = $(this).parent().parent().parent();
			if($parent.children(".listeSon").css("display")=="none") {
				
				// onglet team
				if($parent.children(".listeTeam").css("display")=="block") 
					$parent.children(".listeTeam").slideUp("fast", $parent.children(".listeSon").slideDown());
				
				// onglet ost 
				else if($parent.children(".listeOst").css("display")=="block") 
					$parent.children(".listeOst").slideUp("fast", $parent.children(".listeSon").slideDown());
				
				// onglet persos
				else if($parent.children(".listePerso").css("display")=="block") 
					$parent.children(".listePerso").slideUp("fast", $parent.children(".listeSon").slideDown());
				
				// onglet infos
				else if($parent.children(".listeInfos").css("display")=="block") 
					$parent.children(".listeInfos").slideUp("fast", $parent.children(".listeSon").slideDown());
					
				else $parent.children(".listeSon").slideDown();
			}
			else $parent.children(".listeSon").slideUp();
					
		});
		
		$(".ost").click(function() {
			
			$parent = $(this).parent().parent().parent();
			if($parent.children(".listeOst").css("display")=="none") {
				
				// onglet team
				if($parent.children(".listeTeam").css("display")=="block") 
					$parent.children(".listeTeam").slideUp("fast", $parent.children(".listeOst").slideDown());
				
				// onglet son
				else if($parent.children(".listeSon").css("display")=="block") 
					$parent.children(".listeSon").slideUp("fast", $parent.children(".listeOst").slideDown());
				
				// onglet persos
				else if($parent.children(".listePerso").css("display")=="block") 
					$parent.children(".listePerso").slideUp("fast", $parent.children(".listeOst").slideDown());
				
				// onglet infos
				else if($parent.children(".listeInfos").css("display")=="block") 
					$parent.children(".listeInfos").slideUp("fast", $parent.children(".listeOst").slideDown());
				
				else $parent.children(".listeOst").slideDown();
			}
			else $parent.children(".listeOst").slideUp();
					
		});
		
		$(".perso").click(function() {
			
			$parent = $(this).parent().parent().parent();
			if($parent.children(".listePerso").css("display")=="none") 
				
				// onglet team
				if($parent.children(".listeTeam").css("display")=="block") 
					$parent.children(".listeTeam").slideUp("fast", $parent.children(".listePerso").slideDown());
				
				// onglet son
				else if($parent.children(".listeSon").css("display")=="block") 
					$parent.children(".listeSon").slideUp("fast", $parent.children(".listePerso").slideDown());
				
				// onglet ost 
				else if($parent.children(".listeOst").css("display")=="block") 
					$parent.children(".listeOst").slideUp("fast", $parent.children(".listePerso").slideDown());
				
				// onglet infos
				else if($parent.children(".listeInfos").css("display")=="block") 
					$parent.children(".listeInfos").slideUp("fast", $parent.children(".listePerso").slideDown());
				
				else $parent.children(".listePerso").slideDown();
			
			else $parent.children(".listePerso").slideUp();
					
		});
		
		$(".infos").click(function() {
			
			$parent = $(this).parent().parent().parent();
			if($parent.children(".listeInfos").css("display")=="none") {
				
				// onglet team
				if($parent.children(".listeTeam").css("display")=="block") 
					$parent.children(".listeTeam").slideUp("fast", $parent.children(".listeInfos").slideDown());
				
				// onglet son
				else if($parent.children(".listeSon").css("display")=="block") 
					$parent.children(".listeSon").slideUp("fast", $parent.children(".listeInfos").slideDown());
				
				// onglet ost 
				else if($parent.children(".listeOst").css("display")=="block") 
					$parent.children(".listeOst").slideUp("fast", $parent.children(".listeInfos").slideDown());
				
				// onglet persos
				else if($parent.children(".listePerso").css("display")=="block") 
					$parent.children(".listePerso").slideUp("fast", $parent.children(".listeInfos").slideDown());
				
				else $parent.children(".listeInfos").slideDown();
			}
			else $parent.children(".listeInfos").slideUp();
					
		});
	}
	
	
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-  FILM -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/film.php') {
		
		$("#searchInput").keyup(function(event) {
			
			if(event.keyCode == 13)	showFilm($("#searchInput").val());						 
				
		});
		
		$("#searchValid").click(function() {
			
			showFilm($("#searchInput").val());
		});
	}
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- BONUS -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/bonus.php') {
		
		$("#searchInput").keyup(function(event) {
			
			if(event.keyCode == 13)	showBonus($("#searchInput").val());						 
				
		});
		
		$("#searchValid").click(function() {
			
			showBonus($("#searchInput").val());
		});
	}
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- SPECIAL -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/special.php') {
		
		$("#searchInput").keyup(function(event) {
			
			if(event.keyCode == 13)	showSpecial($("#searchInput").val());						 
				
		});
		
		$("#searchValid").click(function() {
			
			showSpecial($("#searchInput").val());
		});
	}
	
	
	
	
	
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- DVD -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/dvd.php') {
		
		temp = $("#cover_infos img").attr('src').split('/');
		lang = temp[5];
		
		if(lang=='JAP') {
			
			$(".book").css({ backgroundImage : 'url(images/dvd/background_jap.png)' });
			
			$("#listTranche").wslide({
				width: 31* NBRE_TRANCHE,
				height: 375,
				liHeight: 29,
				pos: POS,
				duration:1000,
				horiz: true
			});
			
			$("#listTranche2").wslide({
				width: 31* NBRE_TRANCHE,
				height: 375,
				liHeight: 29,
				pos: POS,
				duration:1000,
				horiz: true
			});
		}
		else {
			
			$(".book").css({ backgroundImage : 'url(images/dvd/background_fr.png)' });
			
			$("#listTranche").wslide({
				width: 47* NBRE_TRANCHE,
				height: 375,
				liHeight: 45,
				pos: POS,
				duration:1000,
				horiz: true
			});
			
			$("#listTranche2").wslide({
				width: 47* NBRE_TRANCHE,
				height: 375,
				liHeight: 45,
				pos: POS,
				duration:1000,
				horiz: true
			});
		}
	}
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-  OST -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/ost.php') {
		
		$('.infos').click(function() {
			
			$listePiste = $(this).parent().parent().parent().parent().parent().next().find('.listePiste');
			
			if($listePiste.css("display") == "none") $listePiste.slideDown('fast');
			else {
				
				$pisteInfos = $listePiste.parent().next().find('.listeInfos');
				$pisteInfos.slideUp('fast');
				
				$pisteInfos.find('.pisteInfos:visible').hide();
				
				$listePiste.slideUp('fast');
			}
		});
		
		$('.piste').click(function() {
			
			$pisteInfos = $(this).parent().parent().parent().parent().parent().next().find('.listeInfos');
			
			piste_id = $(this).attr('id');
			piste_id = piste_id.split('_');
			album_id = piste_id[1];
			piste_id = piste_id[2];
			
			
//			alert($pisteInfos.css("display"));
			if($pisteInfos.css("display") == 'none') {
			//if($pisteInfos.css("opacity") == 0) {
				
				$("#pisteInfos_"+ album_id +"_"+ piste_id).show();
				
				$pisteInfos.css('display', 'table');
				$pisteInfos.slideDown('fast');
				//$pisteInfos.fadeTo('fast', 100);
			}
			else {
				
				$pisteInfos.find('.pisteInfos:visible').hide();
				
				$("#pisteInfos_"+ album_id +'_'+ piste_id).slideDown();
			}
		});
	}
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-  SOUND DROP -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/sound_drop.php') {
		
		/* MENU DE GAUCHE */
		$(".toConnect").click(function() {
			
			alert('Connectez-vous à cotre compte pour pouvoir accéder à cette partie');
		});
		 
		/* MENU DE DROITE */
		$(".sliderGroupe").slider({
			slide: function(e, ui) { 
				
				col = $(this).parent().children(".wslide-wrap").children(".colGroupe");
			//alert(col.css("width"));
				colWidth = col.css("width").split('px');
				colWidth = colWidth[0];
				
				pos = (ui.value/100) * (colWidth - 144);
				
				col.css("left", "-"+ pos +"px");
			}
		});
		
		$(".groupe").click(function() {
			
			listGroupe = $(this).parent().children(".listGroupe");
			
			if(listGroupe.css("display") == "block") listGroupe.slideUp();
			else  listGroupe.slideDown();
		});
		
		// "fermeture" des box du menu de droite
		$(".listGroupe").css("display", "none");
		
		$("#colSon").wslide({duration:1000, height:401, horiz:true, width:310});
		
		$('.type_son').click(function() {
			
			listeSaison = $(this).next();
			
			if(listeSaison.css("display") == "none") listeSaison.slideDown("slow");
			else listeSaison.slideUp("slow");
		});
		
		
		$("#ep_liste").change(function() {
			
			ep = $(this).val();
			
			if(ep > 0) {
				
				$.ajax({
					type: "POST",
					url: "include/sound_drop/perso_liste.php?ajax=1",
					 
					data: "episode="+ ep,
					dataType: "text",
					processData: false,
					success: function(data){
						
						$(".liste_perso").html(data);
					}
				});
			}
		});
		
		
		$(".liste_perso").ajaxStart(function(){
				
			$(this).html('<div style="text-align:center"><img src="images/ajax-loader.gif" alt="Loading"></div>');
		});
		
		/*$(".persoToAdd").live("click", function() {
			
			$("#persoName").val($(this).attr('alt'));
		});*/
	}
	
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-  TEAM -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	
	if(document.location.pathname=='/team.php') {
		
		$("#searchInput").keyup(function(event) {
			
			if(event.keyCode == 13)	showNews($("#searchInput").val());						 
				
		});
		
		$("#searchValid").click(function() {
			
			showNews($("#searchInput").val());
		});
		
		$("#fav").click(function() {
			
			addToFavorites($("#teamId").val());
		});
		
		$(".typeTrailer").click(function() {
			
			type = $(this).attr('id').split('_');
			type = type[1];
			
			for(i=0 ; i<3 ; i++) {
				
				if(i!=type) $("#type_"+ i).hide();
			}
			
			$("#type_"+ type).slideToggle();
		});
		
		$(".fansub").click(function() {
			
			$parent = $(this).parent().parent();
			$parent.children(".listeTeam").slideToggle();
		});
		
		$(".quest").click(function() {
			
			$(this).next().slideToggle();
		});
		
		$(".opt_quest").click(function() {
			
			$(".reponse").slideToggle();
		});
	}
	
	
	
	
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-  JEUX -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	/* _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ */
	if(document.location.pathname=='/jeux.php') {
		
		$("#searchInput").keyup(function(event) {
			
			if(event.keyCode == 13)	showJeux($("#searchInput").val());						 
				
		});
		
		$("#searchValid").click(function() {
			
			showNews($("#searchInput").val());
		});
		
		$(".infos").click(function() {
			
			jeuxId = $(this).attr("id").split("_");
			
			jeuxId = jeuxId[1];
			
			if($("#des_"+ jeuxId).css("display")=="none") {
				
				if($("#video_"+ jeuxId).css("display")=="block") {
					
					$("#video_"+ jeuxId).slideUp("fast");
					$("#video_"+ jeuxId).queue(function() {
						
						$("#des_"+ jeuxId).slideDown();
						$(this).dequeue();
					});
				}
				else {
					
					$("#des_"+ jeuxId).slideDown();
				}
			}
			else {
				
				$("#des_"+ jeuxId).slideUp();
			}
		});
		
		$(".video").click(function() {
			
			jeuxId = $(this).attr("id").split("_");
			
			jeuxId = jeuxId[1];
			
			if($("#video_"+ jeuxId).css("display")=="none") {
				
				if($("#des_"+ jeuxId).css('display') =='block') {
					
					$("#des_"+ jeuxId).slideUp('fast');
					$("#des_"+ jeuxId).queue(function() {
						
						$("#video_"+ jeuxId).slideDown();
						$(this).dequeue();
					});
				}
				else  {
					
					$("#video_"+ jeuxId).slideDown();
				}
			}
			else {
					
				$("#video_"+ jeuxId).slideUp();
			}
		});
	}
	
	
	/* SUBMENU*/
	if(document.location.pathname=='/bonus.php' || document.location.pathname=='/film.php' || document.location.pathname=='/special.php') {
		
		
		$(".fansub").click(function() {
			
			$parent = $(this).parent().parent();
			if($parent.children(".listeTeam").css("display")=="none") {
				
				if($parent.children(".listePerso").css("display")=="block") 
					$parent.children(".listePerso").slideUp("fast", $parent.children(".listeTeam").slideDown());
				
				else if($parent.children(".listeInfos").css("display")=="block") 
					$parent.children(".listeInfos").slideUp("fast", $parent.children(".listeTeam").slideDown());
				
				else $parent.children(".listeTeam").slideDown();
			}
			else $parent.children(".listeTeam").slideUp();
					
		});
		
		$(".perso").click(function() {
			
			$parent = $(this).parent().parent();
			if($parent.children(".listePerso").css("display")=="none")
				
				if($parent.children(".listeTeam").css("display")=="block")
					$parent.children(".listeTeam").slideUp("fast", $parent.children(".listePerso").slideDown());
				
				else if($parent.children(".listeInfos").css("display")=="block")
					$parent.children(".listeInfos").slideUp("fast", $parent.children(".listePerso").slideDown());
				
				else $parent.children(".listePerso").slideDown();
			
			else $parent.children(".listePerso").slideUp();
					
		});
	}
});