// library.js
// mfb v1.0.0

function affGrp(divId) {
	
}
var HIGHLIGHT_STYLE = 'bold';

function checkExist(id) {
        if ((id == '' ) || (!id) || (!document.getElementById(id) )) {
		//alert(id + " KO :-(( ");
		return false;
	}
	//alert(id + " OK :-)) ");
        return true;
}    

function affDiv(divId) {
	if (!checkExist(divId)) return;
	if (document.getElementById(divId).style.display == 'none') {
		document.getElementById(divId).style.display = 'block';
        } else {
		document.getElementById(divId).style.display = 'none';
	}
}

function affGrp(divId,testId) {
	if (!checkExist(divId)) return;
	if (!checkExist(testId)) return;
	if (document.getElementById(divId).style.display == 'none') {
		if (document.getElementById(testId).style.display == 'block') {
			document.getElementById(testId).style.display = 'none';
		}
		document.getElementById(divId).style.display = 'block';
        } else {
		document.getElementById(divId).style.display = 'none';
	}
}  

function affPerf(divId,testId) {
	if (!checkExist(divId)) return;
	if (!checkExist(testId)) return;
	if (!checkExist(testId+'_body')) return;
	document.getElementById(testId).style.display = 'none';
	document.getElementById(testId+'_body').style.display = 'none';
	document.getElementById(divId).style.display = 'block';
	document.getElementById(divId+'_body').style.display = 'block';
}
 
function h(divId) {
        if (!checkExist(divId)) return;    
	if (document.getElementById(divId).style.display == 'none') {
		document.getElementById(divId).style.display = 'block';
            	document.getElementById(divId+'_img').src  = './img/c/puce1on.jpg';             
	} else {
		document.getElementById(divId).style.display = 'none';
            	document.getElementById(divId+'_img').src  = './img/c/puce1.jpg';
	}
}

function onLeaf(id) {
        if (!checkExist(id)) return;    
        //document.getElementById(id).style.backgroundColor = HIGHLIGHT_BG;
        //document.getElementById(id).style.color = HIGHLIGHT_COLOR;
        document.getElementById(id).style.fontWeight = HIGHLIGHT_STYLE;
}

function clickMenu(id) {
        if (!checkExist(id)) return;    
        onLeaf(id);
        document.location.href=id+'.php';
}

function checkInscriptions_en() 
{
if(document["theForm"].elements['nom'].value.length == 0) {
alert("Please enter your first name");
return ;
}
if(document["theForm"].elements['prenom'].value.length == 0) {
alert("Please enter your surname");
return ;
}
if(document["theForm"].elements['email'].value.length == 0) {
alert("Please enter your email");
return ;
}
if(document["theForm"].elements['chronicleReg'] && document["theForm"].elements['chronicleReg'].checked == true) {
// timestamp
aDate = new Date();
document["theForm"].elements['thedate'].value= aDate;

document["theForm"].elements['paiement'].value = "true";

if(document["theForm"].elements['adresse'].value.length == 0) {
alert("Please enter your address");
return ;
}
if(document["theForm"].elements['codepostal'].value.length == 0) {
alert("Please enter your Postcode");
return ;
}
if(document["theForm"].elements['entreprise'].value.length == 0) {
alert("Please enter your Company");
return ;
}
if(document["theForm"].elements['ville'].value.length == 0) {
alert("Please enter your Town");
return ;
}
if(document["theForm"].elements['pays'].value.length == 0) {
alert("Please enter your Country");
return ;
}

if (!confirm("About to be redirected to secure server, would you like to continue ?")) {
return;
}
}
else {
//document["theForm"].elements['paiement'].value = "false";

if(document["theForm"].elements['message'].value.length == 0) {
	alert("Please enter your message");
	return;
}
}
//alert("check OK");
document.theForm.submit();

if(checkExist('res')) {
	document.getElementById('res').style.display="block";
}
}

function checkInscriptions_fr() 
{
if(document["theForm"].elements['nom'].value.length == 0) {
alert("Merci de renseigner votre nom");
return ;
}
if(document["theForm"].elements['prenom'].value.length == 0) {
alert("Merci de renseigner votre prénom");
return ;
}
if(document["theForm"].elements['email'].value.length == 0) {
alert("Merci de renseigner votre email");
return ;
}
if(document["theForm"].elements['chronicleReg'] && document["theForm"].elements['chronicleReg'].checked == true) {
// timestamp
aDate = new Date();
document["theForm"].elements['thedate'].value= aDate;
document["theForm"].elements['paiement'].value = "true";

if(document["theForm"].elements['adresse'].value.length == 0) {
alert("Merci de renseigner votre adresse");
return ;
}
if(document["theForm"].elements['codepostal'].value.length == 0) {
alert("Merci de renseigner votre code postal");
return ;
}
if(document["theForm"].elements['entreprise'].value.length == 0) {
alert("Merci de renseigner votre société");
return ;
}
if(document["theForm"].elements['ville'].value.length == 0) {
alert("Merci de renseigner votre ville");
return ;
}
if(document["theForm"].elements['pays'].value.length == 0) {
alert("Merci de renseigner votre pays");
return ;
}

if(!confirm("Vous allez être redirigé vers le serveur de paiement sécurisé, voulez-vous continuer ?")) {
return;
}
}
else {
//document["theForm"].elements['paiement'].value = "false";

if(document["theForm"].elements['message'].value.length == 0) {
	alert("Merci de renseigner votre message");
	return ;
}
}
//alert("check OK");
document.theForm.submit();

if(checkExist('res')) {
	document.getElementById('res').style.display="block";
}
}



function addBookmark()
{
	window.external.AddFavorite('http://www.mfbiarnais-conseil.com','MFBiarnais Conseil');
}

