/*$(document).ready(function() {
$("#popupepagineForm").validate({
		rules: {
			nom: "required",
			prenom: "required",
			ville: "required",
			email: {
				required: true,
				email: true
			},
			telphone: {
				required: true,
				maxlength: 10
			},
			age: {
				required: true,
				number: true,
				maxlength: 2
			}
		},
		messages: {
			prenom: "Entrez votre pr&eacute;nom",
			nom: "Entrez votre nom",
			ville: "Entrez votre ville",
			email: {
				required: "Veuillez entrer un courriel valide",
				email: "Veuillez entrer un courriel valide"
			},
			telphone: {
				required: "Veuillez rentrer un num&eacute;ro de t&eacute;l&eacute;phone valide",
				maxlength: "Veuillez rentrer un num&eacute;ro de t&eacute;l&eacute;phone valide"
			},
			age: {
				required: "Veuillez rentrez votre &acirc;ge",
				maxlength: "Veuillez rentrer votre &acirc;ge"
			}
		}
});
}); //fin ready function
*/

var http = null; 
var isWorking = false; 
var NomElem;

if (window.XMLHttpRequest) // Firefox et autres
	http = new XMLHttpRequest(); 
else if (window.ActiveXObject) { // Internet Explorer 
	try {
		http = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
} else { // XMLHttpRequest non supporté par le navigateur 
	//alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	http = false; 
}

function treatquery(UrlEdi,Nom){
	if (!isWorking && http) {
	  NomElem=Nom;
		document.getElementById(NomElem).innerHTML = '<div style="margin:0 auto;height:20px;text-align:center;vertical-align:middle;font-size:12px;color:#000000;"><img src="/images/load.gif" alt="Recherche en cours" style="vertical-align:middle;border:0;width:16px;height:16px" /> recherche en cours</div>'; 
  	document.getElementById(NomElem).style.visibility = 'visible';
  	document.body.style.cursor = 'wait';
		http.open("GET", UrlEdi, true);
		//alert(UrlEdi+"&ElemParent="+NomElem);
		http.onreadystatechange = reponseHtml;
		isWorking = true;
		http.send(null);
	}
}

function reponseHtml() {
	if (http.readyState == 4) {
		if (http.responseText.indexOf('invalid') == -1) { 
		document.getElementById(NomElem).innerHTML = http.responseText;
		var allscript = document.getElementById(NomElem).getElementsByTagName('script');
    for(var i=0;i<allscript.length;i++){
      	window.eval(allscript[i].text);
	    };
		document.body.style.cursor = 'default';
    document.getElementById(NomElem).style.visibility = 'visible';
		}
		isWorking = false;
	}
}

function treatqueryTrans(UrlEdi,Nom){
  NomElem=Nom;
	if (!isWorking && http) {
		http.open("GET", UrlEdi, true);
		http.onreadystatechange = function() {
      if (http.readyState==4) {
		    isWorking = false;
        document.getElementById(NomElem).innerHTML = http.responseText;
        var allscript = document.getElementById(NomElem).getElementsByTagName('script');
		    for(var i=0;i<allscript.length;i++){
      		window.eval(allscript[i].text);
	      };
    	} else isWorking = true;
    };
    http.send(null);
	}
}

/*function epapop() {
if ($('#iemail').val()!="") {
	$.post("upepapop.php",{
		nom: $('#inom').val(),
		prenom: $('#iprenom').val(),
		age: $('#iage').val(),
		ville: $('#iville').val(),
		telphone: $('#itelphone').val(),
		email: $('#iemail').val(),
		sectactivite: $('#isectactivite').val()
		},
		function(data){
		if (data=="ko") {
			$("div.msg_ko").slideDown('fast');
			$("div.msg_ok").hide();
		} else { 
			$("div.msg_ok").slideDown('fast');
			$("div.msg_ko").hide();
			$("div.container").addClass('opac');
		}
		}
	);
	$.post("upclient.php",{email: $('#iemail').val()});	
}
return false;
}*/

function AffiFenetre(urlv,divid,TimeToHide,opacite) {
	if (opacite!=undefined&&opacite!='') {
		$("#OpacPage").addClass("opac");
		$("#OpacTetiere").addClass("opac");
	}
  $("#"+divid).html($.ajax({
    url: urlv,
    async: false
  }).responseText).draggable().slideDown("slow");
  $("#"+divid+" #Fermer").click(
    function() {
      $("#"+divid).slideUp("fast").html("&nbsp;");
    }
  );
		if (TimeToHide!=undefined&&TimeToHide!='') {
		$("#"+divid).everyTime("4s", function() {
			$("#"+divid).hide("fast").html("&nbsp;");
			$("#OpacPage").removeClass("opac");
			$("#OpacTetiere").removeClass("opac");
		}, 1);
	}
}

function PosiFenetre(divid) {
  var hauteur=$(window).scrollTop()+($(window).height()/4);
  var largeur=($(window).width()/2)-($("#"+divid+" div").width()/2);
  $("#"+divid).css({ 'top':hauteur,'left':largeur });
}


