
//------------------- MENU PRINCIPAL ROLL OVER --------------------------------------------------

function MenuPrinc_RollOver(id,type) {
	if(type == "over") {
		document.getElementById("idMenuPrinc_btn"+id+"_over").style.display = "block";
		document.getElementById("idMenuPrinc_btn"+id).style.display = "none";
	} else {
		document.getElementById("idMenuPrinc_btn"+id).style.display = "block";
		document.getElementById("idMenuPrinc_btn"+id+"_over").style.display = "none";
	}
}
function MenuBas_RollOver(id,type) {
	if(type == "over") {
		document.getElementById("Menu_infobulle_"+id).style.display = "block";
	} else {
		document.getElementById("Menu_infobulle_"+id).style.display = "none";
	}
}

// --------------------- SEND FRIEND -------------------------------------------------------------

function afficheSendFriend() {
	if(document.getElementById("idSendFriendConteneur").style.display == "none") {
		document.getElementById('idSendFriendMsg').innerHTML = "";
		document.getElementById("idSendFriendOK").style.display = "none";
		document.getElementById("idSendFriendLienOther").style.display = "none";
		habHeight = document.getElementById("idConteneurCouleur").offsetHeight;
		habHeight -= 26;
		document.getElementById("idSendFriendConteneur").style.height = habHeight+"px";
		document.getElementById("idSendFriendTrans").style.height = habHeight+"px";
		document.getElementById("idSendFriendConteneur").style.display = "block";
		document.formSendFriend.pseudo.focus();
	} else {
		document.getElementById("idSendFriendOK").style.display = "none";
		document.getElementById("idSendFriendLienOther").style.display = "none";
		document.getElementById("idSendFriendConteneur").style.display = "none";
		document.formSendFriend.emailDest.value = "";
	}
}
function get_Xhr() {

	if(window.XMLHttpRequest) {// Firefox    
      xhr = new XMLHttpRequest();    
    } else if(window.ActiveXObject) {// Internet Explorer    
      xhr = new ActiveXObject("Microsoft.XMLHTTP");    
    } else { // XMLHttpRequest non supporté par le navigateur 
      //alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest\nVeuillez le mettre à jour");    
      return;    
    }
}
function recSendFriend() {
	pseudo = document.formSendFriend.pseudo.value;
	emailExp = document.formSendFriend.emailExp.value;
	emailDest = document.formSendFriend.emailDest.value;
	message = document.formSendFriend.message.value;
	document.getElementById('idSendFriendMsg').innerHTML = "";
	
	if(emailExp != "" && emailDest != "" && pseudo != "") {
		document.getElementById("idSendFriendWait").style.display = "block";
		get_Xhr();
		xhr.onreadystatechange = function() {
			if(xhr.readyState == 4 && xhr.status == 200) {				
				if(xhr.responseText == "TRUE") {
					document.getElementById("idSendFriendWait").style.display = "none";
					document.getElementById("idSendFriendOK").style.display = "block";
					document.getElementById("idSendFriendLienOther").style.display = "block";					
				} else {
					document.getElementById("idSendFriendWait").style.display = "none";
					document.getElementById('idSendFriendMsg').innerHTML = xhr.responseText;
				}			
				
			}
		}
		xhr.open("POST","zajax_sendfriend.php",true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		
		action = "send";
		xhr.send("pseudo="+pseudo+"&emailExp="+emailExp+"&emailDest="+emailDest+"&message="+message+"&action="+action);
	} else {
		document.getElementById('idSendFriendMsg').innerHTML = "Veuillez remplir tous les champs obligatoires";
	}
}
function otherSendFriend() {
	document.formSendFriend.emailDest.value = "";
	document.getElementById("idSendFriendOK").style.display = "none";
	document.getElementById("idSendFriendLienOther").style.display = "none";
	document.formSendFriend.pseudo.focus();
}