function validerEnvoi(){

	x=document.courriel;

	at=x.sujet.value;
	if (at.length <= 3)
		{
		alert("Veuillez entrer un sujet s.v.p.");
		return false;
		}

	at=x.description.value;
	if (at.length <= 10)
		{
		alert("La description du courriel est trop courte");
		return false;
		}


	at=x.nom.value.indexOf(".");
	if (at == -1)
		{
		alert("courriel invalide");
		return false;
		}

	at=x.nom.value.indexOf("@");
	if (at == -1)
		{
		alert("courriel invalide");
		return false;
		}

	return true;
}

function loadApplet(){
	window.open("http://24.201.154.182:8080/~gryphon/TicTacToe/classes/TicTacToe.html","my_new_window","toolbar=no, loc\
	ation=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, c\
	opyhistory=yes, width=550, height=600");
}

function insertCookie(nom, variable){
	document.cookie = nom + "=" + variable;
}

function showForum(id){
	var id2 = 'lien';
	document.getElementById(id).style.top=   document.getElementById(id2).style.top;
	document.getElementById(id).style.left=  document.getElementById(id2).style.left;
	document.getElementById(id).style.visibility = "visible";
	
}

function hideForum(id){
	document.getElementById(id).style.visibility = "hidden";

}

function nouveauMembre(){

		document.getElementById('formulaire').style.visibility = "visible";

}

function scan(){


}

function activating(){
	var id = 'eConnection';
	document.getElementById(id).innerHTML = "<FONT COLOR='RED'>DONE</FONT>";
	setTimeout('activating2()',430);
}

function activating2(){
	var id = 'aConnection';
	document.getElementById(id).innerHTML = "<FONT COLOR='RED'>DONE</FONT>";
	setTimeout('activating3()',430);
}

function activating3(){
	var id = 'cConnection';
	document.getElementById(id).innerHTML = "<FONT COLOR='RED'>DONE</FONT>";
	setTimeout('activating4()',430);
}

function activating4(){
	var id = 'sConnection';
	document.getElementById(id).innerHTML = "<FONT COLOR=#112BBB>Your account is now activated, Thank you. <BR>To login, click here:<a href='log.shtml'>Login</a></FONT>";
}

function feather(){
	window.open("feather.html","my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=375, height=230");
}

function loadImage(){
	window.open("repClient.html","my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=525, height=565");

}

function choisirBD(){
	window.open("http://www.gryphon-tech.net/choisirBD.html","my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=500, height=300");

}

function fermerFenetre(){
	window.close();
}


var positionImage;
var leTexte;
var laPhoto;
var couleurTexte;
var couleurTexteNombre;

function afficherPhoto(id, texte){
	laPhoto = id;
	leTexte = texte;
	couleurTexte = 'eeeeee';
	positionImage = -250;
	document.getElementById(texte).style.color = '#' + couleurTexte;
	document.getElementById(id).style.left= positionImage + 'px';
	replacerPhoto();
}

function replacerPhoto(){

	positionImage = positionImage + 5;
	document.getElementById(laPhoto).style.left= positionImage + 'px';
	
	if(positionImage < 0){
		setTimeout('replacerPhoto()',22);
	}
	else{
		afficherTexte(leTexte);
	}
}

function afficherTexte(texte){
	leTexte = texte;
	couleurTexte = 'eeeeee';
	afficherTexte2();
}


function afficherTexte2(){
	if(couleurTexte.indexOf("eeeeee") != -1)
	{
		couleurTexte = "dddddd";
		document.getElementById(leTexte).style.color = '#' + couleurTexte;
		setTimeout('afficherTexte2()',130);
	}
	else{ 
		if(couleurTexte.indexOf("dddddd")!= -1)
		{ 
			couleurTexte = "cccccc";
			document.getElementById(leTexte).style.color = '#' + couleurTexte;
			setTimeout('afficherTexte2()',130);
		}
		else{
			if(couleurTexte.indexOf("cccccc")!= -1){
				couleurTexte = "bbbbbb";
				document.getElementById(leTexte).style.color = '#' + couleurTexte;
				setTimeout('afficherTexte2()',130);
			}
			else{
				if(couleurTexte.indexOf("bbbbbb")!= -1){
					couleurTexte = "aaaaaa";
					document.getElementById(leTexte).style.color = '#' + couleurTexte;
					setTimeout('afficherTexte2()',130);
				}
				else{
					if(couleurTexte.indexOf("aaaaaa")!= -1){
						couleurTexte = "999999";
						couleurTexteNombre = 999999;
						document.getElementById(leTexte).style.color = '#' + couleurTexte;
						setTimeout('afficherTexte2()',130);
					}
					else{
						couleurTexteNombre = couleurTexteNombre - 111111;
						document.getElementById(leTexte).style.color = '#' + couleurTexteNombre;
						if( couleurTexteNombre > 111111){
							setTimeout('afficherTexte2()',130);
						}
					}
				}
			}
		}
	}


}


