var objWindowImage;

function gfctFrameFocus(txtChamp)
{
	if (txtChamp)
	{	document.getElementById(txtChamp).focus();
		document.getElementById(txtChamp).select();
	}
}

function gfctControlFrame (txtMenuItem,txtPageFrame)
{
	if (top.window.location.href == window.location.href)
	{	if (txtPageFrame == "admin.php")
		{	top.window.location.href = "admin.php"; }
		else
		{	top.window.location.href = "accueil.php" + ((txtPageFrame) ? ("?prmPage=" + txtPageFrame) : "" ); }
	}
	else
	{	if (top.window.location.href.substr(0,25) != window.location.href.substr(0,25))
		{	if (txtPageFrame == "admin.php")
			{	top.window.location.href = "admin.php"; }
			else
			{	top.window.location.href = "accueil.php" + ((txtPageFrame) ? ("?prmPage=" + txtPageFrame) : "" ); }
		}
		else
		{	if (txtMenuItem)
			{	for (i=0; i<parent.document.getElementById("Menu").getElementsByTagName("A").length; i=i+1)
				{	parent.document.getElementById("Menu").getElementsByTagName("A").item(i).className = "clsChoix"; }
				parent.document.getElementById(txtMenuItem).className = "clsChoixActuel";
				return true;
			}
		}
	}
}


function gfctOuvre(txtPage, intLargeur, intHauteur)
{
	objWindowImage = window.open(txtPage,"wndImage","dependent=no,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,scrollbars=yes,toolbar=no,top=50,height="+(intHauteur+40)+",left=50,width="+(intLargeur+30)+",resizable=no");
	objWindowImage.resizeTo(intLargeur + 30 + 20, intHauteur + 40 + 70)
	objWindowImage.focus(); 
}

function gfctQuitte (blnFrameOk,txtMenuItem)
{
	if (blnFrameOk)
	{	parent.document.getElementById(txtMenuItem).className = "clsChoix"; }
	if (objWindowImage)
	{	objWindowImage.close();
		objWindowImage = null;
	}
}	

function gfctFermeFrame (txtCadre)
{
	window.parent.document.getElementById(txtCadre).style.visibility = "hidden"; 
}

function gfctAffAide(txtAide, objLien)
{	document.getElementById(txtAide).style.visibility = "visible";
	if (objLien) { objLien.style.color = "purple"; }
}

function gfctMasqAide(txtAide, objLien)
{
	document.getElementById(txtAide).style.visibility = "hidden";
	if (objLien) { objLien.style.color = "blue"; }
} 

function gfctFormatPrix(sngPrix)
{
	txtPrix = Math.round(sngPrix * 100) + " €";
	if (txtPrix.length < 5) { txtPrix = "00".substr(0, 5 - txtPrix.length) + txtPrix; }
	txtPrix = txtPrix.substr(0, txtPrix.length - 4) + "." + txtPrix.substr(txtPrix.length - 4, 4);
	return txtPrix;
}	
