/*function init(){
google.load("prototype", "1.6");
google.load("scriptaculous", "1.8.2");
google.setOnLoadCallback(initPage);


}
function initPage(){
	var selectGoogle = $('google_translate_element').down('select');
	selectGoogle.observe('change', function(){
		if(selectGoogle.value=="en"){								
		selectGoogle.up('body').setStyle({backgroundPosition:'0 40px'})
		}else{
		selectGoogle.up('body').setStyle({backgroundPosition:'0 0'})	
		}
	});
}*/

function swapBloc(idBloc,enfant,actif){
	var i = 1;
	var nb= document.getElementById(idBloc).getElementsByTagName(enfant).length;
	var current = '';
	for(i=1; i<nb+1; i++){
		if((i+actif != nb+1) && (i+actif != 0)){
			if(document.getElementById(idBloc+'_'+i).style.display == "block") {	
				current = i+actif;
			}
			document.getElementById(idBloc+'_'+i).style.display = "none";	
		}
	}
	if(current != '') {
		document.getElementById(idBloc+'_'+current).style.display = "block";
	}
}


/*Début xt_med*/
function splitURL(urlStr)
{
urlStr = urlStr.replace(/\\/g,'/');
res = /^(.*):\/\/([^\/]+)(\/?.*)\/(.+)\.(\w*)$/.exec(urlStr);
if(res)
{ 
urlBits = new Object();
urlBits.domain = res[2];
urlBits.path = res[3];
urlBits.file = res[4];
urlBits.extension = res[5];
return urlBits;
}
return null;
} 

function click_out() {
  xtn2b = xtn2.split("=");
   if (splitURL(this.href)) {
          texte_xiti = "Lien "+splitURL(this.href).extension.toUpperCase()+" - Fichier : "+splitURL(this.href).file;
          xt_med('C',xtn2b[1],texte_xiti,'T');
	} else {
          texte_xiti = "Lien vers le domaine : "+this.href;			
           xt_med('C',xtn2b[1],texte_xiti,'S');
           }
}

function a_test() {
	
    for (i = 0; i < document.links.length; i++) {
        hostname = document.links[i].hostname;
		path = document.links[i].pathname;
		
        if (hostname != '' && hostname != 'www.salon-agriculture.com') {
            document.links[i].onclick = click_out;
		} 		
		if (path.indexOf(".pdf") !=-1) {
			document.links[i].onclick = click_out;
		}
		if (path.indexOf(".xls") !=-1) {
			document.links[i].onclick = click_out;
		}
		if (path.indexOf(".doc") !=-1) {
			document.links[i].onclick = click_out;
		}
		if (path.indexOf(".zip") !=-1) {
			document.links[i].onclick = click_out;
		}		
		
    }
}

function customOnLoad() {
   a_test();
try {
change(); }
catch(err) {
// erreur
}
}
/*Fin xt_med*/