function verifierBD(){

	x=document.upload;

	at=x.name.value;
	if (at.length <= 3)
		{
		alert("Votre nom est invalide");
		return false;
		}

	at=x.bd.value;
	if (at.length <= 3)
		{
		alert("La base de données est invalide");
		return false;
		}


	at=x.bd.value.indexOf(".res");
	if (at == -1)
		{
		alert("La base de données est invalide");
		return false;
		}

	return true;


}


function validate(){

	x=document.inscription;

	at=x.name.value;
	if (at.length <= 3)
		{
		alert("Not a valid user name");
		return false;
		}

	at=x.pwd1.value;
	if (at.length < 3)
		{
		alert("Not a valid password");
		return false;
		}


	at1=x.pwd1.value;
	at2=x.pwd2.value.indexOf(at1);
	if (at2 == -1)
		{
		alert("Passwords doesn't match");
		return false;
		}
	

	at1=x.pwd2.value;
	at2=x.pwd1.value.indexOf(at1);
	if (at2 == -1)
		{
		alert("Passwords doesn't match");
		return false;
		}
	
	at=x.email.value.indexOf("@");
	if (at == -1)
		{
		alert("Not a valid e-mail");
		return false;
		}
	
	at=x.email.value.indexOf(".");
	if (at == -1)
		{
		alert("Not a valid e-mail");
		return false;
		}
	

	return true;

}

function validate2(){

	x=document.inscription;


	at=x.pwd1.value;

	if(at.length>0){
		if (at.length < 3)
			{
			alert("Not a valid password");
			return false;
			}


		at1=x.pwd1.value;
		at2=x.pwd2.value.indexOf(at1);
		if (at2 == -1)
			{
			alert("Passwords doesn't match");
			return false;
			}


		at1=x.pwd2.value;
		at2=x.pwd1.value.indexOf(at1);
		if (at2 == -1)
			{
			alert("Passwords doesn't match");
			return false;
			}
	}
	
	
	at = x.email.value;
	
	if(at.length >1){
	at=x.email.value.indexOf("@");
	
		if (at == -1)
			{
			alert("Not a valid e-mail");
			return false;
			}

		at=x.email.value.indexOf(".");
		if (at == -1)
			{
			alert("Not a valid e-mail");
			return false;
			}
		
	}
	
	if( x.pwd1.value.length <1 && x.email.value.length <1 && x.age.value.length < 1 && x.signature.value.length <1 && x.avatar.value.length <1 && x.siteWeb.value.length <1 && x.pays.value.length <1){
		alert("Il n'y a aucun changement à faire!");
		return false;
	}
	
	

	return true;

}

function changerJaune(id){
	document.getElementById('description').innerHTML = "[yellow]Yellow text between the tags[/yellow]";
	document.getElementById(id).value = document.getElementById(id).value +  "[yellow][/yellow]";
}

function changerRouge(id){	
	document.getElementById('description').innerHTML = "[red]Red text between the tags[/red]";
	document.getElementById(id).value = document.getElementById(id).value  + " [red][/red]";
}

function changerBleu(id){
	document.getElementById('description').innerHTML = "[blue]Blue text between the tags[/blue]";
	document.getElementById(id).value = document.getElementById(id).value  + " [blue][/blue]";
}

function changerVert(id){
	document.getElementById('description').innerHTML = "[green]Green text between the tags[/green]";
	document.getElementById(id).value = document.getElementById(id).value  + " [green][/green]";
}

function changerGras(id){
	document.getElementById('description').innerHTML = "[bold]Bold text between the tags[/bold]";
	document.getElementById(id).value = document.getElementById(id).value  + " [bold][/bold]";
}

function changerItalique(id){
	document.getElementById('description').innerHTML = "[italic]Italic text between the tags[/italic]";
	document.getElementById(id).value = document.getElementById(id).value  + " [italic][/italic]";
}

function changerSouligne(id){
	document.getElementById('description').innerHTML = "[underline]Underlined text between the tags[/underline]";
	document.getElementById(id).value = document.getElementById(id).value  + " [underline][/underline]";
}

function changerLien(id, uploadDir){
	if(uploadDir.length == 0 || uploadDir.indexOf("null") != -1){
		document.getElementById('description').innerHTML = "Example: [URL=]http://www.java.sun.com[PAGE TITLE=]Java's official web page[/URL]";
		document.getElementById(id).value = document.getElementById(id).value  + " [URL=]http://[PAGE TITLE=][/URL]";
	}
	else{
		document.getElementById('description').innerHTML = "Example: [URL=]http://www.java.sun.com[PAGE TITLE=]Java's official web page[/URL]";
		document.getElementById(id).value = document.getElementById(id).value  + " [URL=]files/"+uploadDir+"/[PAGE TITLE=][/URL]";
	}
}

function changerInsert(id) {
		if (document.getElementById('insertFile').value.length > 0) {
			document.getElementById(id).value = document.getElementById(id).value  + " [URL=]" + document.getElementById('insertFile').value + "[PAGE TITLE=][viewImage][/URL]";
		}
}

function confirmer(){
	var confirmation = false;
	if(confirm('Delete?')){
		confirmation = true;	
	}
	return confirmation;
}

function confirmer(texte){
	var confirmation = false;
	if(confirm(texte)){
		confirmation = true;	
	}
	return confirmation;
}
