var BienAffichageState = null;

function BienAffichage(Object, Type)
{
	BienAffichageState = Type;

	if (Type=="agence")
		TypeInverse = "client";
	if (Type=="client")
		TypeInverse = "agence";

	AllElement = document.getElementsByTagName("*");

	for(Loop=0;Loop<AllElement.length;Loop++)
	{
		if (AllElement[Loop].getAttribute("affichage"))
		{
			if (AllElement[Loop].getAttribute("affichage")==Type)
				AllElement[Loop].style.display = "block";
			else
				AllElement[Loop].style.display = "none";
		}
	}

	Object.onclick = function() { BienAffichage(this, TypeInverse) };
	Object.innerHTML = '<img src="images/bien/affichage_'+TypeInverse+'.png" border="0" align="absmiddle"> Affichage '+TypeInverse;
}

function BienDateCopy(Object)
{
	var FieldList = new Array();

	FieldList[0] = "Amiante";
	FieldList[1] = "Saturnisme";
	FieldList[2] = "Termite";
	FieldList[3] = "ÉtatRisqueNaturel";
	FieldList[4] = "PerformanceÉnergétique";
	FieldList[5] = "MétrageCarrez";
	FieldList[6] = "DiagnosticGaz";

	for (var Loop in FieldList)
	{
		if ((GetForm(Object).elements[FieldList[Loop]][0].checked)&&(!GetForm(Object).elements[FieldList[Loop]+"Date"].value))
			GetForm(Object).elements[FieldList[Loop]+"Date"].value = Object.value;
	}
}