function montre(id) 
{	
	var d = document.getElementById('smenu'+id);
	var tot = 0;
	for (var i = 1; i<=10; i++) 
	{	
		if (document.getElementById('smenu'+i)) 
		{
			document.getElementById('smenu'+i).style.display='none';
		}
	}
	if (d) 
	{				
		d.style.left = (id*100)-141+'px';
		d.style.top  = '62px';
		d.style.display='block';
	}
}

function selectTmpMain(d, index) 
{				
	if(d.id.substring(0, 14) != 'menuBarTopSlct')
		d.id='menuBarTopTmpSlct'+index;		
	montre(index);
}

function unSelectTmpMain(d, index) 
{		
	if(d.id.substring(0, 17) == 'menuBarTopTmpSlct')	
		d.id='menuBarTopNotSlct'+index; 		
	montre('');
}

function selectMain(index) 
{			
		if(document.getElementById('menuBarTopTmpSlct'+index))
		{
			for(i=1; i < 9; i++) 
				if(document.getElementById('menuBarTopSlct'+i))
					document.getElementById('menuBarTopSlct'+i).id='menuBarTopNotSlct'+i;
			document.getElementById('menuBarTopTmpSlct'+index).id='menuBarTopSlct'+index;
			document.getElementById('menuSlct').setAttribute('test', index);
		}		
		montre('');
}

function select(source, index)
{
	if(source)
		source.id='select';
	if(document.getElementById('menuBarTopNotSlct'+index))
		document.getElementById('menuBarTopNotSlct'+index).id='menuBarTopTmpSlct'+index;	
}

function unSelect(source, index)
{
	source.id='notselect';	
	if(document.getElementById('menuBarTopTmpSlct'+index))
		document.getElementById('menuBarTopTmpSlct'+index).id = 'menuBarTopNotSlct'+index;	
}

function submitForm(destination, page1, refDiv, parametres)
{ 		
	montre('');
	
	var req = null; 
	
	if (window.XMLHttpRequest)
	{
		req = new XMLHttpRequest();
		if (req.overrideMimeType) 
		{
			req.overrideMimeType('text/xml; charset=UTF-8');
		}
	} 
	else if (window.ActiveXObject) 
	{
		try 
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e)
		{
			try 
			{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
	}
	req.onreadystatechange = 
		function()
		{ 
			if(req.readyState == 4)
			{
				if(req.status == 200)
				{
					try
					{							
						document.getElementById(destination).innerHTML  = req.responseText;	
						if(refDiv)
						  if(refDiv!='')
							refreshDisplay(destination, refDiv);
						window.status = '';		
						document.getElementById('HorizSep1').innerHTML = '';						
					} 
					catch (e)
					{ 
						alert(e);
					}
				}
				else	
				{					
					document.getElementById(destination).innerHTML="Error: returned status code " + req.status + " " + req.statusText;
					document.getElementById(destination).style.height  = '20px';														
				}
			} 
		}; 	
	
	window.status = 'Loading Content...';	
	document.getElementById('HorizSep1').innerHTML = 'Loading Content...';
	if(parametres)
		req.open("GET", "./"+page1+".php?"+parametres+"&"+new Date().getTime() , true); 
	else
		req.open("GET", "./"+page1+".php?"+new Date().getTime() , true); 
	req.send(null); 
} 


function refreshDisplay(destination, refDiv)
{
	if(document.getElementById(refDiv)!=null)
	{
		document.getElementById(destination).style.height  = document.getElementById(refDiv).offsetHeight+"px";
	}
	else
		alert("refreshDisplay: "+refDiv+" does not exist!");
}

