function getObjById(id)
{
	return document.getElementById(id);
}

function ExecuteObjFun(objPath,fonction,param)
{
	var xhr=null;
	//alert(12);
	if (window.XMLHttpRequest) { 
		xhr = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) 
	{
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}

	if(arguments[3])
		xhr.open("GET", "/common/funObj.exe.php?objPath="+objPath+"&fonction="+fonction+"&param="+param+"&nbParams="+arguments[3], false);
	else
	{
		//alert('here i am'+'\n'+objPath+"\n"+fonction+"\n"+param);
		xhr.open("GET", "/common/funObj.exe.php?objPath="+objPath+"&fonction="+fonction+"&param="+param, false);
	}
	
	xhr.send(null);
	//alert(xhr.responseText);
	return xhr.responseText;
}

function ExecutePageFun(page,fonction,param)
{
	var xhr=null;

	if (window.XMLHttpRequest) { 
		xhr = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) 
	{
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	//xhr.open("GET", "/common/ExecutePageFun.php?page="+page+"&fonction="+fonction+"&param="+param, false);

	if(arguments[3])
		xhr.open("GET", "/common/fun.exe.php?page="+page+"&fonction="+fonction+"&param="+param+"&nbParams="+arguments[3], false);
	else
		xhr.open("GET", "/common/fun.exe.php?page="+page+"&fonction="+fonction+"&param="+param, false);
	
	xhr.send(null);
	//alert(xhr.responseText);
	return xhr.responseText;
}

function _apply()
{
	elt=document.getElementById('option');
	elt.value="save";
	document.cform.submit();
}

function _cancel(mode)
{
	switch(mode)
	{
		case 1:
				window.close();
			break;
			
		case 2:
				history.back();
				return true;
			break;
			
		case 3:
				if(confirm('Etes-vous sūr de vouloir annuler?'))
					history.back();
			break;
	}
}

function _delete()
{
	elt=document.getElementById('option');
	elt.value="delete";
	cform.submit();
}

function redirection(page)
{
	//alert(page+'\n'+window.location);
	window.location.href=page;
}

function reloadParent()
{
	hyperlink=(opener.window.location).toString();
	
	//alert(hyperlink+'\n'+hyperlink.length+'\n'+hyperlink.substring(hyperlink.length-1));/**/
	if(hyperlink.substring(hyperlink.length-1)=='#')
		hyperlink=hyperlink.substring(0,hyperlink.length-1);
	opener.window.location=hyperlink;
}

function openwin(path,param)
{
	if(param=='default')
		param='center=1,scrollbars=1,resizable=1,width=900,height=700';
	
	window.open(path,'',param);
	// window.open('webhome.php', '', 'center=1,scrollbars=0,resizable=1,width=800,height=600' );
}

function showHideTrTd(id)
{
	status=getObjById(id).style.display;
	
	switch(status)
	{
		case 'none':
					status='block';
				break;
		case 'block':
					status='none';
				break;
	}
	getObjById(id).style.display=status;
}

function apercueText(id)
{
	//alert(getObjById(id).value);
	text=ExecutePageFun('common/js/global.php','_Text',getObjById(id).value);
	alert(text);
	getObjById(id+'_apercu').innerHTML=text;
	getObjById(id+'_apercu').style.display="block";
}