function SmartAdServer2(sas_pageid,sas_formatid,sas_target) {
	if (sas_masterflag==1) {
		sas_masterflag=0;
		sas_master='M';
	} 
	else {sas_master='S';};
	document.write('<SCR'+'IPT ID="pubscr' + sas_pageid + sas_formatid + '" SRC="http://www.smartadserver.com/call/pubj/' + sas_pageid + '/' +sas_formatid + '/'+sas_master + '/' + sas_tmstp + '/' + escape(sas_target) +'?"></SCR'+'IPT>');
}

var pubids=[];

function SmartMoveEndPageDivs() {
	for( i=0 ; i < pubids.length ; i++) {
		try {
			var scr = document.getElementById("pubscr"+pubids[i]);
			scr.parentNode.removeChild(scr);
			var secureDiv = document.getElementById("pubend"+pubids[i]);
			document.getElementById("pub"+pubids[i]).appendChild(secureDiv);
			secureDiv.style.display = 'block';
			document.getElementById("pub"+pubids[i]).style.display = "block";
		} catch(e) {
		
	// 		alert(e+"\n"+i+"\n"+pubids[i]);
		}
	}
}


function checking () 
{
    valeur="1";

    flag=false;
    switch (valeur) {
    case "1" : 
        flag=false;
        $('SerializedForm').value = Form.serialize($('frmRecherche'));
        frmElem = $('frmRecherche').elements;
        elemArr = new Array();
        for (var i = 0; i < frmElem.length; i++) {
            nomImpt = frmElem[i].name;
            theReg = new RegExp(/(\[\])/gi);
            if(theReg.test(nomImpt)){
                if(!arrayExists(elemArr,nomImpt)){
                    elemArr[elemArr.length] = nomImpt;
                }
            }
        }
        var postInfo = Form.serialize($('frmRecherche'));
        var valPub = "";
        var infoAll = "";
        for (var i = 0; i < elemArr.length; i++) {
            if($('frmRecherche')[elemArr[i]] != null){
                var Inputs = $('frmRecherche')[elemArr[i]];
                for (var j = 0; j < Inputs.length; j++) {
                    if (Inputs[j].checked){
                        valPub = valPub + "&" + elemArr[i] + "=" + Inputs[j].value;
                    }
                }
                nameOpt = elemArr[i].replace(/(\[\])/,"");
                eval("postInfo = postInfo.replace(/("+ nameOpt + "_)[\w]*.[\w]*=[\w]*.[\w]*(&)/gi,'');");
                eval("postInfo = postInfo.replace(/("+ nameOpt + "All)[\w]*.[\w]*=[\w\%]*(&)/gi,'');");
                nameAll = nameOpt + "All"
                if($('frmRecherche')[nameAll] != null){
                    infoAll = infoAll + "&" + nameAll + "=" + $('frmRecherche')[nameAll].value;
                }
            }
        }
        postInfo = postInfo + valPub + infoAll;
        var reg = new RegExp("[?]+", "g");

        loc ='/rechercheV2/index.php';
        new Ajax.Request(loc, {
            method:'post',
            postBody: postInfo,
            onSuccess: function(response){
                if(navigator.userAgent.indexOf("MSIE") != -1){
                    document.body.innerHTML = response.responseText;
                }
                else if(navigator.userAgent.indexOf("Safari") != -1){
                    document.body.innerHTML = response.responseText;
                }
                else{
                    document.documentElement.innerHTML = response.responseText;
                }
                try{loadForm();}catch(ext){}
            },
            onFailure: function(){ alert('Un problème est survenu durant la recherche...'); },
            onLoading: function(){
                loader = "<br/><br/><div style=\"text-align:center;\"><img src=\"/rechercheV2/img/wait.gif\" alt=\"Chargement en cours...\" /> Recherche en cours veuillez patienter.</div><br/><br/>";
                $('contentWithContext_ajax').innerHTML = loader;
            }
        });           
        break;
    case "2": 
        document.getElementById('mot_cle_form').value=document.getElementById('AllWords').value;
        document.getElementById('frmRecherche4').submit();
        break;
    case "3":
        document.getElementById('AllWords2').value=document.getElementById('AllWords').value;
        document.getElementById('frmRecherche2').submit();
        break;
    case "4":
        document.getElementById('AllWords3').value=document.getElementById('AllWords').value;
        document.getElementById('frmRecherche3').submit();
        break;
    }

    return flag;
}

/////////////

