function envoi(id,num)
{
	if (num==1) {
		document.getElementById(id).style.cursor = 'wait';
		document.getElementById(id).style.backgroundImage='none';
		//document.getElementById(id).disabled = 'disabled';
	} else {
		document.getElementById(id).style.cursor = 'wait';
		document.getElementById(id).disabled = 'disabled';
		document.getElementById(id).src = 'kmed/images/btn_valider2.gif';
	}
}

function submitdosage()
{
	if (document.form_moteur.forme) document.form_moteur.forme.options[0].selected=true;
	document.form_moteur.submit();
}

function submitformes()
{
	//document.write(document.form_moteur.forme.selectedIndex);
	//if (document.form_moteur.forme.selectedIndex=='0') document.getElementById('ok').style.display='none';
	document.getElementById('ok').style.display='none';
	if (document.form_moteur.forme.selectedIndex>0) document.getElementById('ok').style.display='block';

	//document.getElementById('resultatgroupe').style.display='none';

//	document.getElementById('ok').style.display='block';
	//document.getElementById('phrases').style.display='none';
}
function submitformes2()
{
	//document.write(document.form_moteur.forme.selectedIndex);
	//if (document.form_moteur.forme.selectedIndex=='0') document.getElementById('ok').style.display='none';
	document.getElementById('ok').style.display='none';
	if (document.form_moteur.forme.selectedIndex>0) document.getElementById('ok').style.display='block';

}

function submitdci()
{
	//if (document.form_dcis.forme) document.form_moteur.forme.options[0].selected=true;
	document.form_dcis.submit();
}

function affiche_excipient(id)
{
	for (i=1; i<50; i++) {
		if (document.getElementById('ex'+i)) document.getElementById('ex'+i).style.display='none';
	}
	document.getElementById('ex'+id).style.display='block';
	if(document.all){
		var h=parseInt(document.body.offsetHeight);
		var t=parseInt(document.body.innerHeight);
		t=200;
	}else{
		var h=parseInt(window.outerHeight);
		var t=parseInt(window.innerHeight);
		t=200;
	}
	document.getElementById('overlay').style.display='block';
	document.getElementById('overlay').style.height=h;
	document.getElementById('ex'+id).style.top=t;
	var tmp = document.getElementById('overlay').style.zIndex+' - '+document.getElementById('ex'+id).style.zIndex;
	return false;
}
function reaffiche(){
		var zoom=document.getElementById('overlay');
		if(document.all){
				zoom.style.height =  document.body.offsetHeight+document.body.scrollTop;
		}else{
			zoom.style.height=parseInt(document.body.clientHeight)+parseInt(window.pageYOffset)+"px";
	}
	return false;
}

if (document.getElementById('overlay')) var ecouteur=window.setInterval("reaffiche()",100);

function ferme_excipient(id)
{
	document.getElementById('ex'+id).style.display='none';
	document.getElementById('overlay').style.display='none';
}
var opendet = 0;
function openaide(id){
	if (opendet==0) {
		document.getElementById('aide_closed'+id).style.display='block';
	} else {
		document.getElementById('aide_open'+id).style.display='block';
	}


}

function closeaide(id)
{
	if (opendet==0) {
		document.getElementById('aide_closed'+id).style.display='none';
	} else {
		document.getElementById('aide_open'+id).style.display='none';
	}
	document.getElementById('aide_closed'+id).style.display='none';

}

function opendetail(id)
{
	if (opendet==0) {
		opendet =1;
		document.getElementById('aide_closed'+id).style.display='none';
		document.getElementById('aide_open'+id).style.display='block';
	}

}

function cacheresultat(nbresultat)
{
	document.getElementById('resultat').style.display='none';
	document.getElementById('onglet2').style.display='none';
	document.getElementById('onglet3').style.display='block';
	if(nbresultat>1){
		for(i=1; i<=nbresultat; i++) {
			cachedetail(i);
		}
	}
}

function montreresultat()
{
	document.getElementById('resultat').style.display='block';
	document.getElementById('resultatgroupe').style.display='none';
	document.getElementById('onglet3').style.display='none';
	document.getElementById('onglet2').style.display='block';
	opendet =0;

}

function cachedetail(num)
{
	document.getElementById('mentions'+num).style.display='none';
	document.getElementById('specialites'+num).style.display='none';
	document.getElementById('detail'+num).style.display='none';
	document.getElementById('bas'+num).style.display='none';
	document.getElementById('effet'+num).style.display='none';
	document.getElementById('detail2'+num).style.display='';
}

function montredetail(num)
{
	document.getElementById('mentions'+num).style.display='';
	document.getElementById('specialites'+num).style.display='';
	document.getElementById('detail'+num).style.display='';
	document.getElementById('bas'+num).style.display='';
	document.getElementById('effet'+num).style.display='';
	document.getElementById('detail2'+num).style.display='none';
}

function imprimer(num)
{
	for (i=1; i<10; i++) {
		if (document.getElementById('resultattb'+i)) document.getElementById('resultattb'+i).style.display='none';
	}

	document.getElementById('resultattb'+num).style.display='';

	document.getElementById('mentions'+num).style.display='';
	document.getElementById('specialites'+num).style.display='';
	document.getElementById('detail'+num).style.display='';
	document.getElementById('bas'+num).style.display='';
	document.getElementById('effet'+num).style.display='';
	document.getElementById('detail2'+num).style.display='none';

	window.print();

	timer=setInterval("horloge(" + num + ")", 2000);

}

function horloge(num)
{

		for (i=1; i<10; i++) {
			if (document.getElementById('resultattb'+i)) document.getElementById('resultattb'+i).style.display='';
		}

		document.getElementById('mentions'+num).style.display='none';
		document.getElementById('specialites'+num).style.display='none';
		document.getElementById('detail'+num).style.display='none';
		document.getElementById('bas'+num).style.display='none';
		document.getElementById('effet'+num).style.display='none';
		document.getElementById('detail2'+num).style.display='';

		clearInterval(timer);
}