
/**************************************************************************
									general
**************************************************************************/


function popUpCentre(url, name, width, height) {
    var str = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,";
    str += "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  return window.open(url, name, str);
}

var newwin;

function popUp(theURL,winName,features) { 
  newwin = window.open(theURL,winName,features);
}


function verifAgendaPublic() {
    var message = "";
    if (document.form1.titre.value.search(/\w/) == -1) {
        message += "- un titre.\n";}
    if (document.form1.date.value.search(/\w/) == "JJ/MM/AAAA") {
        message += "- une date.\n"}
        if (document.form1.info.value.search(/\w/) == -1) {
        message += "- les infos.\n"}    
    if (message.length > 0) {
        window.alert("Formulaire incomplet, il manque :\n\n" + message);}
    else {
        document.form1.submit();}
}

var regex = new RegExp("[a-z0-9._-]{1,}@[a-z0-9.-]{3,}", "gi");

var message1 = "- Tu n'as pas mis ton pseudo.\n";
var message2 = "- l'adresse est incorrecte.\n";
var message3 = "- Tu n'as pas mis de titre.\n";

function verifNewsletter() {
	var message = "";
	if (document.form1.email.value.search(regex) == -1) {
		message += message2;
		}
	
	if (message.length > 0) {
		window.alert("Il y a une erreur :\n\n" + message);
		return false;
		}
	else {
		document.form1.submit();}
}


///////////// CHANGE IMAGE GALERIE
function changeImage(val){
document.getElementById('affiche').src = ""+val+"";
//changeTexte();
}




/**************************************************************************
Son of Suckerfish Dropdowns Menu
http://www.htmldog.com/articles/suckerfish/dropdowns/
http://www.htmldog.com/ptg/archives/000050.php
**************************************************************************/


<!--//--><![CDATA[//><!--

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
		}
	}
}
mcAccessible = function() {
	var mcEls = document.getElementById("nav").getElementsByTagName("A");
	for (var i=0; i<mcEls.length; i++) {
		mcEls[i].onfocus=function() {
			this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
			this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sfhover"; //li < a:focus
			if(this.parentNode.parentNode.parentNode.nodeName == "li") {
				this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < a:focus
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "li") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < ul < li < a:focus
				}
			}
		}
		mcEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
			this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
			if(this.parentNode.parentNode.parentNode.nodeName == "li") {
				this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "li") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				}
			}
		}
	}
}

// only ie needs the sfHover script. all need the accessibility script...
// thanks http://www.brothercake.com/site/resources/scripts/onload/
if(window.addEventlistener) window.addEventlistener('load', mcAccessible, false); // gecko, safari, konqueror and standard
else if(document.addEventlistener) document.addEventlistener('load', mcAccessible, false); // opera 7
else if(window.attachEvent) { // win/ie
	window.attachEvent('onload', sfHover);
	window.attachEvent('onload', mcAccessible);
} else { // mac/ie5
	if(typeof window.onload == 'function') {
		var existing = onload;
		window.onload = function() {
			existing();
			sfHover();
			mcAccessible();
		}
	} else {
		window.onload = function() {
			sfHover();
			mcAccessible();
		}
	}
}

//--><!]]>



/**************************************************************************
 * Johnvey.com global functions
 * - jvScrambler object
 *
 * All content licensed under a Creative Commons License.
 * See http://johnvey.com for details
 *
 * 2005 Johnvey Hwang
 *************************************************************************/



function jvScrambler(objectID, phraseID, basePhrase) {
	this.cs = new Array("!","~","@","#","$","%","^","&","*","(","+","=","_","B","U","M","C","E","L","L","O");
	this.oid = objectID;
	this.base = basePhrase;
	this.timer = null;
	this.eid = phraseID;
}

jvScrambler.prototype.go = function(ph) {
	this.loops = 0;
	this.cnt = 0;
	this.phrase = ph;
	this.words = this.phrase.split(" ");
	for(var i=this.words.length-1; i; i--) this.loops = Math.max(this.loops, this.words[i].length);
	clearTimeout(this.timer);
	this.timer = setTimeout(this.oid + ".m_scrPhrase()",45);
}

jvScrambler.prototype.reset = function() {
	this.go(this.base);
}

jvScrambler.prototype.m_scrPhrase = function() {
	var out = "";
	if(this.cnt++ >= this.loops) {
		clearTimeout(this.timer);
		out = this.phrase;
	} else {
		for(var i=0; i < this.words.length; i++) out += this.m_scrWord(this.words[i], this.cnt) + " ";
		this.timer = setTimeout(this.oid + ".m_scrPhrase()",45);
	}
	document.getElementById(this.eid).innerHTML = out;
}

jvScrambler.prototype.m_scrWord = function(wd, po) {
	var ln = wd.length;
	if(po >= ln) return wd;
	var out = wd.substring(0, po) + "<span class=\"scH\">|</span><span class=\"scL\">";
	var i = ln - po;
	do { out += this.cs[Math.floor(Math.random() * 2)]; } while(--i);
	out += "</span>";
	return out;
}
