function go(form) {
	if (form.orga.value=="" || form.nom.value=="" || form.adre.value=="" || form.ville.value=="" 
		|| form.tel.value=="" || form.email.value=="" || form.prov.value=="" || form.pays.value=="" 
		|| form.code.value=="" || !(form.choix[0].checked || form.choix[1].checked || form.choix[2].checked || form.choix[3].checked))
	{
		alert("Information manquante : Veuillez remplir tous les champs obligatoires indiqués par un astérisque.");
	}
	else {
		form.submit();
	}
}

function acceptAvertissement() {
	if (document.getElementById('acceptAvertissement').checked) {
		window.open("https://bibliocdnq.notarius.com/inforoute/rechercheDecisions.asp");
	}
	else {
		alert("Veuillez cocher \"J'ai pris connaissance du présent avertissement\" avant d'accéder aux décisions disciplinaires.");
	}
}

function notFields() {
	document.getElementById('sexe').style.display = 'none';
	document.getElementById('sexeFeminin').checked = false;
	document.getElementById('sexeMasculin').checked = false;
	document.getElementById('code').style.display = 'block';
	document.getElementById('address').style.display = 'none';
	document.getElementById('adresseDem').value = '';
	document.getElementById('city').style.display = 'none';
	document.getElementById('villeDem').value = '';
	document.getElementById('state').style.display = 'none';
	document.getElementById('provDem').value = '';
	document.getElementById('country').style.display = 'none';
	document.getElementById('paysDem').value = '';
	document.getElementById('zip').style.display = 'none';
	document.getElementById('codePostal').value = '';
	document.getElementById('phone').style.display = 'none';
	document.getElementById('telMaison').value = '';
	document.getElementById('telBureau').value = '';
	document.getElementById('telCell').value = '';
	document.getElementById('coDemandeurs').style.display = 'none';
	commonFields();
}

function publicFields() {
	document.getElementById('sexe').style.display = 'block';
	document.getElementById('lastName').style.display = 'block';
	document.getElementById('firstName').style.display = 'block';
	document.getElementById('address').style.display = 'block';
	document.getElementById('city').style.display = 'block';
	document.getElementById('state').style.display = 'block';
	document.getElementById('country').style.display = 'block';
	document.getElementById('zip').style.display = 'block';
	document.getElementById('phone').style.display = 'block';
	document.getElementById('code').style.display = 'none';
	document.getElementById('codeNot').value = '';
	document.getElementById('coDemandeurs').style.display = 'block';
	commonFields();
}

function commonFields() {
	document.getElementById('lastName').style.display = 'block';
	document.getElementById('firstName').style.display = 'block';
	document.getElementById('email').style.display = 'block';
	document.getElementById('notaireVise').style.display = 'block';
	document.getElementById('descEvenement').style.display = 'block';
	document.getElementById('documents').style.display = 'block';
	document.getElementById('historique').style.display = 'block';
	document.getElementById('confirmation').style.display = 'block';
	document.getElementById('soumission').style.display = 'block';
	document.getElementById('attentes').style.display = 'block';
}

window.onload = function() {
	if (document.getElementById('formDemande')) {
		if (document.getElementById('typePublic').checked) {
			publicFields();
		}
		else if (document.getElementById('typeNotaire').checked) {
			notFields();
		}
		else {
			document.getElementById('sexe').style.display = 'none';
			document.getElementById('lastName').style.display = 'none';
			document.getElementById('firstName').style.display = 'none';
			document.getElementById('code').style.display = 'none';
			document.getElementById('address').style.display = 'none';
			document.getElementById('city').style.display = 'none';
			document.getElementById('state').style.display = 'none';
			document.getElementById('country').style.display = 'none';
			document.getElementById('zip').style.display = 'none';
			document.getElementById('phone').style.display = 'none';
			document.getElementById('email').style.display = 'none';
			document.getElementById('coDemandeurs').style.display = 'none';
			document.getElementById('attentes').style.display = 'none';
			document.getElementById('notaireVise').style.display = 'none';
			document.getElementById('descEvenement').style.display = 'none';
			document.getElementById('documents').style.display = 'none';
			document.getElementById('historique').style.display = 'none';
			document.getElementById('confirmation').style.display = 'none';
			document.getElementById('soumission').style.display = 'none';
		}

		document.getElementById('formDemande').style.display = 'block';
	}
}

startList = function() {
	if (document.all && document.getElementById) {
		// siteNav
		navRoot = document.getElementById("siteNav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				node.onmouseover = function() { this.className+=" over"; }
				node.onmouseout=function() { this.className=this.className.replace(" over", ""); }
				node.onclick=function() { this.className=this.className.replace(" over", ""); }
			}
		}
	}
		// liens externes
		allA = document.getElementsByTagName("a");
		for(j=0; j<allA.length; j++) {
			if (allA[j].className == "externe") {
				allA[j].onclick=function() {
					window.open(this.href);
					return false;
				}
			}
		}
}

