function displayNextZoom() {
	var others = $$("#conteneurZoom IMG");

	for(i=1;i<=others.length;i++) {
		if($('zoom'+i).visible() == true) {
			if(i == others.length)
				next = 1;
			else next = i + 1;
			break;
		}
	}

	others.each(function(e){e.hide();});

	Effect.Appear($('zoom'+next), { duration: 1.0 });

	return false;
}

function displayThisZoom(id) {
	var others = $$("#conteneurZoom IMG");
	others.each(function(e){e.hide();});

	Effect.Appear($('conteneurZoom'), { duration: 0.5 });
	Effect.Appear($('zoom'+id), { duration: 1.0 });

	return false;
}

function displayLexique(lettre) {
	var others = $$(".conteneurLexique");
	others.each(function(e){ e.hide(); });
	Effect.Appear($('lexique'+lettre), { duration: 0.5 });
	return false;
}

function displayProducts(idt) {

	if($('produit' + idt).visible() == false) {
		// On le déroule
		Effect.BlindDown('produit' + idt, { duration: 0.3 });
	}
	else {
		// On le replie
		Effect.BlindUp('produit' + idt, { duration: 0.3 });
	}
	return false;
}

Event.observe(window, 'load', function() {
	if($('home')) {
		Effect.Appear($('conteneurHome'), { duration: 1.0 });
	}
	if($('conteneurConseils')) {
		Effect.Appear($('conteneurConseils'), { duration: 1.0 });
	}

	if($('conteneurConseilsEn')) {
		Effect.Appear($('conteneurConseilsEn'), { duration: 1.0 });
	}

	// Identification
	if($('identification')) {
		$$('#identification INPUT').each(function(e){
			if(e.type == "text") {
				e.observe('focus', function() {
					e.style.border = "1px solid #999";
				});
				e.observe('blur', function() {
					e.style.border = "1px solid #FFF";
				});

			}
		});
	}

	// points de vente monde
	if($('worldMap') != null && $('shopsForm') != null) {
		$('worldMap').observe('mouseover', function() {
			if($('shopsForm').style.display == 'none')
				Effect.Appear($('shopsForm'), { duration: 0.6 });
		});
	}


});

// points de vente monde
function change(type, value){
	if(value != '') $(type).replace(selects[value]);
	$$('.magasin').each(function(mag){ $(mag).hide(); });
	if(type == 'pays'){
		if(value == '') $('pays').replace('<select name="pays" id="pays" onchange="change(\'ville\', this.value);"><option value=""></option>');
		$('pays').value = '';
		$('ville').replace('<select name="ville" id="ville" onchange="change(\'magasin\', this.value);"><option value=""></option>');
		$('magasin').replace('<select name="magasin" id="magasin"><option value=""></option>');
	}
	else if(type == 'ville'){
		if(value == '') $('ville').replace('<select name="ville" id="ville" onchange="change(\'magasin\', this.value);"><option value=""></option>');
		$('ville').value = '';
		$('magasin').replace('<select name="magasin" id="magasin"><option value=""></option>');
	}
	else if(type == 'magasin'){
		if(value == '') $('magasin').replace('<select name="magasin" id="magasin"><option value=""></option>');
		$('magasin').value = '';
		// s'il n'y a qu'un magasin, on l'affiche
		if($('magasin').childElements().length == 2){
			$('magasin').down().next().selected = true;
			displayMag($('magasin').down().next().value);
		}
	}
	if($('pays').value == 'Etats-Unis' || $('pays').value == 'United States' || $('pays').value == 'Australie' || $('pays').value == 'Australia' ){
		$('ville1').hide();
		$('ville2').show();
	}
	else{
		$('ville2').hide();
		$('ville1').show();
	}
}

function displayMag(idMag){
	if(idMag != ''){
		$$('.magasin').each(function(mag){
			if($(mag).identify() == 'magasin'+idMag){
				$(mag).show();
			}
			else $(mag).hide();
		});
		if($('shopsList').style.display == 'none'){
			Effect.Appear($('shopsList'), { duration: 0.2 });
			Effect.Appear($('shopsListBottom'), { duration: 0.2 });
		}
	}
	else $$('.magasin').each(function(mag){ $(mag).hide(); });
}

