(function(){var h=document.getElementById("content"),n={EMAIL_INVALID_ADDRESS:"Votre email est invalide",EMAIL_INVALID_SUBJECT_LENGTH:"Votre sujet doit au moins faire 6 caractères",EMAIL_INVALID_MESSAGE_LENGTH:"Votre message doit contenir au moins 10 caractères",EMAIL_ERROR_SEND:"Votre email n'a pas pu être délivré (vérifiez votre email)"},a="http://"+window.location.host,j={api:a+"/api/",views:a+"/views/"};function c(s){var r=(d(s.name) in k(["html","txt"]))?"/#!/explorer/":"/explorer/";return'<a href="'+r+s.path+'" class="thumb"><img src="/images/file.png" alt="'+s.name+'" /><br />'+b(s.name)+"</a>"}function q(r){return'<a href="/#!/explorer/'+r.path+'" class="thumb"><img src="/images/dir.png" alt="'+r.name+'" /><br />'+b(r.name)+"</a>"}function d(r){var s=r.split(".").pop();return s!==r?s:undefined}function l(r,s){return r.name>s.name}function b(s,r){var r=r||12;return s.length<=r?s:s.substr(0,r)+"..."}function k(r){var t={};for(var s=0;s<r.length;s++){t[r[s]]=""}return t}String.prototype.startWith=function(r){return this.lastIndexOf(r,0)===0};function f(){var r=null;if(window.XMLHttpRequest){r=new XMLHttpRequest()}else{if(window.ActiveXObject){try{r=new ActiveXObject("Msxml2.XMLHTTP")}catch(s){try{r=new ActiveXObject("Microsoft.XMLHTTP")}catch(s){}}}}return r}function m(s,u,t,v){var r=f();r.open(u,s,true);if(u==="POST"){if(typeof t==="function"){v=t;t=""}r.setRequestHeader("Content-type","application/x-www-form-urlencoded");r.setRequestHeader("Content-length",t.length);r.setRequestHeader("Connection","close")}else{v=t;t=null}r.onreadystatechange=function(){if(r.readyState==4){if(r.status==200){if(typeof v==="function"){v(r.responseText)}}}};r.send(t)}function i(r,s){m(j.api+r,"GET",function(t){if(s){s(JSON.parse(t))}})}function g(r,s,t){m(j.api+r,"POST",s,function(u){if(t){t(JSON.parse(u))}})}function p(r,s){m(j.views+r+".html","GET",function(t){h.innerHTML=t;if(s){s()}})}function o(r,s){m(a+"/explorer/"+r,"GET",function(t){h.innerHTML=t;if(s){s()}})}function e(){var r="",t=location.hash.substring(3);if(t===""){p("home")}else{if(t.startWith("explorer")){var s=/^explorer\/(.+)/.exec(t);s=s?s[1]:"";if(s.match(/\.[a-z]+$/)!==null){o(s)}else{i("explorer/"+s,function(v){var u=0,x=v.dirs.sort(l),w=v.files.sort(l);r="<h2>"+((s==="")?"Racine":"/"+s)+"</h2>";for(u in x){r+=q(v.dirs[u])}for(u in w){r+=c(v.files[u])}h.innerHTML=r})}}else{if(t==="contact"){p("contact",function(){var v=document.getElementById("contactForm"),u=document.getElementById("notifier");v.addEventListener("submit",function(z){var w=document.getElementById("email").value,x=document.getElementById("subject").value,y=document.getElementById("message").value;u.innerHTML="<p>Envoi en cours...</p>";g("contact","email="+w+"&subject="+x+"&message="+y,function(B){if(B.error){r='<p>Les erreurs suivantes sont survenues :</p><ul class="red">';for(var A in B.message){r+="<li>"+n[B.message[A]]+"</li>"}u.innerHTML=r+"</ul>"}else{u.innerHTML='<p class="green">Votre message a été envoyé.</p>'}});z.preventDefault()},false)})}else{if(t==="cv"){p("cv",function(){document.getElementById("age").innerHTML=Math.floor((Date.now()-new Date(1989,12,15))/(3600*24*365*1000))})}else{p("error")}}}}}if("onhashchange" in window&&typeof JSON!=="undefined"&&f()!==null&&window.addEventListener){window.onhashchange=function(){e()};e()}else{p("evolution")}})();

