function fxShowAccInfo(a,b){
	showMe(a);
	hideMe(b);	
}
//
// Disclaimer
function setCookie(name, value, expires) {
	if(expires != 0)
		document.cookie= name + "=" + escape(value) + "; expires="+expires.toGMTString()+ "; path=/";
	else
	{
		var expirationDate = new Date();
		expirationDate.setTime( expirationDate.getTime() + (3600*24*300*1000) );
		document.cookie= name + "=" + escape(value) + "; expires="+expirationDate.toGMTString()+ "; path=/";
	}
}

function check_age(name){
	var expirationDate = new Date();
	expirationDate.setTime( expirationDate.getTime() + (1*24*3600*1000) );
	setCookie(name, '1', expirationDate);
	
	document.getElementById('disclaimer').style.display='none';
}
function startThumbChange(index, vid, num_thumbs, path)
{	
	changing_thumbs[vid] = true;
	
	changeThumb(index, vid, 0, num_thumbs, path);
}

function ticketSent()
{
	
	try{$("#signaler_content").dialog("close");}catch(e){}
	try{$("#ost_content").dialog("close");}catch(e){}
	
	$(document).unbind('click');
	window.location = window.location.href + '#';
	$('.contenido').prepend('<div class="msgbox">Votre signalement a bien été pris en compte. <a href="http://www.dailyplaisir.com/faq#Q18">En savoir plus afin de recevoir une réponse de l\'équipe.</a></div>')
}

function endThumbChange(index, vid, path, deft)
{
	changing_thumbs[vid] = false;
	document.getElementById(index).src = path + "/" + vid + "_" + deft + ".jpg";
}

