/******************************
			Avatar method
******************************/
	function showAvatar(css_id,path){
		var obj = new Swiff('design/swf/avatar.swf?', {
					id: 'ava'+css_id,
					width:50,
					height: 50,
					container: $(css_id),
					params: {
						//wmode:"transparent"
					},
					vars: {
					  path:"game_elements/avatars/"+path
					},
					events: {
					}
				})
		
	}
	
	function selectAvatar(avatar_id){
		$(avatar_id).checked=true;
	}
/******************************
			Ajax method
******************************/
/*
window.addEvent("load",function(e){
								//Variable pour okay
							var loginOk=false;
							var passOk=false;
							var passConfirmOk=false;
							var mailOk=false;
							img_ok="<img src='/design/img_interface/login_right.gif' />";
							img_false="<img src='/design/img_interface/login_wrong.gif'/>";
							//focus on email
							$('email').focus();
							//Gestion du Login
							$('login').addEvent('keyup', function(event){
									var loginTMP=this.value;
									var fatchaLogin=$('loginFatcha').value;
									/**
									 * login valide
									 *
									
									
									var myRequest = new Request(			
													{
													method: 'post', url: 'ajax.php',data:"login="+loginTMP+"&fatchaLogin=fatchaLogin&action=testLogin",
													onSuccess:function (){
																		if(loginConfirm){
																			$('loginSubReturn').set('html',"");
																			loginOk=true;
																		}else{
																			$('loginSubReturn').set('html',loginMessage);
																			loginOk=false;
																		}
																}
													}
													).send();
									
								}
							)
							//Gestion du mail
							$('email').addEvent('keyup', function(e){
																  	 
									var loginTMP=this.value;
									
									/**
									 * login valide
									 *
								
									var myRequest = new Request(			
													{
													method: 'post', url: 'ajax.php',data:"email="+loginTMP+"&action=testEmail",
													onSuccess:function (txt){
																		alert(txt)
																		if(mailConfirm){
																			$('emailReturn').set('html',"");
																			$('emailReturnSuccess').set('html',img_ok); // or mailMessage if you want text instead of image
																			$('buttonValidateMail').disabled=false;
																		}else{
																			$('emailReturnSuccess').set('html',"");
																			$('emailReturn').set('html',mailMessage);
																			mailOk=false;
																			$('buttonValidateMail').disabled=true;
																		}
																}
													}
													).send();
								}
							)
							//check if mail has fatcha id (onclick on button)
								$('buttonValidateMail').addEvent('click',function(event){
										var emailTMP=$('email').value;									
										var myRequest = new Request(			
													{
													method: 'post', url: 'ajax.php',data:"email="+emailTMP+"&action=testFatchaId",
													onSuccess:function (){
																		if(hasFatchaId){
																			$('hasFatchaIdBlock').style.display="block";
																			$('passFatcha').focus();
																		}else{
																			$('persoBlock').style.display="block";
																		}
																		mailOk=true;
																}
													}
													).send();
										$('emailValue').value=emailTMP;
										$('email').style.display="none";
										$('buttonValidateMail').style.display="none";
										$('emailValueText').set('html',emailTMP);
										$('buttonChangeMail').style.display="inline";

									}
								)
								//change mail (onClick)
								$('buttonChangeMail').addEvent('click',function(event){
										window.location.href=window.location.href;
									}
								)
							//check password for fatcha ID
								$('buttonCheckPassFatcha').addEvent('click',function(event){
										var passTMP=$('passFatcha').value;
										var emailTMP=$('emailValue').value;		
										var myRequest = new Request(			
													{
													method: 'post', url: 'ajax.php',data:"passFatcha="+passTMP+"&emailFatcha="+emailTMP+"&action=testFatchaIdPassword",
													onSuccess:function (){
																		if(isValidFatchaIdPassword){
																			$('hasFatchaIdBlock').style.display="none";
																			$('persoBlock').style.display="block";
																			$('passFatchaValue').value=passTMP;
																			$('pass').value=passTMP;
																			$('passConfirm').value=passTMP;
																			$('pass').disabled=true;
																			$('passConfirm').disabled=true;
																			$('login').value=fatchaLogin;
																			$('loginFatcha').value=fatchaLogin;
																			$('passFatcha').value=passTMP;
																			passConfirmOk=true;
																			passOk=true;
																			loginOk=true;
																		}else{
																			$('passFatchaReturn').set('html',"subscribe_FatchaMailOrPasswordWrong");
																		}
																}
													}
													).send();
										$('emailValue').value=emailTMP;
										$('email').style.display="none";
										$('buttonValidateMail').style.display="none";
										$('emailValueText').set('html',emailTMP);
										$('buttonChangeMail').style.display="inline";

									}
								)
								//Gestion du pass
								$('pass').addEvent('keyup',function(event){
											pScore=runPassword(this.value, 'mypassword');
											
											if(pScore>=20){
												$('passReturn').set('html',""+pScore)
												passOk=true
											}else{
												$('passReturn').set('html',"Password invalide"+pScore)
												passOk=false
											}
											//On vérifie si le password cnfirm est en accord
											if(this.value==$('passConfirm').value){
												$('passConfirmReturn').set('html',"")
												passConfirmOk=true
											}else{
												$('passConfirmReturn').set('html',"La confirmation ne concorde pas")
												passConfirmOk=false
											}
											
										}
								)
							//COnfirmation du mail
								$('passConfirm').addEvent('keyup',function(event){
											if(this.value==$('pass').value){
												$('passConfirmReturn').set('html',"")
												passConfirmOk=true
											}else{
												$('passConfirmReturn').set('html',"La confirmation ne concorde pas")
												passConfirmOk=false
											}
											
										}
								)
							//change sexe
								$$('input[name=sexe]').addEvent('change',function(event){
										sexRadioObject=$$('input[name=sexe]');
										sexValue=sexRadioObject[0].value;
										$each(sexRadioObject,function(sexRadioElement){
											if(sexRadioElement.checked){
												sexValue=sexRadioElement.value;
											}
										});
										avatarRadioObject=$$('input[name=avatar_id]');
										if(sexValue=='m'){
											$('avatarF').style.display='none';
											$('avatarM').style.display='block';
											$('firstMale').checked=true;
										}else{
											$('avatarM').style.display='none';
											$('avatarF').style.display='block';
											$each(avatarRadioObject,function(avatarRadioElement){
												avatarRadioElement.checked=false;
											});
											$('firstFemale').checked=true;
										}
									}
								)
							//send info to register
								$('SubmitButton').addEvent('click',function(evt){
									new Event(evt).stop();
									if(!loginOk){
										$('registerMessage').set('html',"subscribe_loginNotOk");
									}else if(!passOk){
										$('registerMessage').set('html',"subscribe_passNotOk");
									}else if(!passConfirmOk){
										$('registerMessage').set('html',"subscribe_passConfirmNotOk");
									}else if(!mailOk){
										$('registerMessage').set('html',"subscribe_mailNotOk");
									}else{
										emailValue=$('emailValue').value;
										loginValue=$('login').value;
										passValue=$('pass').value;
										passFatcha=$('passFatcha').value;
										
										sexRadioObject=$$('input[name=sexe]');
										sexValue=sexRadioObject[0].value;
										$each(sexRadioObject,function(sexRadioElement){
											if(sexRadioElement.checked){
												sexValue=sexRadioElement.value;
											}
										});
										avatarRadioObject=$$('input[name=avatar_id]');
										avatarValue=avatarRadioObject[0].value;
										$each(avatarRadioObject,function(avatarRadioElement){
											if(avatarRadioElement.checked){
												avatarValue=avatarRadioElement.value;
											}
										});

										registerSuccess=false;
										var myRequest = new Request(			
													{
													method: 'post', url: 'ajax.php',data:"emailValue="+emailValue+"&loginValue="+loginValue+"&passValue="+passValue+"&passFatcha="+passFatcha+"&sexValue="+sexValue+"&avatarValue="+avatarValue+"&action=doSubscribe",
													onSuccess:function (txt){
																		alert(txt)
																		if(registerSuccess){
																			$('hasFatchaIdBlock').style.display="none";
																		}else{
																			$('persoBlock').style.display="block";
																		}
																}
													}
													).send();
									}
											
								})
					})	*/				