//------------------- La section des video ! 
function Video(titre,mois,jour,nom) {
	this.titre	= titre;
	this.mois	= mois;
	this.jour	= jour;
	this.nom	= nom;
}

/* afficher le lendemain.
TVArriveeEnfant120 			= new Video("Arriv&eacute;e d\'un nouvel enfant (b&eacute;b&eacute)",1,7,"cLPHO0-1MOw");
TVBilanPatrimonial120 		= new Video("Bilan patrimonial",1,14,"g7EIWjq_Xkc");
TVConjointFait120		 	= new Video("La rupture \/ conjoint de fait",1,3,"17ZzEl_3ts0");
TVReglementSuccession120 	= new Video("R&egrave;glement d\'une succession",2,7,"WCLnOSXvex4");
TVLectureTestament120		= new Video("Lecture du testament",2,14,"Erz0MB1j5gM");
TVAffaireReleve120 			= new Video("Affaires \/ rel&egrave;ve",2,21,"5dFqZMAbJ6E");
TVProtectionActifs120 		= new Video("Protection des actifs",2,28,"sxLZANwhFIA");
TVMaladieRentier120 		= new Video("Maladie \/ mandat",3,4,"z2Wkh28I1pM");
TVTestamentFiduciaire120 	= new Video("Testament fiduciaire",3,11,"QQSr9dO44fY");
TVMariageCivil30 			= new Video("La c&eacute;l&eacute;bration du mariage",3,12,"GHehNXS8lnY");
arrayVideos = Array(TVTestamentFiduciaire120,TVMaladieRentier120,TVProtectionActifs120,TVAffaireReleve120,TVLectureTestament120,TVReglementSuccession120,TVConjointFait120,TVBilanPatrimonial120,TVArriveeEnfant120,TVMariageCivil30);
*/

TVLegareDeschamps 			= new Video("De L&eacute;gar&eacute; &agrave; ...Deschamps !",9,6,"TVLegareDeschamps");
TVMultiServices 			= new Video("Multi-services",10,11,"TVMultiServices");
TVUnionLibreDeschamps	 	= new Video("L'union libre",11,7,"TVUnionLibreDeschamps");
TVJoyeusesFetes				= new Video("Joyeuses f&ecirc;tes",1,15,"TVJoyeusesFetes");
TVImmobilierDeschamps		= new Video("Immobilier",2,6,"TVImmobilierDeschamps");
arrayVideos = Array(TVLegareDeschamps,TVMultiServices,TVUnionLibreDeschamps,TVJoyeusesFetes,TVImmobilierDeschamps);

function populerListeVideo(mois,jour) {
	var text = "<ul>";
	for(var i=0;i<arrayVideos.length;i++) {
		text += "<li><a href='#' onclick=\"changeVideo(\'"+i+"\');\")>" + arrayVideos[i].titre + "</a></li>";
		//alert(arrayVideos[i].mois);
		//alert(mois);
		/*
		if(arrayVideos[i].mois == mois )
		{
			
			if(arrayVideos[i].jour > jour)
			{
				
			}
			else
			{
				text += "<li><a href='#' onclick=\"changeVideo(\'"+i+"\');\")>" + arrayVideos[i].titre + "</a></li>";
			}
		}
		else if(arrayVideos[i].mois <= mois )
		{
			text += "<li><a href='#' onclick=\"changeVideo(\'"+i+"\');\")>" + arrayVideos[i].titre + "</a></li>";
		}
		*/
	}
	text += "</ul>";
	document.getElementById("listeVideo").innerHTML = text;
}

function detecterVideoPresent() {
	var id =0;
	for(var i=arrayVideos.length-1;i>-1;i--){
		var dt = new Date();
		var mois = dt.getMonth();
		var jour = dt.getDate();
		if(arrayVideos[i].mois == mois ){
			if(arrayVideos[i].jour <= jour){
				id=i;
			}
		}
		else if(arrayVideos[i].mois < mois ){
			id=i;
		}
	}
	var temp="";
	temp += "<h3>"+arrayVideos[id].titre+"</h3>"
	temp +=" <object id=\"mediaPlayer\" classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'standby='Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\">";
	temp +=" <param name=\"fileName\" value=\"/media/messagesTV/"+ arrayVideos[id].nom +".wmv\" />";
	temp +=" <param name=\"animationatStart\" value=\"true\" />";
	temp +=" <param name=\"transparentatStart\" value='true' />";
	temp +=" <param name=\"autoStart\" value=\"false\" />";
	temp +="<param name=\"autoSize\" value=\"false\" />";
	temp +=" <param name=\"ShowAudioControls\" value=\"true\" />";
	temp +=" <param name=\"showControls\" value=\"true\" />";
	temp +=" <param name=\"ShowStatusBar\" value=\"false\" />";
	temp +=" <param name=\"width\" value=\"320\" />";
	temp +=" <param name=\"height\" value=\"240\" />";
	temp +=" <param name=\"loop\" value=\"false\" />";
	temp +=" <embed type=\"application/x-mplayer2\" pluginspage=\"http://microsoft.com/windows/mediaplayer/en/download/\" id=\"mediaPlayer\" displaysize=\"4\" autosize=\"0\" bgcolor=\"gray\" showcontrols=\"true\" showtracker=\"1\" showdisplay=\"1\" showstatusbar=\"0\" videoborder3d=\"1\" showaudiocontrols=\"1\" src=\"/media/messagesTV/"+ arrayVideos[id].nom +".wmv\" autostart=\"0\" designtimesp=\"5311\" loop=\"0\">";
	temp +="  </embed>";
	temp +="  </object>";
	document.getElementById("videoEnCours").innerHTML = temp;
}

