function showTool(name)
{
	if (name=='search') document.getElementById('searchForm').style.display='block';
	else document.getElementById('searchForm').style.display='none';
	
	if (name=='newsletter') document.getElementById('newsletterForm').style.display='block';
	else document.getElementById('newsletterForm').style.display='none';
	
	if (name=='send') document.getElementById('sendForm').style.display='block';
	else document.getElementById('sendForm').style.display='none';
}

function showPortfolio(id)
{
	document.getElementById('portfolio_'+id+'_a').style.display='none';
	document.getElementById('portfolio_'+id+'_b').style.display='block';
}

function hidePortfolio(id)
{
	document.getElementById('portfolio_'+id+'_b').style.display='none';
	document.getElementById('portfolio_'+id+'_a').style.display='block';
}

function makeGrowPortfolio(elem,startWidth,startHeight,endWidth,endHeight)
{
	elem1 = document.getElementById(elem+'_a');
	elem2 = document.getElementById(elem+'_b');
	pic = document.getElementById(elem+'_i');

	pic.style.width = startWidth+'px';
	pic.style.height = startHeight+'px';

	elem1.style.display='none';
	elem2.style.display='block';
	hideAllIdlePortfolio(elem,startWidth,startHeight);
	growPortfolio(elem2,pic,startWidth,startHeight,endWidth,endHeight);
}

function growPortfolio(elem,pic,startWidth,startHeight,endWidth,endHeight)
{	
	var steps = 15;
	var intervals = 10;
	//var startWidth = pic.style.width;
	//startWidth = parseInt(startWidth.split("px")[0]);
	//var startHeight = elem.style.height;
	//startHeight = parseInt(startHeight.split("px")[0]);
	var addWidth = Math.floor((endWidth-startWidth)/steps);
	var addHeight = Math.floor((endHeight-startHeight)/steps);
		
	if (elem.bgFadeInt) window.clearInterval(elem.bgFadeInt);
	var actStep = 0;
	if(endWidth>startWidth && endHeight>startHeight)
	{
		elem.bgFadeInt = window.setInterval(
			function()
			{			
				//elem.style.width = startWidth+(addWidth*(actStep+1))+'px';
				pic.style.width = startWidth+(addWidth*(actStep+1))+'px';
				elem.style.height = (startHeight+(addHeight*(actStep+1))+19)+'px'; // 19 en plus pour la petite barre à gauche
				pic.style.height = startHeight+(addHeight*(actStep+1))+'px';
				actStep++;
				if (actStep > steps)
				{
					//elem.style.width = endWidth+'px';
					pic.style.width = endWidth+'px';
					elem.style.height = (endHeight+19)+'px'; // 19 en plus pour la petite barre à gauche
					pic.style.height = endHeight+'px';
					window.clearInterval(elem.bgFadeInt);
				}
			}
			,intervals)
	}	
}

function byebyePortfolio(elem,w,h)
{	
	bye_elem1 = document.getElementById(elem+'_a');
	bye_elem2 = document.getElementById(elem+'_b');
	bye_pic = document.getElementById(elem+'_i');
	
	if (bye_elem2!=null && bye_elem2.bgFadeInt) window.clearInterval(bye_elem2.bgFadeInt);
	
	bye_elem2.style.display='none';
	bye_elem1.style.display='block';
	//bye_elem2.style.width = w+'px';
	bye_pic.style.width = w+'px';
	bye_elem2.style.height = h+'px';
	bye_pic.style.height = h+'px';
}

function hideAllIdlePortfolio(elem,w,h)
{
	var list = document.getElementById('subCenter2').getElementsByTagName("div");

	for (var i=0; i<list.length; i++)
	{
		if (list[i].id.substring(0,10)=='portfolio_' && list[i].className=='content')
		{
			if (list[i].id!=elem+'_a') byebyePortfolio(list[i].id.split("_a")[0],w,h);
		}
	}
}	

function menuHover(obj)
{
	//-- for IE6 but not IE7, Moz, Safari, Opera...
	if (typeof document.body.style.maxHeight == "undefined")
	{
		try
		{
			obj.className='menuHover';
		}
		catch(e) { /* unless it's not IE6... */ }
	} // if
}

function menuOut(obj)
{
	//-- for IE6 but not IE7, Moz, Safari, Opera...
	if (typeof document.body.style.maxHeight == "undefined")
	{
		try
		{
			obj.className='';
		}
		catch(e) { /* unless it's not IE6... */ }
	} // if
}
