function change_freq()
{
	if (test0()==1) return;
	if (document.form.status.value == "1")
	{
		document.form.method = "POST";
		document.form.action = "transformateur";
		document.form.nl.value = "<?php echo $nl;?>";
		document.form.status.value = "1";
		document.form.submit();
	}
}
function change_perte()
{
	document.getElementById('id_perte').style.display = "none";
	if (document.form.chk_perte[3].checked)
			document.getElementById('id_perte').style.display =  "";
	else
			document.getElementById('id_perte').style.display = "none";
	if (test0()==1) return;
	if (document.form.status.value == "1")
	{
		document.form.method = "POST";
		document.form.action = "transformateur";
		document.form.status.value = "1";
		document.form.nl.value = "<?php echo $nl;?>";
		document.form.submit();
	}
}
function RAZ()
{
	document.form.V1.value = "";
	document.form.V2.value = "";
	document.form.V3.value = "";
	document.form.V4.value = "";
	document.form.V5.value = "";
	document.form.V6.value = "";
	
	document.form.I1.value = "";
	document.form.I2.value = "";
	document.form.I3.value = "";
	document.form.I4.value = "";
	document.form.I5.value = "";
	document.form.I6.value = "";
	
	document.form.VP.value = "235";
	
	document.form.chk_freq[0].checked = true; 
	document.form.chk_bmax[1].checked = true; 
	document.form.chk_jmax[1].checked = true; 
	document.form.chk_perte[1].checked = true; 
	
	document.getElementById('id_perte').style.display =  "none";
	document.getElementById('id_bmax').style.display =  "none";
	document.form.nl.value = "6";
	document.form.status.value ="0";
}
function precalcul() {  
	if (test0()==1) return;
	document.form.method = "POST";
	document.form.action = "transformateur?#entrerUI";
	document.form.status.value = "1";
	document.form.nl.value = "<?php echo $nl;?>";
	document.form.submit();
}

function construction() {  
	if (test0()==1) return;
	document.form.method = "POST";
	document.form.action = "transformateur2";
	document.form.status.value = "1";
	document.form.ns.value = "<?php echo $ns;?>";
	document.form.submit();
}

function test0()
{
	if (document.form.chk_bmax[3].checked)
	{
		//document.form.bmax.value=document.form.bmax_libre.value;
		if ((document.form.bmax_libre.value=="") || (document.form.bmax_libre.value=="0"))
		{
			alert("Vous avez choisi la saisie libre de l'inductance maximale. Cette valeur doit être numérique et non nulle");
			return 1;
		}
	} 
	if (document.form.chk_perte[3].checked)
	{
		//document.form.perte.value=document.form.perte_libre.value;
		if ((document.form.perte_libre.value=="") || (document.form.perte_libre.value=="0"))
		{
			alert("Vous avez choisi la saisie libre du rendement ... Cette valeur doit être numérique et non nulle");
			return 1;
		}
	}
return 0 ;
}

function change_bmax()
{
	document.getElementById('id_bmax').style.display = "none";
	if (document.form.chk_bmax[3].checked)
		document.getElementById('id_bmax').style.display =  "";
	else
		document.getElementById('id_bmax').style.display = "none";
	if (document.form.status.value == "1")
	{
		document.form.method = "POST";
		document.form.action = "transformateur";
		document.form.status.value = "1";
	     document.form.nl.value = "<?php echo $nl;?>";
		document.form.submit();
	}
}

function ajoute6l()
{
	document.form.nl.value =  parseInt(document.form.nl.value)+6;
	document.form.method = "POST";
	document.form.action = "transformateur?#entrerUI";
	document.form.status.value = "1";
	document.form.submit();
}
