function RemplacerSousChaine(Chaine, PosPremCar, PosDernCar, SsChaine){var NouvChaine ;if (PosDernCar < PosPremCar){NouvChaine = Chaine.substring(0,PosPremCar) + SsChaine + Chaine.substring(PosPremCar) ;}else {NouvChaine = Chaine.substring(0,PosPremCar) + SsChaine + Chaine.substring(PosDernCar + 1) ;}return NouvChaine ;}function LocaliserParamUrl(Url, Param){var PosAvParam = -1 ;var PosApParam = -1 ;var PosMilieuParam = -1 ;var PosCour = 0 ;var Chercher = true ;while(Chercher){PosAvParam = Url.indexOf("?"+Param, PosCour) ;if (PosAvParam == -1)PosAvParam = Url.indexOf("&"+Param, PosCour) ;if (PosAvParam == -1)Chercher = false ;else {PosMilieuParam = PosAvParam + Param.length + 1 ;if (PosMilieuParam <  Url.length){var CarMilieuParam = Url.charAt(PosMilieuParam) ;if (CarMilieuParam == "=" || CarMilieuParam == "&" || CarMilieuParam == "#")Chercher = false ;}}if (Chercher == true){PosCour = PosAvParam + 1 ;PosAvParam = -1 }}if (PosAvParam > -1){PosApParam = Url.indexOf("&",PosAvParam + 1) ;if (PosApParam == -1){PosApParam = Url.indexOf("#",PosAvParam) ;if (PosApParam == -1)PosApParam = Url.length ;}}var Localisation = new Array(2) ;Localisation[0] = PosAvParam ;Localisation[1] = PosApParam ;return Localisation ;}function ParamExisteEnUrl(Url, Param){var ParamExiste = false ;var Localisation = new Array(2) ;Localisation = LocaliserParamUrl(Url, Param) ;if (Localisation[0] > 0)ParamExiste = true ;return ParamExiste ;}function EnleverParamUrl(Url, Param){var PosAvAge = 0 ;var PosApAge = 0 ;var Localisation = new Array(2) ;Localisation = LocaliserParamUrl(Url, Param) ;var PosAvParam = Localisation[0] ;var PosApParam = Localisation[1] ;if (PosAvParam > -1){Url = RemplacerSousChaine(Url, PosAvParam + 1, PosApParam - 1, "") ;if (Url.charAt(PosAvParam) == "&")Url = RemplacerSousChaine(Url, PosAvParam, PosAvParam, "") ;else if (Url.charAt(PosAvParam + 1) == "&")Url = RemplacerSousChaine(Url, PosAvParam + 1, PosAvParam + 1, "") ;else if (Url.charAt(PosAvParam) == "?")Url = RemplacerSousChaine(Url, PosAvParam, PosAvParam, "") ;}return Url ;}function MettreParamEnUrl(Url, Param, Valeur){Valeur = Valeur + "" ;Pos = Url.indexOf("?",0) ;if (Pos > 0){if (Valeur == "")Url = RemplacerSousChaine(Url, Pos + 1, Pos, Param + "&") ;else Url = RemplacerSousChaine(Url, Pos + 1, Pos, Param + "=" + Valeur + "&") ;}else {Pos = Url.indexOf("#",0) ;if (Pos > 0){if (Valeur == "")Url = RemplacerSousChaine(Url, Pos - 1, Pos - 2, "?" + Param) ;else Url = RemplacerSousChaine(Url, Pos - 1, Pos - 2, "?" + Param + "=" + Valeur) ;}else {if (Valeur == ""){Url = Url + "?" + Param ;}else {Url = Url + "?" + Param + "=" + Valeur ;}}}return Url ;}function LireParamUrl(Url, Param){var ValeurParam = "" ;var Localisation = new Array(2) ;Localisation = LocaliserParamUrl(Url, Param) ;var PosAvParam = Localisation[0] ;var PosApParam = Localisation[1] ;if (PosAvParam > -1){var Parametre = Url.substring(PosAvParam+1, PosApParam) ;var Pos = Parametre.indexOf("=",0) ;if (Pos > -1)ValeurParam = Parametre.substring(Pos + 1) ;}return ValeurParam ;}function SupprimerImagesTitreFormulaireForum(Titre){var PosDebBalise = Titre.indexOf('<', 0) ;if (PosDebBalise > -1){var PosFinBalise = Titre.indexOf('>',PosDebBalise) ;if (PosFinBalise > -1){var Pos = Titre.indexOf('|', PosDebBalise) ;if (Pos == -1 || Pos > PosFinBalise)Pos = Titre.indexOf('img', PosDebBalise) ;if (Pos == -1 || Pos > PosFinBalise)Pos = Titre.indexOf('doc', PosDebBalise) ;if (Pos > -1 && Pos < PosFinBalise){Titre = RemplacerSousChaine(Titre, PosDebBalise, PosFinBalise, "") ;}}}return Titre ;}function InitPage(){var Url  = window.location.href ;var ChaineRecherche = LireParamUrl(Url, "recherche") ;document.Archives.Rechercher.value = decodeURI(ChaineRecherche) ;for (var i=0; i < document.forms.length; i++){var ElTitre     = -1 ;var ElRetForum  = -1 ;for (var j=0; j < document.forms[i].elements.length; j++){if (document.forms[i].elements[j].name == "titre")ElTitre = j ;else if (document.forms[i].elements[j].name == "retour_forum")ElRetForum = j ;} ;if (ElRetForum > -1 && ElTitre > -1){var Titre = new String(document.forms[i].elements[ElTitre].value);Titre = SupprimerImagesTitreFormulaireForum(Titre) ;document.forms[i].elements[ElTitre].value = Titre ;}} ;}function ActuParamRechercheEnUrl(Url){Url = EnleverParamUrl(Url, "recherche") ;var ChampRecherche = document.Archives.Rechercher.value ;ChampRecherche.replace(/(^\s*)|(\s*$)/g,"") ;if (ChampRecherche.length > 0){ChampRecherche = encodeURI(ChampRecherche) ;Url = MettreParamEnUrl(Url, "recherche", ChampRecherche) ;}return Url ;}function RemplacerModePageCourantParSommaireEnUrl(Url){if (Url.indexOf("mode_page=Sommaire",0) == -1){var PosAncre = Url.indexOf("#", 0) ;if (PosAncre != -1)Url = RemplacerSousChaine(Url, PosAncre, Url.length, "") ;if (Url.indexOf("mode_page=Article",0) > -1){Url = EnleverParamUrl(Url, "id_article") ;Url = EnleverParamUrl(Url, "id_rubrique") ;Url = EnleverParamUrl(Url, "id_auteur") ;}else if (Url.indexOf("mode_page=Themes",0) > -1){Url = EnleverParamUrl(Url, "id_theme") ;}Url = EnleverParamUrl(Url, "mode_page") ;Url = MettreParamEnUrl(Url, "mode_page", "Sommaire") ;var ParamPage = LireParamUrl(Url, "page") ;if (ParamPage == "")ParamPage = "sommaire-S" ;else if (ParamPage.indexOf("-S",0) == -1)ParamPage = ParamPage + "-S" ;Url = EnleverParamUrl(Url, "page") ;Url = MettreParamEnUrl(Url, "page", ParamPage) ;}return Url ;}function ChercherArchive(){var Url  = window.location.href ;var Url0 = Url ;var PosAvAge = 0 ;var PosApAge = 0 ;Url = EnleverParamUrl(Url, "Age") ;Url = EnleverParamUrl(Url, "Jmax") ;var IndMoisArchive = document.Archives.MoisArchive.selectedIndex - 0 ;var IndAnneeArchive = document.Archives.AnneeArchive.selectedIndex - 0 ;if (IndMoisArchive > 0){var DateActuelle = new Date();var AnneeActuelle = DateActuelle.getFullYear() ;var MoisArchive = document.Archives.MoisArchive.options[IndMoisArchive].value - 0 ;var AnneeArchive = AnneeActuelle ;if (IndAnneeArchive > 0)AnneeArchive = document.Archives.AnneeArchive.options[IndAnneeArchive].value ;var DateArchive = new Date() ;DateArchive.setHours(0) ;DateArchive.setMinutes(0) ;DateArchive.setDate(1) ;if (MoisArchive == 12){DateArchive.setMonth(0) ;DateArchive.setFullYear(AnneeArchive + 1) ;}else {DateArchive.setMonth(MoisArchive+1 - 1) ;DateArchive.setFullYear(AnneeArchive) ;}var DateArchiveMs = DateArchive.getTime() ;var DateActuelleMs = DateActuelle.getTime() ;if (DateActuelleMs > DateArchiveMs){var AgeArchive = Math.floor((DateActuelleMs-DateArchiveMs) / (24*3600*1000)) ;Url = MettreParamEnUrl(Url, "Age", AgeArchive) ;Url = MettreParamEnUrl(Url, "Jmax", (AgeArchive+7)) ;}}Url = ActuParamRechercheEnUrl(Url) ;if (Url.indexOf("mode_page=Sommaire",0) == -1)Url = RemplacerModePageCourantParSommaireEnUrl(Url) ;if (Url != Url0){parent.location = Url ;}}function RecherchePartout(){var Url  = window.location.href ;var Url0 = Url ;Url = ActuParamRechercheEnUrl(Url) ;if (Url.indexOf("recherche=",0) > -1){Url = EnleverParamUrl(Url, "mode_page") ;Url = MettreParamEnUrl(Url, "mode_page", "Recherche") ;if (Url != Url0){parent.location = Url ;}}}function ModeRubrique(IdRubrique){var Url  = window.location.href ;var Url0 = Url ;var IdRubrique0 = LireParamUrl(Url, "id_rubrique") ;var ModePage0   = LireParamUrl(Url, "mode_page") ;var ModePage    = ModePage0 ;if (ModePage0 == "Article")IdRubrique0 = 0 ;Url = EnleverParamUrl(Url, "id_rubrique") ;if (ModePage0 != "Sommaire" )Url = RemplacerModePageCourantParSommaireEnUrl(Url) ;if (ModePage != ModePage0 || IdRubrique0 != IdRubrique){Url = MettreParamEnUrl(Url, "id_rubrique", IdRubrique) ;}if (Url != Url0){parent.location = Url ;}}