(function(){

    var DomReady = window.DomReady = {};

	// Everything that has to do with properly supporting our document ready event. Brought over from the most awesome jQuery. 

    var userAgent = navigator.userAgent.toLowerCase();

    // Figure out what browser is being used
    var browser = {
    	version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
    	safari: /webkit/.test(userAgent),
    	opera: /opera/.test(userAgent),
    	msie: (/msie/.test(userAgent)) && (!/opera/.test( userAgent )),
    	mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent))
    };    

	var readyBound = false;	
	var isReady = false;
	var readyList = [];

	// Handle when the DOM is ready
	function domReady() {
		// Make sure that the DOM is not already loaded
		if(!isReady) {
			// Remember that the DOM is ready
			isReady = true;
        
	        if(readyList) {
	            for(var fn = 0; fn < readyList.length; fn++) {
	                readyList[fn].call(window, []);
	            }
            
	            readyList = [];
	        }
		}
	};

	// From Simon Willison. A safe way to fire onload w/o screwing up everyone else.
	function addLoadEvent(func) {
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
	    window.onload = func;
	  } else {
	    window.onload = function() {
	      if (oldonload) {
	        oldonload();
	      }
	      func();
	    }
	  }
	};

	// does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload.
	function bindReady() {
		if(readyBound) {
		    return;
	    }
	
		readyBound = true;

		// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
		if (document.addEventListener && !browser.opera) {
			// Use the handy event callback
			document.addEventListener("DOMContentLoaded", domReady, false);
		}

		// If IE is used and is not in a frame
		// Continually check to see if the document is ready
		if (browser.msie && window == top) (function(){
			if (isReady) return;
			try {
				// If IE is used, use the trick by Diego Perini
				// http://javascript.nwbox.com/IEContentLoaded/
				document.documentElement.doScroll("left");
			} catch(error) {
				setTimeout(arguments.callee, 0);
				return;
			}
			// and execute any waiting functions
		    domReady();
		})();

		if(browser.opera) {
			document.addEventListener( "DOMContentLoaded", function () {
				if (isReady) return;
				for (var i = 0; i < document.styleSheets.length; i++)
					if (document.styleSheets[i].disabled) {
						setTimeout( arguments.callee, 0 );
						return;
					}
				// and execute any waiting functions
	            domReady();
			}, false);
		}

		if(browser.safari) {
		    var numStyles;
			(function(){
				if (isReady) return;
				if (document.readyState != "loaded" && document.readyState != "complete") {
					setTimeout( arguments.callee, 0 );
					return;
				}
				if (numStyles === undefined) {
	                var links = document.getElementsByTagName("link");
	                for (var i=0; i < links.length; i++) {
	                	if(links[i].getAttribute('rel') == 'stylesheet') {
	                	    numStyles++;
	                	}
	                }
	                var styles = document.getElementsByTagName("style");
	                numStyles += styles.length;
				}
				if (document.styleSheets.length != numStyles) {
					setTimeout( arguments.callee, 0 );
					return;
				}
			
				// and execute any waiting functions
				domReady();
			})();
		}

		// A fallback to window.onload, that will always work
	    addLoadEvent(domReady);
	};

	// This is the public function that people can use to hook up ready.
	DomReady.ready = function(fn, args) {
		// Attach the listeners
		bindReady();

    
		// If the DOM is already ready
		if (isReady) {
			// Execute the function immediately
			fn.call(window, []);
	    } else {
			// Add the function to the wait list
	        readyList.push( function() { return fn.call(window, []); } );
	    }
	};
    
	bindReady();
	
})();


 recherche_possible=false;
 DomReady.ready(function() {
    recherche_possible=true;
    });

