function hideDiv(id)
{
	if(!document.getElementById(id))
		return;
		
	document.getElementById(id).style.display = "none";
}
function showDiv(id)
{
	if(!document.getElementById(id))
		return;
		
	document.getElementById(id).style.display = "block";
}
function playContent(environment, content_id){
	var dns_name = window.location.hostname;
	var link = '';
	
	if(environment == 'dev')
		link = '/frontend_dev.php';
	
	new Ajax.Updater(
		'video_contaier', 
		link+'/content/show/ContentId/'+content_id+'/update/center_container', 
		{
			asynchronous:true, 
			evalScripts:true
		}); 
		
	return false;
}
function openLogin(){
	var txt = '<div id="login_form_update">'
	txt = txt+document.getElementById('login_hidden_form').innerHTML;
	txt = txt+'</div>';
	
	jQuery.prompt(txt,{
	      buttons: { 'Fermer X': 'fermer' }, prefix: 'black_'
	});
}
function openTellAFriend(){
	var txt = '<div id="tell_a_friend_update">'
	txt = txt+document.getElementById('mail_send_hidden').innerHTML;
	txt = txt+'</div>';
	
	jQuery.prompt(txt,{
	      buttons: { 'Fermer X': 'fermer' }, prefix: 'black_'
	});
}
function openEmbedCode(){
	var txt = '<div id="embed_code_update">'
	txt = txt+document.getElementById('embed_hidden').innerHTML;
	txt = txt+'</div>';
	
	jQuery.prompt(txt,{
	      buttons: { 'Fermer X': 'fermer' }, prefix: 'black_'
	});
}
function openMore(){
	var txt = '<div id="more_update">'
	txt = txt+document.getElementById('more_hidden').innerHTML;
	txt = txt+'</div>';
	
	jQuery.prompt(txt,{
	      buttons: { Fermer: 'fermer' }
	});
}

function openHelpMail(){
	var txt = '<div id="help_mail_update">'
	txt = txt+document.getElementById('mail_help_hidden').innerHTML;
	txt = txt+'</div>';
	
	jQuery.prompt(txt,{
	      buttons: { 'Fermer X': 'fermer' }, prefix: 'black_'
	});
}
var liked = false;
var disliked = false;

function likeVideo(content_id){

	if(liked) return false;

	new Ajax.Updater('likeing_update', '/rating/like/ContentId/'+content_id+'/update/likeing_update', {asynchronous:true, evalScripts:true}); 
	
	liked = true;
	disliked = false;
}

function dislikeVideo(content_id){
	if(disliked) return false;

	new Ajax.Updater('likeing_update', '/rating/dislike/ContentId/'+content_id+'/update/likeing_update', {asynchronous:true, evalScripts:true}); 
	
	disliked = true;
	liked = false;
}

function closeLikeing(){
	document.getElementById("likeing_update").innerHTML = "";
	disliked = false;
	liked = false;
}

function openForgot(){
	new Ajax.Updater('login_form_update', '/frontend_user/recover/update/login_form_update', {method:'get', asynchronous:true, evalScripts:true}); 
}