// ChangeThumbs
var changing_thumbs = new Array();
function changeThumb(index, vid, i, num_thumbs, path)
{
	if (changing_thumbs[vid])
	{
		image_chargement_id = (i + 1) % num_thumbs;
		
		document.getElementById(index).src = path + "/"+ vid + "_" + i + ".jpg";
		//document.getElementById("image_chargement").src = path + "/"+ vid + "_" + image_chargement_id + ".jpg";

		i = i % (num_thumbs - 1);
		i++;
		setTimeout("changeThumb('" +index+ "','" +vid+ "'," +i+ ", " +num_thumbs+ ", '" +path+ "')", 600);
		
	}
}
// 
// Video Ratting
var sMax, ratted;
function rating(num){
	sMax = 0;	// Definition du nombre d'etoiles
	
	for(n=0; n<num.parentNode.childNodes.length; n++)
	{
		if(num.parentNode.childNodes[n].nodeName == "A")
			sMax++;
	}

	s = num.id.replace("star_", '');
	for(i=1; i<=sMax; i++)
	{		
		if(i<=s)
			document.getElementById("star_"+i).className = "on";
		else
			document.getElementById("star_"+i).className = "";
	}
}
function off(me){
	for(i=1; i<=sMax; i++)
		document.getElementById("star_"+i).className = "";
	
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
	{
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1)
		{
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return "";
}


function applyChannels()
{
	var newCookie = []
	$("#navigation ul li a.disabled").attr('id', 
		function(arr){
			newCookie.push(this.id.replace("chan_", ""));
			}
		);
		
	var expirationDate = new Date();
	expirationDate.setTime( expirationDate.getTime() + (3600*24*300*1000) );
	setCookie('__navigation', newCookie.join('|'), expirationDate);
}


// Navigation
function init_navigation()
{
	var cookieValue = getCookie('__navigation');
	var cookieArray	= cookieValue.split('|');
	
	// suppression de toutes les classes
	$("#navigation ul li a").removeClass();
	
	// enablelage
	for(var i=0; i<cookieArray.length;i++)
	{
		$("#navigation ul li a#chan_"+cookieArray[i]).addClass('disabled'); 
	}
	
	// disablelage
	$("#navigation ul li a:not([class='disabled'])").addClass('enabled'); 
	return false;
}

// Navigation
function reinit_navigation()
{
	// suppression de toutes les classes
	$("#navigation ul li a").removeClass().addClass('enabled');
	return false;
}

// Définition des variables
var mainNav, currentNav, navChanging;

function init_submenu()
{
	// Menu principal.
	mainNav = currentNav = $('#navsubbar p span.current').attr('id');
	
	$("#navcontainer ul li a").mouseenter(function(){
		
		// Nouvelle Nav
		newNav = $(this).children('span').attr('class');
		
		// switch
		changeNav(currentNav, newNav);
		currentNav = $(this).children('span').attr('class');
		
	});
	
	$("#headnav").mouseleave(function(){
		if(currentNav != mainNav)
		{
			changeNav(currentNav, mainNav);
			currentNav = mainNav;
		}
	});
	
	navChanging = false;


}

function changeNav(previousNav, newNav)
{
	if(navChanging == false)
	{
		navChanging = true;
		
		// hiding des sous menu, et affichage de celui qui ets demandé
		if(previousNav != newNav)
		{
			$('#navsubbar p span').hide()
			$('#navsubbar p span#' + newNav).fadeIn('fast');
		}
		navChanging = false;
	}
}

function rateReset()
{
	for(i=1; i<=5; i++)
	{
		var n = i-1;
		if (vidRate <= n + 0.1)
			document.getElementById("star_"+i).className = "off";
		else if (vidRate <= n + 0.5)
			document.getElementById("star_"+i).className = "on_half";
		else
			document.getElementById("star_"+i).className = "on";
	}

}




// SEARCH OPACITY
function makevisible(cur,which)
	{
	if(document.getElementById)
		{
		if (which==0)
			{
			if(document.all)
				cur.filters.alpha.opacity=100
			else
				cur.style.setProperty("-moz-opacity", 1, "");
				cur.style.setProperty("opacity", 1, "");
			}
		else
			{
			if(document.all)
				cur.filters.alpha.opacity=50
			else
				cur.style.setProperty("-moz-opacity", .5, "");
				cur.style.setProperty("opacity", .5, "");
			}
		}
	}


// INDEX OPACITY
function makeINDvisible(cur,which)
{
	if(document.getElementById)
	{
		if (which==0)
		{
			if(document.all)
				cur.filters.alpha.opacity=60
			else
				cur.style.setProperty("-moz-opacity", .6, "");
				cur.style.setProperty("opacity", .6, "");
		} else {
			if(document.all)
				cur.filters.alpha.opacity=30
			else
				cur.style.setProperty("-moz-opacity", .3, "");
				cur.style.setProperty("opacity", .3, "");
		}
	}
}

// HEADER OPACITY
function makeHEADvisible(cur,which)
{
	if(document.getElementById)
	{
		if (which==0)
		{
			if(document.all)
				cur.filters.alpha.opacity=100
			else
				cur.style.setProperty("-moz-opacity", 1, "");
				
		} else {
			if(document.all)
				cur.filters.alpha.opacity=70
			else
				cur.style.setProperty("-moz-opacity", .7, "");
				
		}
	}
}

function showHide($divShow, $divHide)
{
	document.getElementById($divHide).style.display = 'none';
	document.getElementById($divShow).style.display = 'block';
}

function position_adiv()
{
	var messW	= document.getElementById('top-mess').offsetWidth;
	var divW	= document.getElementById('a-div').offsetWidth;
	
	var avg		=  (divW - messW)/2 - 5;
	document.getElementById('top-plus').style.margin	= '0px '+avg+'px 0px 0px';
}


function noelcheck(){
	var chkbox	= $('input#nowel');
	
	if($(chkbox).is(':checked'))
	{
		/*$('input[type=checkbox].categoriz').attr('disabled',  'disabled');
		$('input[type=checkbox].categoriz').attr('checked',  '');*/
		$('div#nowel_code').show();
		
	} else {
		/*$('input[type=checkbox].categoriz').attr('disabled',  '');*/
		$('div#nowel_code').hide();
		
	}
}
