/* Replacement calls. Please see documentation for more information. */

if(typeof sIFR == "function"){
// This is the preferred "named argument" syntax
	sIFR.replaceElement(named({sSelector:"#container h2", sFlashSrc:"/js/egyp.swf", sColor:"#820009", sBgColor:"#FFFFFF",  sWmode:"transparent", nPaddingTop:0, nPaddingRight: 0, nPaddingBottom:0, nPaddingLeft:0, sFlashVars:""}));
};

var animateIn = function(id){	
	
	var attributes = {
		backgroundColor: { from: '#FFFFFF', to: '#E0E7E8'}
	};
	
	var anim = new YAHOO.util.ColorAnim(id, attributes, 0.75);
	anim.onComplete.subscribe(animateOut)
	anim.animate();
}

var animateOut = function(id){	
	
	var el = this.getEl(); 
	
	var attributes = {
		backgroundColor: { from: '#E0E7E8', to: '#FFFFFF'}
	};
	
	var anim = new YAHOO.util.ColorAnim(el, attributes, 0.75);
	anim.animate();
}
/* athletes */
function change(leid){
	document.getElementById("actuels").style.display = "none";
	document.getElementById("boursiers").style.display = "none";
	document.getElementById("passes").style.display = "none";
	document.getElementById(leid).style.display = "block";
	animateIn(leid);
}
/* sponsors */
ouvert = new Array();
function donateurs(leid, lethis){
	if(ouvert[leid] != 1)
	{
		document.getElementById(leid).style.display = "block";
		lethis.style.backgroundImage = "url(/img/bt_hide.gif)";
		ouvert[leid] = 1;
	}else{
		document.getElementById(leid).style.display = "none";
		lethis.style.backgroundImage = "url(/img/bt_show.gif)";
		ouvert[leid] = 0;
	}
}
/* newsletter form */
function check_mail()
	{
		var emailField	= document.forms["mail_form"].email_newsletter;
		var email		= emailField.value;
		
		if (email == "")
		{
			emailField.focus();
			alert("Veuillez entrer votre email.");
			return false;
		}
		else if(email.indexOf("@") <= 0 || email.indexOf(".") <= 0)
		{
			emailField.focus();
			alert("Votre adresse de courriel n'est pas valide.");
			return false;
		}

		var mailingSub = new MailingList(email);
		mailingSub.subscribe();
		return false;
	}
/* comment form */
function check_comment()
	{
		var nom = document.forms["comments"].nom.value;
		var nomElement = document.forms["comments"].nom; 
		if (nom == "")
		{
			nomElement.focus();
			alert("Veuillez entrer votre nom.");
			return false;
		}
		
		var prenom = document.forms["comments"].prenom.value;
		var prenomElement = document.forms["comments"].prenom; 
		if (prenom == "")
		{
			prenomElement.focus();
			alert("Veuillez entrer votre prénom.");
			return false;
		}
		
		var email = document.forms["comments"].email.value;
		var emailElement = document.forms["comments"].email;
		if (email == "")
		{
			emailElement.focus();
			alert("Veuillez entrer votre email.");
			return false;
		}
		if(email.indexOf("@") <= 0 || email.indexOf(".") <= 0)
		{
			emailElement.focus();
			alert("Votre adresse de courriel n'est pas valide.");
			return false;
		}
		
		var comment = document.forms["comments"].comment.value;
		var commentElement = document.forms["comments"].comment;
		if (comment == "")
		{
			commentElement.focus();
			alert("Veuillez entrer votre commentaire.");
			return false;
		}
		
		var entreprise = YAHOO.util.Dom.get('entreprise').value;
		
		var commentSub = new Comments(nom, prenom, email, entreprise, comment);
		commentSub.send();
		return false;
	}
	
function popitup(url) {
	newwindow=window.open(url,'name','width=320,height=277');
	if (window.focus) {newwindow.focus()}
	return false;
}