
/* sfHover = function() {
	var sfEls = document.getElementById("menu-plus").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



sfHover2 = function() {
	var sfEls = document.getElementById("menu-plus").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover2";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover2\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover2);
*/

sfHover = function() {
	// Support the standard nav without a class of nav.
	var el = document.getElementById("menu-plus");
	if(!/\bmenu-plus\b/.test(el.className) && el.tagName == "UL")
		setHover(el);

	// Find all unordered lists.
	var ieNavs = document.getElementsByTagName('ul');
	for(i=0; i<ieNavs.length; i++) {
		var ul = ieNavs[i];
		// If they have a class of nav add the menu hover.
		if(/\bmenu-plus\b/.test(ul.className))
			setHover(ul);
	}

}

function setHover(nav) {
	var ieULs = nav.getElementsByTagName('ul');
	if (navigator.appVersion.substr(22,3)!="5.0") {
		// IE script to cover <select> elements with <iframe>s
		for (j=0; j<ieULs.length; j++) {
			var ieMat=document.createElement('iframe');
			if(document.location.protocol == "https:")
				ieMat.src="//0";
			else if(window.opera != "undefined")
				ieMat.src="";
			else
				ieMat.src="javascript:false";
			ieMat.scrolling="no";
			ieMat.frameBorder="0";
			ieMat.style.width=ieULs[j].offsetWidth+"px";
			ieMat.style.height=ieULs[j].offsetHeight+"px";
			ieMat.style.zIndex="-1";
			ieULs[j].insertBefore(ieMat, ieULs[j].childNodes[0]);
			ieULs[j].style.zIndex="101";
		}
		// IE script to change class on mouseover
		var ieLIs = nav.getElementsByTagName('li');
		for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
			// Add a sfhover class to the li.
			ieLIs[i].onmouseover=function() {
				if(!/\bsfhover\b/.test(this.className))
					this.className+=" sfhover";
			}
			ieLIs[i].onmouseout=function() {
				if(!this.contains(event.toElement))
					this.className=this.className.replace(' sfhover', '');
			}
		}
	} else {
		// IE 5.0 doesn't support iframes so hide the select statements on hover and show on mouse out.
		// IE script to change class on mouseover
		var ieLIs = document.getElementById('menu-plus').getElementsByTagName('li');
		for (var i=0; i<ieLIs.length; i++) if (ieLIs[i]) {
			ieLIs[i].onmouseover=function() {this.className+=" sfhover";hideSelects();}
			ieLIs[i].onmouseout=function() {this.className=this.className.replace(' sfhover', '');showSelects()}
		}
	}
}

// If IE 5.0 hide and show the select statements.
function hideSelects(){
	var oSelects=document.getElementsByTagName("select");
	for(var i=0;i<oSelects.length;i++)
		oSelects[i].className+=" hide";
}

function showSelects(){
	var oSelects=document.getElementsByTagName("select");
	for(var i=0;i<oSelects.length;i++)
		oSelects[i].className=oSelects[i].className.replace(" hide","");
}

// Run this only for IE.
//if (window.attachEvent) window.attachEvent('onload', sfHover);
// end




function goback(){
	history.go(-1);
}

function blogemail(email){
	if(validMail(email)){
		jQuery.ajax({
		  url: "/wp-content/plugins/adn-forfaits/ajax.php?action=blogemail",
		  type: "POST",
		  data: "email="+email,
		  success: function(html){
			  eval(html);
		  }
		});
	}
	else{
		alert('Veuillez entrer une adresse de courriel valide.');
		document.getElementById("blog_email").focus();
		return false;
	}
}

function validMail(email) {
	var result = false
	var theStr = new String(email)
	var index = theStr.indexOf("@");
	if (index > 0) {
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index+1) && (theStr.length > pindex+1)) result = true;
	}
	return result;
}

function selectall(name,checked){
	var docs = document.getElementsByName(name+'[]');
	for(i=0;i<docs.length;i++){
		docs[i].checked = checked;
	}
}

function dselect(name,checked){
	if(document.getElementById(name).checked && !checked){
		document.getElementById(name).checked = false;
	}
}

function validsearch(text){
	var ch = false;
	var docs = document.getElementsByName('cats[]');
	for(i=0;i<docs.length;i++){
		if(docs[i].checked){
			ch = true;
		}
	}
	if(!ch){
		alert(text);
		return false;
	}
}

sfHover3 = function() {
	var sfEls = document.getElementById("decouvrir").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover3";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover3\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

