// JavaScript Document
$(document).ready(function(){

	$(".rollOng").hover(
	function() {
	curr = $(this).find("img").attr("src");
	over = curr.replace(/-off\./, '-on.');
	$(this).find("img").attr({ src: over});
	},
	function() {
	$(this).find("img").attr({ src: curr});
	}
	)
	
	$(".rollOng").click(
	function() {
		var occ = curr.substring(15,16);
		curr = $(this).find("img").attr("src");
		$(this).find("img").blur();
		for(i = 0 ; i < 4 ; i++)
		{
			if(occ != i)
			{
				document.getElementById('img'+i).src = 'images/home/ong'+i+'-off.gif';
				document.getElementById('contOng'+i).style.display = 'none';
			}
		}
		document.getElementById('contOng'+occ).style.display = 'block';
	}
	)
	
	$(".rollOng").find("img").each(function(i) {
	temp = this.src;
	pre = temp.replace(/-off\./, '-on.');
	preload_image_object = new Image();
	preload_image_object.src = pre;
	});

}); 

function unfold(cible)
{
	for(var i = 0 ; i < 7 ; i++)
	{
		if(i+1 != cible)
		{
			document.getElementById('rubrique'+(i+1)).style.display = 'none';
		}
		else
		{
			document.getElementById('rubrique'+cible).style.display = 'block';
		}
	}
}

function showHide(cible)
{
	if(document.getElementById(cible).style.display == 'none')
	{
		document.getElementById(cible).style.display = 'block';
	}
	else
	{
		document.getElementById(cible).style.display = 'none';
	}
}
