function tabselect(tab, ulId) {
  var tablist = $(ulId).getElementsByTagName('a');
  var nodes = $A(tablist);

  nodes.each(function(node){
	if (node.id == tab.id) {
		document.getElementById('contenu_'+tab.id).style.display = "block";
		tab.id=tab.id+'_hover';
	} else{
		node.id = node.id.replace(/_.*/, '')
		document.getElementById('contenu_'+node.id).style.display = "none";
	}
  });
}

function showIt(n)
{
	for (i=1; i<27; i++) {
		if(i== n){
			document.getElementById("tab"+n).style.display = "block";
		}else{
			document.getElementById("tab"+i).style.display = "none";
		}
	}
}

function openSqueezeBox(url) {
	//alert(url);
	SqueezeBox.open(url);
}

function reload(){
	cat='0';
	for(var i = 0; i < document.formsearch.categorie.length; i++) {
		if(document.formsearch.categorie[i].checked) {
			cat = document.formsearch.categorie[i].value;
		}
	}
	zone = document.formsearch.region.options[document.formsearch.region.selectedIndex].value;
	
	vil = document.formsearch.ville.options[document.formsearch.ville.selectedIndex].value;
	
	if (vil!='0') {
		url = "resultats.php?zone="+zone+"&categorie="+cat+"&ville="+vil;
	}else{
		url = "deplacements.php?zone="+zone+"&categorie="+cat;
	}
	window.location.href = url;	
}


function affichepopup(){
	document.getElementById("popup01").innerHTML = '<img src="img/onglet_comer.jpg" width="200" height="32" border="0"/>';
	document.getElementById("popup02").innerHTML = '<img src="img/onglet_comer.jpg" width="200" height="32" border="0"/>';
	document.getElementById("popup03").innerHTML = '<img src="img/onglet_comer.jpg" width="200" height="32" border="0"/>';
	document.getElementById("popupalpha").innerHTML = '<img src="img/lienlistealpha.gif" alt="Voir la liste par ordre alphab&eacute;tique" width="243" height="15" border="0">';
	//alert('hello');
}
function affichepopup2(){

	document.getElementById("popupalpha").innerHTML = '<img src="img/lienlistealpha.gif" alt="Voir la liste par ordre alphab&eacute;tique" width="243" height="15" border="0">';
	//alert('hello');
}

function getVar(name)  
{  
	get_string = document.location.search;  
	return_value = '';  

	do { //cette boucle va capturer toutes les instances des variables GET.  
		name_index = get_string.indexOf(name + '=');  
		if(name_index != -1)  
		{  
			get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);  

			end_of_value = get_string.indexOf('&');  
			if(end_of_value != -1)  
				value = get_string.substr(0, end_of_value);  
				else  
					value = get_string;                  
					if(return_value == '' || value == '')  
						return_value += value;  
					else  
						return_value += ', ' + value;  
					}  
				} while(name_index != -1)  
				
				space = return_value.indexOf('+');  
				while(space != -1)  
				{  
					return_value = return_value.substr(0, space) + ' ' +  
					return_value.substr(space + 1, return_value.length);
					
					space = return_value.indexOf('+');  
	}  
	return(return_value);  
}  

function openmenu(){
	nummenu = getVar('menu');
	if(nummenu){
		tabselect($(nummenu), 'offres6_menu');
	}else{
		tabselect($('menu1'), 'offres6_menu');
	}
}




function init(){
	SqueezeBox.assign($$('a[rel=boxed]'), {
		size: {x: 778, y: 700},
		options: {automaticResize: false},
		ajaxOptions: {
			method: 'get' // we use GET for requesting plain HTML (you can skip it, it is the default value)
		}
		
	});
}

function ie7Ready(){
//prevent duplicate call of init function
  if (Browser.Engine.trident) init();
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function MM_jumpMenu(targ,selObj,restore){
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}
