
function plan()
{
	var fen = window.open("./coordonnees.htm","Plan","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=600,height=650");
	fen.focus();
}

function evenements()
{
	var fen = window.open("./evenements.htm","Saint-Valentin","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=284,height=600");
	fen.focus();
}

function rdv()
{
	var fen = window.open("./formulaire/formulaire.php","RDV","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=650,height=700");
	fen.focus();
}

function rdvweb()
{
	var fen = window.open("./formulaire/formulaire_siteweb.php","WEB","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function livredor()
{
	var fen = window.open("./formulaire/livredor.php","Livre","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function message_livredor()
{
	$("#dialog-form-livredor").dialog("open");
}

function contact()
{
	$("#dialog-form").dialog("open");
}

function recevoir_dates()
{
	$("#dialog-form-agenda").dialog("open");
}

function centre_fenetre() {
	window.moveTo((window.screen.availWidth/2)-(document.body.clientWidth/2),(window.screen.availHeight/2)-(document.body.clientHeight/2));
}

function ajoute_date()
{
	var fen = window.open("../formulaire/agenda.php","Agenda","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function edit_agenda(id)
{
	window.open("../formulaire/edit_agenda.php?id="+id,"Agenda","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
}

function dates()
{
	var fen = window.open("./formulaire/date.php","DATE","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function photo(id)
{
	var fen = window.open("./photo.php?id="+id,"MYSPACE","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function annonce()
{
	window.open("./formulaire/annonces.php","ANNONCE","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
}

function edit_annonce(idannonce)
{
	var fen = window.open("./formulaire/edit_annonce.php?idannonce="+idannonce,"ANNONCE","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function affiche_image(id)
{
	var fen = window.open("./affiche_image.php?id="+id,"IMAGE","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=600,height=600");
	fen.focus();
}

function repondre_annonce(id)
{
	var fen = window.open("./formulaire/repondre_annonce.php?id="+id,"REPONSE","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function inscription_myspace()
{
	var fen = window.open("./formulaire/formulaire_myspace.php","YOURSPACE","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function diffusion(id,etat)
{
	if(etat==1) alert("Attention, cette date a déjà été diffusée !");
	if(confirm("Etes-vous sûre de vouloir diffuser cette date ? (Annulation impossible)"))
	{
		var fen = window.open("./diffuse.php?id="+id,"DIFFUSION","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
		fen.focus();
	}
}

function inscription()
{
	var fen = window.open("./formulaire/inscription_client.php","INSCRIPTION","directories=no,location=no,alwaysRaised=yes,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500,height=600");
	fen.focus();
}

function tri()
{
	var selection = document.getElementById('type');
	var option = selection.options[selection.selectedIndex].text;
	var tr;
	
	//alert(option);
	//Il faut créer une boucle de traitement pour masquer toutes les lignes ou les afficher !!!
	if(option == "Cherche")
	{
		//alert("c");
		for(j=0;j<=total;j++)
		{
			if(tableau_type_id[j] == 0)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "";
			}
			if(tableau_type_id[j] == 1)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "none";
			}
			if(tableau_type_id[j] == 2)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "none";
			}
		}
	}
	if(option == "Propose")
	{
		//alert("p");
		for(j=0;j<=total;j++)
		{
			if(tableau_type_id[j] == 0)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "none";
			}
			if(tableau_type_id[j] == 1)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "";
			}
			if(tableau_type_id[j] == 2)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "none";
			}
		}
	}
	if(option == "Saillie")
	{
		//alert("s");
		for(j=0;j<=total;j++)
		{
			if(tableau_type_id[j] == 0)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "none";
			}
			if(tableau_type_id[j] == 1)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "none";
			}
			if(tableau_type_id[j] == 2)
			{
				tr = document.getElementById(j);
	    		tr.style.display = "";
			}
		}
	}
	if(option == "Tout")
	{
		//alert("t");
		for(j=0;j<=total;j++)
		{
			tr = document.getElementById(j);
			tr.style.display = "";
			tr = document.getElementById(j);
			tr.style.display = "";
			tr = document.getElementById(j);
			tr.style.display = "";
		}
	}

}

function GetXmlHttpObject()
{ 
    var objXMLHttp = null;
    if (window.XMLHttpRequest)
        objXMLHttp=new XMLHttpRequest();
    else if (window.ActiveXObject)
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
    return objXMLHttp;
}

function verif_inscription()
{
	document.getElementById("divmessage").innerHTML = 0;
	document.getElementById('divmessage').style.color = '#FFA204';
	document.getElementById("divmessage").innerHTML = "<img src=\"../img/anim.gif\">&nbsp;Vérification en cours";
	document.getElementById('divmessage').style.display='block';
	
	var nom;
	nom = document.getElementById("nom").value;
	//alert(login);
	var motdepasse;
	motdepasse = document.getElementById("motdepasse").value;
	var civilite;
	civ_obj = document.getElementById("civilite");
	civilite = civ_obj.options[civ_obj.selectedIndex].value;
	var mail;
	mail = document.getElementById("contact").value;

	//alert(pwd);
	//alert(code);
	if((nom!="") && (mail!="") && (motdepasse!=""))
	{
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp == null)
		{
			alert("Votre navigateur ne supporte pas les requêtes HTTP.");
			return false;
		}
		var url="inscrit.php";
	
		xmlHttp.onreadystatechange = function (){
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
			{
				eval(xmlHttp.responseText);
			}
		}
		xmlHttp.open("POST", url, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
		xmlHttp.send("nom="+nom+"&motdepasse="+motdepasse+"&civilite="+civilite+"&email="+mail);
		return true;
	}
	else
	{
		document.getElementById("divmessage").innerHTML = "&nbsp;Remplir les champs SVP";
	}
}

function Verif_Login()
	{
		document.getElementById('diverreur').style.color = '#E2944B';
		document.getElementById("diverreur").innerHTML = "<img src=\"./img/anim2.gif\">&nbsp;<b>Vérification en cours</b>";
		document.getElementById('diverreur').style.display='block';
		
		//alert("active_inscription");
		var login;
		login = document.getElementById("client_login").value;
		//alert(login);
		var pwd;
		pwd = document.getElementById("client_pwd").value;
		//alert(pwd);
		//alert(code);		

		xmlHttp = GetXmlHttpObject();
		if (xmlHttp == null)
		{
			alert("Votre navigateur ne supporte pas les requêtes HTTP.");
			return false;
		}
		var url="login.php";

		xmlHttp.onreadystatechange = function (){
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
			{
				eval(xmlHttp.responseText);
			}
		}
		xmlHttp.open("POST", url, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
		xmlHttp.send("login="+login+"&password="+pwd);
		return true;
	}
	
	function envoi_rdv(civilite,nometprenom,contact,codepostal,ville,nomchien,race,agechien,difficultes)
	{

	xmlHttp = GetXmlHttpObject();
		if (xmlHttp == null)
		{
			alert("Votre navigateur ne supporte pas les requêtes HTTP.");
			return false;
		}
		var url="ajoute_rdvx.php";

		xmlHttp.onreadystatechange = function (){
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
			{
				eval(xmlHttp.responseText);
			}
		}
		xmlHttp.open("POST", url, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
		xmlHttp.send("civilite="+civilite+"&nometprenom="+nometprenom+"&contact="+contact+"&codepostal="+codepostal+"&ville="+ville+"&nometprenom="+nometprenom+"&race="+race+"&nomchien="+nomchien+"&agechien="+agechien+"&difficultes="+difficultes);
		return true;
	}
	
	function envoi_agenda(civilite,nom,prenom,contact)
	{		
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp == null)
		{
			alert("Votre navigateur ne supporte pas les requêtes HTTP.");
			return false;
		}
		var url="ajoute_mailingx.php";

		xmlHttp.onreadystatechange = function (){
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
			{
				//alert(xmlHttp.responseText);
				eval(xmlHttp.responseText);
			}
		}
		xmlHttp.open("POST", url, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
		xmlHttp.send("civilite="+civilite+"&nom="+nom+"&prenom="+prenom+"&contact="+contact);
		return true;
	}
	
	function envoi_livredor(nom,contact,message)
	{		
		xmlHttp = GetXmlHttpObject();
		if (xmlHttp == null)
		{
			alert("Votre navigateur ne supporte pas les requêtes HTTP.");
			return false;
		}
		var url="ajoute_message_livredor.php";

		xmlHttp.onreadystatechange = function (){
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
			{
				//alert(xmlHttp.responseText);
				eval(xmlHttp.responseText);
			}
		}
		xmlHttp.open("POST", url, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
		xmlHttp.send("nom="+nom+"&contact="+contact+"&message="+message);
		return true;
	}
