ismobile=false;
isios=false;
np=0;
var map;
var ALERT_TITLE = "Erreur!";
var ALERT_BUTTON_TEXT = "Ok";
if(document.getElementById) {
window.alert = function(txt) {createCustomAlert(txt);}
}
function createCustomAlert(txt) {
if (txt.indexOf(',,')!=-1){
msg=txt.split(',,');
ALERT_TITLE=msg[0];
txt=txt.replace(msg[0]+',,','');
}
d = document;
if(d.getElementById("modalContainer")) return;
mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
mObj.id = "modalContainer";
mObj.style.height = d.documentElement.scrollHeight + "px";
alertObj = mObj.appendChild(d.createElement("div"));
alertObj.id = "alertBox";
if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
alertObj.style.visiblity="visible";
h1 = alertObj.appendChild(d.createElement("h1"));
h1.appendChild(d.createTextNode(ALERT_TITLE));
msg = alertObj.appendChild(d.createElement("p"));
msg.innerHTML = txt;
btn = alertObj.appendChild(d.createElement("a"));
btn.id = "closeBtn";
btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
btn.href = "#";
btn.focus();
btn.onclick = function() { removeCustomAlert();return false; }
alertObj.style.display = "block";
}
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
function docwidth(){
var largeur;
if( typeof( window.innerWidth ) == 'number' )
largeur = window.innerWidth;
else if( document.documentElement && document.documentElement.clientWidth )
largeur = document.documentElement.clientWidth;
return largeur;
}
function winwidth(){
var dw=docwidth();
if (isios){return dw;}
var sw = window.screen.availWidth;
return Math.min(dw,sw);
}
function docheight(){
var hauteur;
if( typeof( window.innerHeight ) == 'number' )
hauteur = window.innerHeight;
else if( document.documentElement && document.documentElement.clientHeight )
hauteur = document.documentElement.clientHeight;
return hauteur;
}
function winheight(){
var dh=docheight();
if (isios){return dh;}
var sh = window.screen.availHeight;
return Math.min(dh,sh);
}
function addmarker(){
$.ajax({
type: "POST",
url: "script/getmarker.php",
data: "",
success: function(res){
var tab=jQuery.parseJSON(res);
var r;
var markers = L.markerClusterGroup();
for (r = 0; r < tab.length; ++r) {
var pop='
'+tab[r][1]+'

'+tab[r][2]+'
';
var marker = L.marker(new L.LatLng(tab[r][3], tab[r][4]), { title: tab[r][1]+' - '+tab[r][2]});
marker.bindPopup(pop);
markers.addLayer(marker);
}
map.addLayer(markers);
}
});
}
function winloading(resize) {
if (resize){
np=0;
}else{
np = 0;
}
ismobile = false;
isios = false;
if (np==1){
alert("Votre incription est presque terminée !,,Pour finaliser votre inscription,
merci de valider le lien que vous allez recevoir par email
A bientôt");
}else if (np==2){
alert('Inscription impossible,,Le pseudo existe déjà');
}else if (np==3){
alert('Inscription impossible,,L\'adresse mail existe déjà');
}else if (np==4){
alert('Opération impossible,,Erreur de la base donnée');
}else if (np==5){
alert('Votre inscription est validée,,Vous pouvez maintenant vous connecter');
}else if (np==6){
alert('Connexion impossible !!,,Vous n\'avez pas validé votre inscription');
}else if (np==7){
alert("Connexion impossible !!,,Vérifier vos identifiants");
}
var ww = winwidth();
var wlo = document.getElementById("logo").offsetWidth;
if (wlo>ww/2) {document.getElementById("logo").style.fontSize = "35px";}
}
function hide (box) {
document.getElementById(box).style.visibility = "hidden";
document.getElementById(box).style.opacity=0;
}
function show (box) {
document.getElementById(box).style.visibility = "visible";
document.getElementById(box).style.opacity=1;
}
function showregister(){
document.getElementById("ovshowlic").style.visibility="hidden";
document.getElementById("formregister").reset();
hide("frmbtnlogin");
show("ovregister");
document.getElementById('tfpseudor').focus();
}
function cancelregister(){
document.getElementById("formregister").reset();
show("frmbtnlogin");
hide("ovregister");
}
function showlogin(){
document.getElementById("formlogin").reset();
hide("frmbtnlogin");
show("ovlogin");
document.getElementById('tfpseudoc').focus();
}
function cancellogin(){
document.getElementById("formlogin").reset();
show("frmbtnlogin");
hide("ovlogin");
}
function verifregister(){
var v;
var ok = true;
v=document.forms["formregister"]["tfpseudor"].value;
if ((v==null) || (v.length<3) || (v.length>20)){ok=false;}
v=document.forms["formregister"]["tfpwdr"].value;
if ((v==null) || (v.length<3) || (v.length>20)){ok=false;}
var vv = document.forms["formregister"]["tfrepwdr"].value;
if (v!=vv){ok=false;}
if (ok==true){ok=verifmail(document.forms["formregister"]["tfmailr"].value)};
if (ok==false){
cancelregister();
alert("Erreur,,Vérifiez les informations du formulaire");
}
return ok;
}
function veriflogin(){
var v;
var ok = true;
v=document.forms["formlogin"]["tfpseudoc"].value;
if ((v==null) || (v.length<3) || (v.length>20)){ok=false;}
v=document.forms["formlogin"]["tfpwdc"].value;
if ((v==null) || (v.length<3) || (v.length>20)){ok=false;}
if (ok==false){
cancellogin();
alert("Erreur,,Vérifiez les informations du formulaire");
}
return ok;
}
function verifpwlost(){
var v;
var ok = true;
v=document.forms["formpwlost"]["tfpseudolost"].value;
if ((v==null) || (v.length<3) || (v.length>20)){ok=false;}
if (ok==false){
cancelpwlost();
alert("Erreur,,Vérifiez le pseudo");
return ok;
}
ok=verifmail(document.forms["formpwlost"]["tfmaillost"].value);
if (ok==false){
cancelpwlost();
alert("Erreur,,Vérifiez l'adresse mail");
}
return ok;
}
function verifmail(champ){
if ((champ==null) || (champ.length<5)){return false;}
var regEmail = new RegExp('^[0-9a-z._-]+@{1}[0-9a-z.-]{2,}[.]{1}[a-z]{2,5}$','i');
return regEmail.test(champ);
}
function initmap(){
map = L.map('themap').setView([46.48361, 2.52639], 6);
//L.tileLayer('http://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}', {
L.tileLayer('https://b.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png',{
attribution: '© OpenStreetMap contributors'
}).addTo(map);
addmarker();
}
function showlic(){
document.getElementById("ovshowlic").style.visibility="visible";
}
function closelic(){
document.getElementById("ovshowlic").style.visibility="hidden";
}
function showcontact(){
cancellogin();
document.getElementById('ovfrmmailadmin').style.visibility = 'visible';
document.getElementById('contentmailadmin').value="Votre adresse mail:";
document.getElementById('contentmailadmin').focus();
}
function showpwlost(){
cancellogin();
document.getElementById('tfpseudolost').value='';
document.getElementById('tfmaillost').value='';
document.getElementById('ovpwlost').style.visibility = 'visible';
}
function cancelpwlost(){
document.getElementById('ovpwlost').style.visibility = 'hidden';
}
function gomail(){
var cnt=document.getElementById('contentmailadmin').value;
if ((cnt==null) || (cnt=='')){
alert("Impossible !,,Veuillez saisir un message !");
return;
}
$.ajax({
type: "POST",
url: "script/mailadminanon.php",
data:"id=-2"+"&mes="+cnt,
success: function(res){
if (res=='ok'){
alert("OK,,Message envoyé !");
}else{
alert("Erreur,,Votre message n'a pas été envoyé !");
}
document.getElementById('contentmailadmin').value='';
closemail();
}
});
}
function closemail(){
document.getElementById('ovfrmmailadmin').style.visibility = 'hidden';
}
function mailpwlost(){
var p=document.getElementById('tfpseudolost').value;
var m=document.getElementById('tfmaillost').value;
$.ajax({
type: "POST",
url: "script/pwlost.php",
data:"pseudo="+p+"&email="+m,
success: function(res){
console.log(res);
if (res=='ok'){
alert("OK,,Mot de passe envoyé !");
}else{
alert("Erreur,,Votre mot de passe n'a pas été envoyé !");
}
document.getElementById('tfpseudolost').value='';
document.getElementById('tfmaillost').value='';
cancelpwlost();
}
});
}
window.onload = function(){ winloading(false) ; initmap() };