function rollOver(which)
{ 
	which.src = which.src.replace("_of","_ov"); 
}

function rollOut(which)
{ 
	which.src = which.src.replace("_ov","_of"); 
}

function showhide(which)
{
	var etat = verifEtat(which);
	//hideAll();
	if (document.getElementById('commentid_' + which).style.display == "block")
	{
		document.getElementById('commentid_' + which).style.display = "none";
	}
	else
	{
		document.getElementById('commentid_' + which).style.display = etat;
		goComments(which);
	}
}

function hideAll()
{
	var collection = $('.commentBlock');
	for(x = 1; x <= collection.length -1;x++)
	{
		collection[x].style.display = "none";
	}
}

// Retourne si le post selectionner a les commentaire affichés ou pas
function verifEtat(which)
{
	if(document.getElementById('commentid_' + which).style.display == 'block')
	{	return 'none';	}
	else
	{	return 'block';	}
}

function goComments(which)
{
	document.location.href = '#commentid_'+which;
	return false;
}


function shareIt()
{
	$('#share').slideDown(466);
}
function shareNot()
{
	$('#share').hide();
}

function validation()
{
	$('.errors').hide();
	var nom = $('#author').val();
	var email = $('#email').val();
	var comment = $('#comment').val();
	/*var website = $('#url').val();*/
	var valid = true;
	
	// Advanced
	var rule = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+)\.+([a-zA-Z0-9]{2,4})+$/;	
	
	if(nom == 'Votre nom' ||  nom == '')
	{
		$('#errNom').show();
		valid = false;
	}
	if(email == '' || email == 'Votre courriel')
	{
		$('#errEmail').show();
		valid = false;
	}
	if(!rule.test(email))
	{
		$('#errEmail').hide();
		$('#errEmailFormat').show();
		valid = false;
	}
	/*if(website == '')
	{
		$('#errWebsite').show();
		valid = false;
	}*/
	if(comment == '' || comment == 'Votre commentaire')
	{
		valid = false;
		$('#errComments').show();
		
	}
	if(valid)
	{
		document.commentform.submit();
	}
	return false;	
}