function checking_transport () 
{
    if (!recherche_possible) return false;
    
    valeur="1";    
    document.getElementById('context').style.display="none";
    flag=false;
    switch (valeur) {
    case "1" : //on ne fait rien on valide formulaire
        flag=false;
        $('SerializedForm').value = Form.serialize($('frmRecherche'));
        frmElem = $('frmRecherche').elements;
        elemArr = new Array();
        for (var i = 0; i < frmElem.length; i++) {
            nomImpt = frmElem[i].name;
            theReg = new RegExp(/(\[\])/gi);
            if(theReg.test(nomImpt)){
                if(!arrayExists(elemArr,nomImpt)){
                    elemArr[elemArr.length] = nomImpt;
                }
            }
        }
        var postInfo = Form.serialize($('frmRecherche'));
        var valPub = "";
        var infoAll = "";
        for (var i = 0; i < elemArr.length; i++) {
            if($('frmRecherche')[elemArr[i]] != null){
                var Inputs = $('frmRecherche')[elemArr[i]];
                for (var j = 0; j < Inputs.length; j++) {
                    if (Inputs[j].checked){
                        valPub = valPub + "&" + elemArr[i] + "=" + Inputs[j].value;
                    }
                }
                nameOpt = elemArr[i].replace(/(\[\])/,"");
                eval("postInfo = postInfo.replace(/("+ nameOpt + "_)[\w]*.[\w]*=[\w]*.[\w]*(&)/gi,'');");
                eval("postInfo = postInfo.replace(/("+ nameOpt + "All)[\w]*.[\w]*=[\w\%]*(&)/gi,'');");
                nameAll = nameOpt + "All"
                if($('frmRecherche')[nameAll] != null){
                    infoAll = infoAll + "&" + nameAll + "=" + $('frmRecherche')[nameAll].value;
                }
            }
        }
        postInfo = postInfo + valPub + infoAll;
        var reg = new RegExp("[?]+", "g");

        loc ='/rechercheV2/index.php';
        new Ajax.Request(loc, {
            method:'post',
            postBody: postInfo,
            onSuccess: function(response){                
                $('homePage').style.width='1000px';                
                if(navigator.userAgent.indexOf("MSIE") != -1){                    
                    $('contentWithContext_ajax').innerHTML= response.responseText;
                    $('listHighlight').style.left='-30px';
                    
                }
                else if(navigator.userAgent.indexOf("Safari") != -1){
                    $('contentWithContext_ajax').innerHTML= response.responseText;
                }
                else{
                    $('contentWithContext_ajax').innerHTML= response.responseText;
                }
                try{loadForm();}catch(ext){}
            },
            onFailure: function(){ alert('Un problème est survenu durant la recherche...'); },
            onLoading: function(){
                loader = "<br/><br/><div style=\"text-align:center;padding-left:200px;\"><img src=\"/rechercheV2/img/wait.gif\" alt=\"Chargement en cours...\" /> Recherche en cours veuillez patienter.</div><br/><br/>";
                $('contentWithContext_ajax').innerHTML = loader;
            }
        });           
        break;
    }
    return flag;
}


function checkSriptsdansdiv(){
  var AllScripts=$('contentWithContext').getElementsByTagName("script")
  for (var i=0; i<AllScripts.length; i++) {
     var s=AllScripts[i];
     if (s.src && s.src!="") {
     	try{ 
       	  eval(getFileContent(s.src));
        }catch(ex){}
     }
     else {
        try{
       	  eval(s.innerHTML);
        }catch(ex){ }
     }
  }
}