function changeVideo(id) {
	//alert(nom);
	var temp="";
	temp += "<h3>"+arrayVideos[id].titre+"</h3>"
	temp +=" <object id=\"mediaPlayer\" classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'standby='Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\">";
	temp +=" <param name=\"fileName\" value=\"/media/messagesTV/"+ arrayVideos[id].nom +".wmv\" />";
	temp +=" <param name=\"animationatStart\" value=\"true\" />";
	temp +=" <param name=\"transparentatStart\" value='true' />";
	temp +=" <param name=\"autoStart\" value=\"true\" />";
	temp +="<param name=\"autoSize\" value=\"false\" />";
	temp +=" <param name=\"ShowAudioControls\" value=\"true\" />";
	temp +=" <param name=\"showControls\" value=\"true\" />";
	temp +=" <param name=\"ShowStatusBar\" value=\"false\" />";
	temp +=" <param name=\"width\" value=\"320\" />";
	temp +=" <param name=\"height\" value=\"240\" />";
	temp +=" <param name=\"loop\" value=\"false\" />";
	temp +=" <embed type=\"application/x-mplayer2\" pluginspage=\"http://microsoft.com/windows/mediaplayer/en/download/\" id=\"mediaPlayer\" displaysize=\"4\" autosize=\"0\" bgcolor=\"gray\" showcontrols=\"true\" showtracker=\"1\" showdisplay=\"1\" showstatusbar=\"0\" videoborder3d=\"1\" showaudiocontrols=\"1\" src=\"/media/messagesTV/"+ arrayVideos[id].nom +".wmv\" autostart=\"1\" designtimesp=\"5311\" loop=\"0\">";
	temp +="  </embed>";
	temp +="  </object>";
	document.getElementById("videoEnCours").innerHTML = temp;
}

function startWMV(id) {
	var temp="";
	temp +=" <object id=\"mediaPlayer\" classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'standby='Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\">";
	temp +=" <param name=\"fileName\" value=\"/media/messagesTV/"+ id +".wmv\" />";
	temp +=" <param name=\"animationatStart\" value=\"true\" />";
	temp +=" <param name=\"transparentatStart\" value='true' />";
	temp +=" <param name=\"autoStart\" value=\"true\" />";
	temp +="<param name=\"autoSize\" value=\"false\" />";
	temp +=" <param name=\"ShowAudioControls\" value=\"true\" />";
	temp +=" <param name=\"showControls\" value=\"true\" />";
	temp +=" <param name=\"ShowStatusBar\" value=\"false\" />";
	temp +=" <param name=\"width\" value=\"320\" />";
	temp +=" <param name=\"height\" value=\"240\" />";
	temp +=" <param name=\"loop\" value=\"false\" />";
	temp +=" <embed type=\"application/x-mplayer2\" pluginspage=\"http://microsoft.com/windows/mediaplayer/en/download/\" id=\"mediaPlayer\" displaysize=\"4\" autosize=\"0\" bgcolor=\"gray\" showcontrols=\"true\" showtracker=\"1\" showdisplay=\"1\" showstatusbar=\"0\" videoborder3d=\"1\" showaudiocontrols=\"1\" src=\"/media/messagesTV/"+ id +".wmv\" autostart=\"1\" designtimesp=\"5311\" loop=\"0\">";
	temp +="  </embed>";
	temp +="  </object>";
	document.getElementById(id).innerHTML = temp;
}

function schedule(objectID, functionCall) {
	if (document.getElementById(objectID)) {
		eval(functionCall);
	}
	else {
		setTimeout("schedule('" + objectID + "', '" + functionCall + "')", 1);
	}
	return true;
}

var dt = new Date();
schedule("siteNav", "startList()");
schedule("listeVideo", "populerListeVideo(dt.getMonth(),dt.getDate())");
//schedule("videoEnCours", "detecterVideoPresent()");
schedule("TVDonOrgane30", "startWMV(\"TVDonOrgane30\")");
