﻿	var menuids = ["suckertree1"];
function buildsubmenus() {
    for (var i = 0; i < menuids.length; i++) {
        var ultags = document.getElementById(menuids[i]).getElementsByTagName("ul")
        for (var t = 0; t < ultags.length; t++) {
            ultags[t].parentNode.getElementsByTagName("a")[0].className = "subfolderstyle"
            if (ultags[t].parentNode.parentNode.id == menuids[i])
                ultags[t].style.left = ultags[t].parentNode.offsetWidth + "px"
            else
                ultags[t].style.left = ultags[t - 1].getElementsByTagName("a")[0].offsetWidth + "px"
            ultags[t].parentNode.onmouseover = function () { this.getElementsByTagName("ul")[0].style.display = "block" }
            ultags[t].parentNode.onmouseout = function () { this.getElementsByTagName("ul")[0].style.display = "none" } 
        }
        for (var t = ultags.length - 1; t > -1; t--) {
            ultags[t].style.visibility = "visible"
            ultags[t].style.display = "none"
        } 
    } 
}
if (window.addEventListener)
    window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus)
function set(val, repertoireImage) { document.getElementById('s_auto' + val).style.color = "red"; document.getElementById('s_auto' + val).style.paddingRight = "16px"; document.getElementById('s_auto' + val).style.textAlign = "right"; }
function cleare(val, repertoireImage) { document.getElementById('s_auto' + val).style.backgroundColor = "#FFF"; document.getElementById('s_auto' + val).style.color = "black"; document.getElementById('s_auto' + val).style.paddingRight = "34px"; document.getElementById('s_auto' + val).style.textAlign = "right"; }
function setStyle(val, repertoireImage) { document.getElementById('s_auto' + val).style.color = "red"; document.getElementById('s_auto' + val).style.textAlign = "left"; document.getElementById('s_auto' + val).style.paddingRight = "16px"; }
function lostStyle(val, repertoireImage) { document.getElementById('s_auto' + val).style.color = "black"; document.getElementById('s_auto' + val).style.textAlign = "left"; document.getElementById('s_auto' + val).style.paddingRight = "34px"; }
function setStylePalmares(val, repertoireImage) { document.getElementById('palmares' + val).style.color = "red"; document.getElementById('palmares' + val).style.textAlign = "left"; document.getElementById('palmares' + val).style.paddingRight = "16px"; }
function lostStylePalmares(val, repertoireImage) { document.getElementById('palmares' + val).style.color = "black"; document.getElementById('palmares' + val).style.textAlign = "left"; document.getElementById('palmares' + val).style.paddingRight = "34px"; }
function sack(file) {
    this.xmlhttp = null; this.resetData = function () { this.method = "POST"; this.queryStringSeparator = "?"; this.argumentSeparator = "&"; this.URLString = ""; this.encodeURIString = true; this.execute = false; this.element = null; this.elementObj = null; this.requestFile = file; this.vars = new Object(); this.responseStatus = new Array(2); }; this.resetFunctions = function () { this.onLoading = function () { }; this.onLoaded = function () { }; this.onInteractive = function () { }; this.onCompletion = function () { }; this.onError = function () { }; this.onFail = function () { }; }; this.reset = function () { this.resetFunctions(); this.resetData(); }; this.createAJAX = function () {
        try { this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { try { this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { this.xmlhttp = null; } }
        if (!this.xmlhttp) { if (typeof XMLHttpRequest != "undefined") { this.xmlhttp = new XMLHttpRequest(); } else { this.failed = true; } } 
    }; this.setVar = function (name, value) { this.vars[name] = Array(value, false); }; this.encVar = function (name, value, returnvars) { if (true == returnvars) { return Array(encodeURIComponent(name), encodeURIComponent(value)); } else { this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true); } }
    this.processURLString = function (string, encode) { encoded = encodeURIComponent(this.argumentSeparator); regexp = new RegExp(this.argumentSeparator + "|" + encoded); varArray = string.split(regexp); for (i = 0; i < varArray.length; i++) { urlVars = varArray[i].split("="); if (true == encode) { this.encVar(urlVars[0], urlVars[1]); } else { this.setVar(urlVars[0], urlVars[1]); } } }
    this.createURLString = function (urlstring) {
        if (this.encodeURIString && this.URLString.length) { this.processURLString(this.URLString, true); }
        if (urlstring) { if (this.URLString.length) { this.URLString += this.argumentSeparator + urlstring; } else { this.URLString = urlstring; } }
        this.setVar("rndval", new Date().getTime()); urlstringtemp = new Array(); for (key in this.vars) {
            if (false == this.vars[key][1] && true == this.encodeURIString) { encoded = this.encVar(key, this.vars[key][0], true); delete this.vars[key]; this.vars[encoded[0]] = Array(encoded[1], true); key = encoded[0]; }
            urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
        }
        if (urlstring) { this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator); } else { this.URLString += urlstringtemp.join(this.argumentSeparator); } 
    }
    this.runResponse = function () { eval(this.response); }
    this.runAJAX = function (urlstring) {
        if (this.failed) { this.onFail(); } else {
            this.createURLString(urlstring); if (this.element) { this.elementObj = document.getElementById(this.element); }
            if (this.xmlhttp) {
                var self = this; if (this.method == "GET") { totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString; this.xmlhttp.open(this.method, totalurlstring, true); } else { this.xmlhttp.open(this.method, this.requestFile, true); try { this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") } catch (e) { } }
                this.xmlhttp.onreadystatechange = function () {
                    switch (self.xmlhttp.readyState) {
                        case 1: self.onLoading(); break; case 2: self.onLoaded(); break; case 3: self.onInteractive(); break; case 4: self.response = self.xmlhttp.responseText; self.responseXML = self.xmlhttp.responseXML; self.responseStatus[0] = self.xmlhttp.status; self.responseStatus[1] = self.xmlhttp.statusText; if (self.execute) { self.runResponse(); }
                            if (self.elementObj) { elemNodeName = self.elementObj.nodeName; elemNodeName.toLowerCase(); if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea") { self.elementObj.value = self.response; } else { self.elementObj.innerHTML = self.response; } }
                            if (self.responseStatus[0] == "200") { self.onCompletion(); } else { self.onError(); }
                            self.URLString = ""; break;
                    } 
                }; this.xmlhttp.send(this.URLString);
            } 
        } 
    }; this.reset(); this.createAJAX();
}
var ajaxBox_offsetX = 0; var ajaxBox_offsetY = 0; var ajax_list_externalFile = 'http://www.sport-decouverte.com/js/ajauto.aspx'; var minimumLettersBeforeLookup = 1; var ajax_list_objects = new Array(); var ajax_list_cachedLists = new Array(); var ajax_list_activeInput = false; var ajax_list_activeItem; var ajax_list_optionDivFirstItem = false; var ajax_list_currentLetters = new Array(); var ajax_optionDiv = false; var ajax_optionDiv_iframe = false; var ajax_list_MSIE = false; if (navigator.userAgent.indexOf('MSIE') >= 0 && navigator.userAgent.indexOf('Opera') < 0) ajax_list_MSIE = true; var currentListIndex = 0; function ajax_getTopPos(inputObj) {
    var returnValue = inputObj.offsetTop; while ((inputObj = inputObj.offsetParent) != null) { returnValue += inputObj.offsetTop; }
    return returnValue;
}
function ajax_list_cancelEvent() { return false; }
function ajax_getLeftPos(inputObj) { var returnValue = inputObj.offsetLeft; while ((inputObj = inputObj.offsetParent) != null) returnValue += inputObj.offsetLeft; return returnValue; }
function ajax_option_setValue(e, inputObj) { if (!inputObj) inputObj = this; var tmpValue = inputObj.innerHTML; if (ajax_list_MSIE) tmpValue = inputObj.innerText; else tmpValue = inputObj.textContent; if (!tmpValue) tmpValue = inputObj.innerHTML; ajax_list_activeInput.value = tmpValue; if (document.getElementById(ajax_list_activeInput.name + '_hidden')) document.getElementById(ajax_list_activeInput.name + '_hidden').value = inputObj.id; ajax_options_hide(); }
function ajax_options_hide() { if (ajax_optionDiv) ajax_optionDiv.style.display = 'none'; if (ajax_optionDiv_iframe) ajax_optionDiv_iframe.style.display = 'none'; }
function ajax_options_rollOverActiveItem(item, fromKeyBoard) {
    if (ajax_list_activeItem) {
        if (item.className == 'optionDiv') { ajax_list_activeItem.className = 'optionDiv'; }
        else { ajax_list_activeItem.className = 'optionDiv2'; } 
    }
    item.className = 'optionDivSelected'; ajax_list_activeItem = item; if (fromKeyBoard) {
        if (ajax_list_activeItem.offsetTop > ajax_optionDiv.offsetHeight) { ajax_optionDiv.scrollTop = ajax_list_activeItem.offsetTop - ajax_optionDiv.offsetHeight + ajax_list_activeItem.offsetHeight + 2; }
        if (ajax_list_activeItem.offsetTop < ajax_optionDiv.scrollTop) { ajax_optionDiv.scrollTop = 0; } 
    } 
}
function ajax_option_list_buildList(letters, paramToExternalFile) {
    ajax_optionDiv.innerHTML = ''; ajax_list_activeItem = false; if (ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()].length <= 1) { ajax_options_hide(); return; }
    ajax_list_optionDivFirstItem = false; var optionsAdded = false; for (var no = 0; no < ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()].length; no++) {
        if (ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()][no].length == 0) continue; optionsAdded = true; var div = document.createElement('DIV'); var items = ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()][no].split(/###/gi); if (ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()].length == 1 && ajax_list_activeInput.value == items[0]) { ajax_options_hide(); return; }
        div.innerHTML = items[items.length - 1]; if (div.innerHTML.substring(0, 1) == '+') { div.innerHTML = div.innerHTML.substring(1, div.innerHTML.length); div.className = 'optionDiv2'; div.id = items[0].substring(1, items[0].length); } else { div.className = 'optionDiv'; div.id = items[0]; }
        div.onmouseover = function () { ajax_options_rollOverActiveItem(this, false) }
        div.onclick = ajax_option_setValue; if (!ajax_list_optionDivFirstItem) ajax_list_optionDivFirstItem = div; ajax_optionDiv.appendChild(div);
    }
    if (optionsAdded) { ajax_optionDiv.style.display = 'block'; if (ajax_optionDiv_iframe) ajax_optionDiv_iframe.style.display = ''; ajax_options_rollOverActiveItem(ajax_list_optionDivFirstItem, true); } 
}
function ajax_option_list_showContent(ajaxIndex, inputObj, paramToExternalFile, whichIndex) { if (whichIndex != currentListIndex) return; var letters = inputObj.value; var content = ajax_list_objects[ajaxIndex].response; var elements = content.split('|'); ajax_list_cachedLists[paramToExternalFile][letters.toLowerCase()] = elements; ajax_option_list_buildList(letters, paramToExternalFile); }
function ajax_option_resize(inputObj) { ajax_optionDiv.style.top = (ajax_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY) + 'px'; ajax_optionDiv.style.left = (ajax_getLeftPos(inputObj) + ajaxBox_offsetX) + 'px'; if (ajax_optionDiv_iframe) { ajax_optionDiv_iframe.style.left = ajax_optionDiv.style.left; ajax_optionDiv_iframe.style.top = ajax_optionDiv.style.top; } }
function ajax_showOptions(inputObj, paramToExternalFile, e) {
    if (e.keyCode == 13 || e.keyCode == 9) return; if (ajax_list_currentLetters[inputObj.name] == inputObj.value) return; if (!ajax_list_cachedLists[paramToExternalFile]) ajax_list_cachedLists[paramToExternalFile] = new Array(); ajax_list_currentLetters[inputObj.name] = inputObj.value; if (!ajax_optionDiv) {
        ajax_optionDiv = document.createElement('DIV'); ajax_optionDiv.id = 'ajax_listOfOptions'; document.body.appendChild(ajax_optionDiv); if (ajax_list_MSIE) { ajax_optionDiv_iframe = document.createElement('IFRAME'); ajax_optionDiv_iframe.border = '0'; ajax_optionDiv_iframe.style.width = ajax_optionDiv.clientWidth + 'px'; ajax_optionDiv_iframe.style.height = ajax_optionDiv.clientHeight + 'px'; ajax_optionDiv_iframe.id = 'ajax_listOfOptions_iframe'; document.body.appendChild(ajax_optionDiv_iframe); }
        var allInputs = document.getElementsByTagName('INPUT'); for (var no = 0; no < allInputs.length; no++) { if (!allInputs[no].onkeyup) allInputs[no].onfocus = ajax_options_hide; }
        var allSelects = document.getElementsByTagName('SELECT'); for (var no = 0; no < allSelects.length; no++) { allSelects[no].onfocus = ajax_options_hide; }
        var oldonkeydown = document.body.onkeydown; if (typeof oldonkeydown != 'function') { document.body.onkeydown = ajax_option_keyNavigation; } else { document.body.onkeydown = function () { oldonkeydown(); ajax_option_keyNavigation(); } }
        var oldonresize = document.body.onresize; if (typeof oldonresize != 'function') { document.body.onresize = function () { ajax_option_resize(inputObj); }; } else { document.body.onresize = function () { oldonresize(); ajax_option_resize(inputObj); } } 
    }
    if (inputObj.value.length < minimumLettersBeforeLookup) { ajax_options_hide(); return; }
    ajax_optionDiv.style.top = (ajax_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY) + 'px'; ajax_optionDiv.style.left = (ajax_getLeftPos(inputObj) + ajaxBox_offsetX) + 'px'; if (ajax_optionDiv_iframe) { ajax_optionDiv_iframe.style.left = ajax_optionDiv.style.left; ajax_optionDiv_iframe.style.top = ajax_optionDiv.style.top; }
    ajax_list_activeInput = inputObj; ajax_optionDiv.onselectstart = ajax_list_cancelEvent; currentListIndex++; if (ajax_list_cachedLists[paramToExternalFile][inputObj.value.toLowerCase()]) { ajax_option_list_buildList(inputObj.value, paramToExternalFile, currentListIndex); } else { var tmpIndex = currentListIndex / 1; ajax_optionDiv.innerHTML = ''; var ajaxIndex = ajax_list_objects.length; ajax_list_objects[ajaxIndex] = new sack(); var url = ajax_list_externalFile + '?' + paramToExternalFile + '=1&term=' + inputObj.value.replace(" ", "+"); ajax_list_objects[ajaxIndex].requestFile = url; ajax_list_objects[ajaxIndex].onCompletion = function () { ajax_option_list_showContent(ajaxIndex, inputObj, paramToExternalFile, tmpIndex); }; ajax_list_objects[ajaxIndex].runAJAX(); } 
}
function ajax_option_keyNavigation(e) {
    if (document.all) e = event; if (!ajax_optionDiv) return; if (ajax_optionDiv.style.display == 'none') return; if (e.keyCode == 38) { if (!ajax_list_activeItem) return; if (ajax_list_activeItem && !ajax_list_activeItem.previousSibling) return; ajax_options_rollOverActiveItem(ajax_list_activeItem.previousSibling, true); }
    if (e.keyCode == 40) { if (!ajax_list_activeItem) { ajax_options_rollOverActiveItem(ajax_list_optionDivFirstItem, true); } else { if (!ajax_list_activeItem.nextSibling) return; ajax_options_rollOverActiveItem(ajax_list_activeItem.nextSibling, true); } }
    if (e.keyCode == 13 || e.keyCode == 9) { if (ajax_list_activeItem && ajax_list_activeItem.className == 'optionDivSelected') ajax_option_setValue(false, ajax_list_activeItem); if (e.keyCode == 13) return false; else return true; }
    if (e.keyCode == 27) { ajax_options_hide(); } 
}
document.documentElement.onclick = autoHideList; function autoHideList(e) {
    if (document.all) e = event; if (e.target) source = e.target; else if (e.srcElement) source = e.srcElement; if (source.nodeType == 3)
        source = source.parentNode; if (source.tagName.toLowerCase() != 'input' && source.tagName.toLowerCase() != 'textarea') ajax_options_hide();
}
function change(select, selectedValue) {
    while (select.firstChild)
        select.removeChild(select.firstChild); for (i = 0; i < u[selectedValue].length; i++) { option = document.createElement('option'); option.setAttribute('value', u[selectedValue][i][0]); option.appendChild(document.createTextNode(u[selectedValue][i][1])); select.appendChild(option); }
    if (selectedValue == 0)
        envoyerResultat('http://www.sport-decouverte.com/GetDepartements.aspx', 'todo=getAll&idDepartement=<%=idDepartement %>', new maj());
}
function envoyerResultat(destination, parametres, callback) {
    var xhr_object = null; if (window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); else if (window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); xhr_object.onreadystatechange = function () {
        if (xhr_object.readyState == 4) {
            if (xhr_object.status == 200) { callback.invoke(xhr_object.responseText); }
            else { alert("Mise a jour non effectuee, recommencez svp ! Erreur : " + xhr_object.status); } 
        } 
    }
    xhr_object.open("POST", destination, true); xhr_object.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xhr_object.send(parametres);
}
function StopPub() {
    var xhr_object = null; if (window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); else if (window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); xhr_object.onreadystatechange = function () { if (xhr_object.readyState == 4) { if (xhr_object.status == 200) { } } }
    xhr_object.open("POST", "http://www.sport-decouverte.com/StopPub.aspx", true); xhr_object.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xhr_object.send("");
}
String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ""); }
String.prototype.ltrim = function () { return this.replace(/^\s+/, ""); }
String.prototype.rtrim = function () { return this.replace(/\s+$/, ""); }
function maj() {
    this.invoke = function (message) {
        select = document.getElementById('idDepartement'); while (select.firstChild)
            select.removeChild(select.firstChild); var reg2 = new RegExp("[\t]", "g"); var reg = new RegExp("[\n]", "g"); departements = message.split(reg); for (i = 0; i < departements.length; i++) { if (departements[i].trim().length == 0) continue; option = document.createElement('option'); tmp = departements[i].split(reg2); var value = tmp[0]; var text = tmp[1]; var sel = tmp[2]; option.setAttribute('value', value); if (tmp[2] == 's') option.setAttribute('selected', 'selected'); option.appendChild(document.createTextNode(text)); select.appendChild(option); } 
    } 
}
function recherchePossible() {
    univers = document.getElementById("universr").selectedIndex != 0; discipline = document.getElementById("discipliner").selectedIndex != 0; if (!univers) { alert("Veuillez choisir au minimum un univers."); return false; }
    return true; if ((univers && departement) || discipline) return true; alert("Veuillez choisir un critere de recherche supplementaire svp..."); return false;
}
function getXhrR() {
    var xhr = null; if (window.XMLHttpRequest)
        xhr = new XMLHttpRequest(); else if (window.ActiveXObject) { try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } }
    else { alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); xhr = false; }
    return xhr;
}
function godis() {
    var xhr = getXhrR(); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { leselect = xhr.responseText; document.getElementById('discipliner').innerHTML = leselect; } }
    xhr.open("POST", "http://www.sport-decouverte.com/js/ajdisc.aspx", true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); sel = document.getElementById('universr'); idu = sel.options[sel.selectedIndex].value; xhr.send("id=" + idu);
}
function godepart() {
    var xhr = getXhrR(); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { leselect = xhr.responseText; document.getElementById('toSearchGeo').innerHTML = leselect; } }
    xhr.open("POST", "http://www.sport-decouverte.com/js/ajdep.aspx", true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); sel = document.getElementsByName('discipline')[0]; idu = sel.options[sel.selectedIndex].value; xhr.send("id=" + idu);
}
function invalideBoncadeauDuo() {
    if (document.getElementById('duoDate').checked)
        document.getElementById("boncadeau").checked = false; else
        document.getElementById("boncadeau").checked = true;
}
function afficheDuoDate() {
    if (document.getElementById('duoDate').checked) { document.getElementById("dateDuoAct").style.display = "block"; }
    else { document.getElementById("dateDuoAct").style.display = "none"; } 
}
function chercheDatesDUO(idf1, idf2) { envoyerResultat("http://www.sport-decouverte.com/GetDatesDispo.aspx", "idFormule=" + idf1, new majDatesDUO(1)); envoyerResultat("http://www.sport-decouverte.com/GetDatesDispo.aspx", "idFormule=" + idf2, new majDatesDUO(2)); }
function majDatesDUO(v) {
    this.invoke = function (message) {
        select = document.getElementById('dateDuo' + v); while (select.firstChild)
            select.removeChild(select.firstChild); dates = message.split(new RegExp("[\n]", "g")); for (i = 0; i < dates.length; i++) { if (dates[i].trim().length == 0) continue; option = document.createElement('option'); option.setAttribute('value', dates[i]); option.appendChild(document.createTextNode(dates[i])); select.appendChild(option); } 
    } 
}
function IE_CorrectAlpha_PNG() {
    for (i = 0; i < document.images.length; i++) {
        img = document.images[i]; imgExt = img.src.substring(img.src.length - 3, img.src.length); imgExt = imgExt.toUpperCase(); if (imgExt == "PNG") {
            imgID = (img.id) ? "id='" + img.id + "' " : ""; imgClass = (img.className) ? "class='" + img.className + "' " : ""; imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; imgStyle = "display:inline-block;" + img.style.cssText; if (img.align == "left") { imgStyle = "float:left;" + imgStyle; } else if (img.align == "right") { imgStyle = "float:right;" + imgStyle; }
            if (img.parentElement.href) { imgStyle = "cursor:hand;" + imgStyle; }
            strNewHTML = '<span ' + imgID + imgClass + imgTitle + ' style="width:' + img.width + 'px; height:' + img.height + 'px;' + imgStyle + ';' + 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + img.src + '\', sizingMethod=\'scale\');"></span>'; img.outerHTML = strNewHTML; i = i - 1;
        } 
    } 
}
window.attachEvent("onload", IE_CorrectAlpha_PNG);