function checking2(type) 
{
    flag=false;

    switch (type) {
    case 'convcoll': 
        $('SerializedForm').value = Form.serialize($('frmRecherche2'));    
        elemArr = new Array();
        frmElem = $('frmRecherche2').elements;
        $('SerializedFormConvcoll').value=Form.serialize($('frmRecherche2'));
		var postInfo = Form.serialize($('frmRecherche2'));
       
        for (var i = 0; i < frmElem.length; i++) {
            nomImpt = frmElem[i].name; 
            theReg = new RegExp(/(\[\])/gi);
            if(theReg.test(nomImpt)){
                if(!arrayExists(elemArr,nomImpt)){
                    elemArr[elemArr.length] = nomImpt;
                }
            }
        }
    
        var valPub = "";
        var infoAll = "";
        
        for (var i = 0; i < elemArr.length; i++) {
            if($('frmRecherche2')[elemArr[i]] != null){
                var Inputs = $('frmRecherche2')[elemArr[i]]; 
                for (var j = 0; j < Inputs.length; j++) {
                    if (Inputs[j].checked){
                            valPub = valPub + "&" + elemArr[i] + "=" + Inputs[j].value;
                    }
                }
                nameOpt = elemArr[i].replace(/(\[\])/,"");
                eval("postInfo = postInfo.replace(/("+ nameOpt + "_)[\w]*.[\w]*=[\w]*.[\w]*(&)/gi,'');");
                eval("postInfo = postInfo.replace(/("+ nameOpt + "All)[\w]*.[\w]*=[\w\%]*(&)/gi,'');");
                nameAll = nameOpt + "All"
                if($('frmRecherche2')[nameAll] != null){
                    infoAll = infoAll + "&" + nameAll + "=" + $('frmRecherche2')[nameAll].value;
                }
            }
        }
        
        postInfo = postInfo + valPub + infoAll; 
        var reg = new RegExp("[?]+", "g");

        loc ='/rechercheV2/index.php';
        new Ajax.Request(loc, {
            method:'post',
            postBody: postInfo,
            onSuccess: function(response){
                if(navigator.userAgent.indexOf("MSIE") != -1){
                    $('cache3').innerHTML= response.responseText;
                }
                else if(navigator.userAgent.indexOf("Safari") != -1){
                    $('cache3').innerHTML= response.responseText;
                }
                else{
                    $('cache3').innerHTML= response.responseText;
                }
                try{loadForm();}catch(ext){}
            },
            onFailure: function(){ alert('Un problème est survenu durant la recherche...'); },
            onLoading: function(){
                loader = "<br/><br/><div style=\"text-align:center;\"><img src=\"/rechercheV2/img/wait.gif\" alt=\"Chargement en cours...\" /> Recherche en cours veuillez patienter.</div><br/><br/>";
                $('cache3').innerHTML = loader;
            }
        });
        break;
        
    case 'textes':               
        $('SerializedFormTexte').value=Form.serialize($('frmRecherche3'));
        elemArr = new Array();
        frmElem = $('frmRecherche3').elements; 		
		var postInfo = Form.serialize($('frmRecherche3'));  

        for (var i = 0; i < frmElem.length; i++) {
            nomImpt = frmElem[i].name; 
            theReg = new RegExp(/(\[\])/gi);
        }
                    
        var valPub = "";
        var infoAll = "";
        
        for (var i = 0; i < elemArr.length; i++) {
            if($('frmRecherche3')[elemArr[i]] != null){
                var Inputs = $('frmRecherche3')[elemArr[i]]; 
                for (var j = 0; j < Inputs.length; j++) {
                    if (Inputs[j].checked){
                            valPub = valPub + "&" + elemArr[i] + "=" + Inputs[j].value;
                    }
                }
                nameOpt = elemArr[i].replace(/(\[\])/,"");
                eval("postInfo = postInfo.replace(/("+ nameOpt + "_)[\w]*.[\w]*=[\w]*.[\w]*(&)/gi,'');");
                eval("postInfo = postInfo.replace(/("+ nameOpt + "All)[\w]*.[\w]*=[\w\%]*(&)/gi,'');");
                nameAll = nameOpt + "All"
                if($('frmRecherche3')[nameAll] != null){
                    infoAll = infoAll + "&" + nameAll + "=" + $('frmRecherche3')[nameAll].value;
                }
            }
        }
        postInfo = postInfo + valPub + infoAll; 

        var reg = new RegExp("[?]+", "g");
        loc ='/rechercheV2/index.php';
    
        new Ajax.Request(loc, {
            method:'post',
            postBody: postInfo,
            onSuccess: function(response){
                if(navigator.userAgent.indexOf("MSIE") != -1){
                    $('cache4').innerHTML= response.responseText;
                }
                else if(navigator.userAgent.indexOf("Safari") != -1){
                    $('cache4').innerHTML= response.responseText;
                }
                else{
                    $('cache4').innerHTML= response.responseText;
                }
                try{loadForm();}catch(ext){}
            },
            onFailure: function(){ alert('Un problème est survenu durant la recherche...'); },
            onLoading: function(){
                loader = "<br/><br/><div style=\"text-align:center;\"><img src=\"/rechercheV2/img/wait.gif\" alt=\"Chargement en cours...\" /> Recherche en cours veuillez patienter.</div><br/><br/>";
                $('cache4').innerHTML = loader;
            }
        });
        break;               
    }
}


function showMenu(i,obj)
{
    if (i==3) {    
        if (document.getElementById('blockC').value!="yes") {
            checking2("convcoll");
        }
        document.getElementById('blockC').value = "yes";
    }
    if (i==4) {     
        if (document.getElementById('blockT').value!="yes") {
            checking2("textes");
        }
        document.getElementById('blockT').value = "yes";
    }
    if (document.getElementById('cache1')) document.getElementById('cache1').style.display = "none";
    if (document.getElementById('cache2')) document.getElementById('cache2').style.display = "none";
    if (document.getElementById('cache3')) document.getElementById('cache3').style.display = "none";
    if (document.getElementById('cache4')) document.getElementById('cache4').style.display = "none";
    
    document.getElementById("current").id = "";
    
    obj.parentNode.id = "current";
    
    if (i == 1) document.getElementById('cache1').style.display = "block";
    if (i == 2) document.getElementById('cache2').style.display = "block";
    if (i == 3) document.getElementById('cache3').style.display = "block";
    if (i == 4) document.getElementById('cache4').style.display = "block";
}


function showMenuTourisme(i,obj)
{
	if (document.getElementById('cache1')) document.getElementById('cache1').style.display = "none";
	if (document.getElementById('cache2')) document.getElementById('cache2').style.display = "none";
	if (document.getElementById('cache3')) document.getElementById('cache3').style.display = "none";
	if (document.getElementById('cache4')) document.getElementById('cache4').style.display = "none";
	
	document.getElementById("current").id = "";
	obj.parentNode.id = "current";	
	
	if (i == 1) document.getElementById('cache1').style.display = "block";
	if (i == 2) document.getElementById('cache2').style.display = "block";
	if (i == 3) document.getElementById('cache3').style.display = "block";
	if (i == 4) document.getElementById('cache4').style.display = "block";
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
