



function checkEmailForm(theForm) {
        var msgWarningEmail = "____________________________________________________\n\n";
        msgWarningEmail += "Sujet : "+theForm.subject.value+"\n\n";
        msgWarningEmail += "Message :\n "+theForm.message.value+"\n\n";
        msgWarningEmail += "Nom : "+theForm.nom.value+"\n";
        msgWarningEmail += "Prénom : "+theForm.prenom.value+"\n";
        msgWarningEmail += "Rue : "+theForm.rue.value+"\n";
        msgWarningEmail += "Numéro : "+theForm.numero.value+"\n";
        msgWarningEmail += "Numéro postal : "+theForm.numeropostal.value+"\n";
        msgWarningEmail += "Lieu : "+theForm.lieu.value+"\n";
        msgWarningEmail += "Pays : "+theForm.pays.value+"\n";
        msgWarningEmail += "Téléphone : "+theForm.tel.value+"\n";
        msgWarningEmail += "E-mail : "+theForm.email.value+"\n";
        msgWarningEmail += "____________________________________________________\n\n";
        msgWarningEmail += "\nSouhaitez-vous envoyer le message ainsi ?";

	if (theForm.subject.value == '') {
		alert('Le sujet est vide.');
		theForm.subject.focus();
		return false;
	}
	else if (theForm.message.value == '') {
		alert('Le message est vide.');
		theForm.message.focus();
		return false;
	}
	else if (theForm.nom.value == '') {
		alert('Le nom est vide.');
		theForm.nom.focus();
		return false;
	}
	else if (theForm.prenom.value == '') {
		alert('Le prénom est vide.');
		theForm.prenom.focus();
		return false;
	}
	else if (theForm.rue.value == '') {
		alert('La rue est vide.');
		theForm.rue.focus();
		return false;
	}
	else if (theForm.numero.value == '') {
		alert('Le numéro est vide.');
		theForm.numero.focus();
		return false;
	}
	else if (theForm.numeropostal.value == '') {
		alert('Le numéro postal est vide.');
		theForm.numeropostal.focus();
		return false;
	}
	else if (theForm.lieu.value == '') {
		alert('Le lieu est vide.');
		theForm.lieu.focus();
		return false;
	}
	else if (theForm.pays.value == '') {
		alert('Le pays est vide.');
		theForm.pays.focus();
		return false;
	}
	else if (theForm.email.value == '') {
		alert('L\'email est vide.');
		theForm.email.focus();
		return false;
	}
        else {
            if (confirm(msgWarningEmail)) {
                theObject = MWJ_findObj('submitButton');
                theObject.disabled = true;
                theObject.value = 'Envoi du message';
                MWJ_changeVisibility('dragableLayer',false);
                //alert('Message envoyé');
                theForm.submit();
            }
        }
}

function swapImgTo(name,path) {
	window.document.images[name].src = path;
}

function decodeAscii(original) {
	var result="";
	arrayofstring=original.split('-'); 
	for (var i=0; i < arrayofstring.length; i++) {
		result=result+String.fromCharCode(arrayofstring[i]-9);
	}
	return result;
}

function getWindowSize(axis) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  if (axis == "x") return myWidth ;
  if (axis == "y") return myHeight ;
}

var popup = new Object()
function Popup(URL, width, height) {
	popup = window.open(URL, 'PopUp', 'scrollbars=yes, width=' + width + ', ' + 'height=' + height + ', top=200, left=200');
	popup.focus()
}

var subMenuDone = false;

// pour eviter le bubbling
function toggleSubmenu(content, todo) { //ouvre
    if (!subMenuDone && todo == 1) {
        subMenuDone = true;
        document.getElementById('submenuMore').style.borderBottom="1px dotted #666";
        document.getElementById('submenuMore').style.borderRight="1px dotted #666";
        document.getElementById('submenuMore').style.borderLeft="1px dotted #666";
        MWJ_changeContents('submenuMore', content);
        MWJ_changeVisibility('submenuDivClose', true);
    }
    
    if (todo == 0) { // ferme
        MWJ_changeContents('submenuMore', content);
        MWJ_changeVisibility('submenuDivClose', false);
        document.getElementById('submenuMore').style.border="1px solid #FFFFFF";
        setTimeout('subMenuDone = false;', 1000);
    }
}

function getRandomInt(max) { // de 1 a max
    var randomnumber = Math.ceil(max*Math.random());
    return randomnumber;
}

var showMenuLabelStatus = 0;
var showMenuLabel1 = "Afficher le menu";
var showMenuLabel2 = "Cacher le menu";

function toggleShowMenuLabel() {
    var el = document.getElementById('showMenuLink');
    if (showMenuLabelStatus == 0) {
        el.innerHTML = showMenuLabel2;
        setTimeout('showMenuLabelStatus = 1;', 100);
        MWJ_changeVisibility("tts", true);
    }
    else {
        el.innerHTML = showMenuLabel1;
        setTimeout('showMenuLabelStatus = 0;', 100);
        MWJ_changeVisibility("tts", false);
    }
}

function setCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

function getCookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

