function getlyr(elementId)
{
	return((document.getElementById)? document.getElementById(elementId) : document.all(elementId));
}

function showhide(elementId,dp)
{
	var elementObj = getlyr(elementId);
	elementObj.style.display = (dp)? 'block' : 'none';
}

function checkMail(elemobj)
{
	var verif = /^[a-zA-Z0-9\-\_]{1,}[a-zA-Z0-9\.\-\_]*[a-zA-Z0-9\-\_]{1,}@[a-zA-Z0-9]{1,}[a-zA-Z0-9\.\-\_]*[a-zA-Z0-9]{1,}[.][a-zA-Z]{2,4}$/;
	if(verif.test(elemobj.value)) return true;
	else return false;
}

function changeVal(myform,myelement)
{
	if(myelement.value != -1 && TopicId)
	{
		myform.SubTopic.value = subStr[TopicId][myelement.value][0];
		myform.Sujet.value = subStr[TopicId][myelement.value][2];
		myform.text.value = subStr[TopicId][myelement.value][3];
	}
	else
	{
		myform.SubTopic.value = '';
		myform.Sujet.value = '';
		myform.text.value = '';
	}
}

//////////////////////////////////////
var TopicId = null;

function majSel(myform,val)
{
	TopicId = val;
	myform.Topic.value = subStr[val][0];
	myform.text.value = '';

	var targObj = document.getElementById('SubTopicChoice');
	var targElement = myform.SubTopicChoice;

	while(targElement.length>0) targElement.options[0] = null;
	targElement.options[0] = new Option(Choose,"-1",false,false);
	for(var i=2;i<subStr[val].length;i++)
	{
		if(subStr[val][i]) targElement.options[targElement.length] = new Option(subStr[val][i][1],i,false,false);
	}
	targObj.disabled = false;

// Init
	myform.FirstName.value = ' ';
	myform.LastName.value = ' ';
	myform.Pseudo.value = ' ';

// show/hide
	if(subStr[val][0] == 'MEMBRE')
	{
		showhide('memDiv',1);
		showhide('visDiv',0);
		myform.Pseudo.value = '';
	}
	else
	{
		showhide('memDiv',0);
		showhide('visDiv',1);
		myform.FirstName.value = '';
		myform.LastName.value = '';
	}
}

function writeSel()
{
	TopicId = subStr.length-1;
	var sel = '<option value="-1">'+Choose+'</option>';
	for(var i=2;i<subStr[TopicId].length;i++)
	{
		if(subStr[TopicId][i])
		{
			sel += '	<option value="'+i+'">'+subStr[TopicId][i][1]+'</option>';
		}
	}
	document.write(sel);
}