var current = '';
window.onload =	function passTab()
{
	var h3 = document.getElementsByTagName('h3');
	for(i = 0 ; i< h3.length ; i++)
	{
		h3[i].firstChild.onclick = function()
		{
			dropDown(this.parentNode.parentNode.getElementsByTagName('div')[0]);
		}
		
		nextSi(h3[i]).lastChild.onclick = function()
		{
			dropDown(this.parentNode);//.style.display = 'none';
		}

		
	}	
	if(param.issetP('tab'))
	{
		dropDown(nextSi(nextSi(document.getElementById(param.getPVal('tab')))));
	}	
	initGallery();
}

function dropDown(e)
{
	if(e.style.display != 'block')
	{
		if(current != '') current.style.display = 'none';
		e.style.display = 'block';
		current = e;
	}
	else
	{
		e.style.display = 'none';
	}
	return false;
}

function nextSi(n)
{
	var x=n.nextSibling;
	while (x.nodeType!=1)
	{
	  x=x.nextSibling;
	}
	return x;
}

/**
 * funtion urlParam
 * @comment get parameters from url. Parameter must be passed after "?" and with a "&" between each
 * @author Benoit Gilloz www.ai-development.com
 * @since 08/08/2007
**/
var param = new urlParam();

function urlParam()
{
	var listParam, nbParam;
	var paramTable = new Array();
	
	paramList();
	
	function paramList()
	{
		var url = window.location.href;
		var anchor = url.split('#');
		var arrayUrl = anchor[0].split('?');
		if(arrayUrl.length >1) listParam = arrayUrl[1].split('&');
		else return;
		nbParam = listParam.length;
		
		for(i=0 ; i<nbParam ; i++)
		{
			var fullParam = listParam[i].split('=');
			paramTable[i] = new Array();
			paramTable[i]['name'] = fullParam[0];
			paramTable[i]['value'] = fullParam[1];
		}
	}
	
	//return a param value from a given name
	this.getPVal = function getParamValue(name)
	{
		for(i=0 ; i<nbParam ; i++)
		{
			if(paramTable[i]['name'] == name)
			{
				return paramTable[i]['value'];
			}
		}
	}
	
	//return true if the param(name) is set and != '' else return false
	this.issetP = function issetP(name)
	{
		for(i=0 ; i<nbParam ; i++)
		{
			if(paramTable[i]['name'] == name && paramTable[i]['value']!= '')
			{
				return true;
			}
			else return false;
		}
	}
	
}