//sous le coude pour le cas où...
function checkornot(box) { 
	if (box.checked == true) { 
 		//blabla
	} 
	else {
		//blabla
	}
}

//l'accordéon sur le roll over
Accordion.implement({
  addSection: function(toggler, element, pos){
  var idx = this.togglers.indexOf(toggler);
  toggler.addEvent('mouseover', this.display.bind(this, idx));
  if (this.options.height) element.setStyles({'padding-top': 0, 'border-top': 'none', 'padding-bottom': 0, 'border-bottom': 'none'});
  if (this.options.width) element.setStyles({'padding-left': 0, 'border-left': 'none', 'padding-right': 0, 'border-right': 'none'});
  if (this.options.fixedWidth) element.fullWidth = this.options.fixedWidth;
  if (this.options.fixedHeight) element.fullHeight = this.options.fixedHeight;
  element.setStyle('overflow', 'hidden');
 }
});
	
//it is parti my kiki...	
window.addEvent('domready', function(){

	//l'accordéon du menu
	new Accordion($$('div#menuaccordion h3'), $$('div#menuaccordion ul'),{ opacity: false, start: 'all-closed' });
    
	//le formulaire de sélection
	if ($('selection')) {
		
		//le slide sous désenfumage
		var monSlide = new Fx.Slide('desenfumonly').hide();
		//l'ouvrir si désenfumage est choisi
		$('desenfum').addEvent('click', function(){	monSlide.slideIn();	});

		//décocher les cases du slide sous désenfumage
		function pasfum() {
			monSlide.slideOut();
			$$('.desenfumoption').removeProperty('checked', 'checked');
		} 	
	
		//enlever les options spéciales désenfumage et cacher le slide si une autre fonction est choisie
		$$('.pasfum').addEvent('click', function(){ pasfum(); });	
  	
		//incompatibilité entre toiture sèche et rénovation
		$('renovation').addEvent('click', function(){
			if (this.getProperty('checked')==true) {
				$('seche').setProperty('disabled', 'disabled').removeProperty('checked', 'checked');
				$('etancher').setProperty('checked', 'checked');
			}
			if (this.getProperty('checked')==false) {
				$('seche').removeProperty('disabled', 'disabled');
			}
		});
	
		$('seche').addEvent('click', function(){
			if (this.getProperty('checked')==true) {
				$('renovation').setProperty('disabled', 'disabled').removeProperty('checked', 'checked');
				$('neuf').setProperty('checked', 'checked');
			}
			if (this.getProperty('checked')==false) {
				$('renovation').removeProperty('disabled', 'disabled');
			}
		});
	
		//rendre à nouveau possible le choix toiture sèche si désenfumage ou éclairement sont choisis
		$$('.sechepossib').each(
			function(el){
			el.addEvent('click', function(){ $('seche').removeProperty('disabled', 'disabled'); });
			}
		);
	}
	
	if ($$('.productcontent')) {
		
		var prodgo = new Asset.images(['../../images/productgo_on.gif', '../../images/productgo_off.gif']);
		
		var skySlides = $$('.productcontent');
		var togslide = $$('.nomproduit');
	
		skySlides.each(function(el, i){
		
			var slider = new Fx.Slide(el);
			slider.hide();
			
			togslide.each(function(elem, j){
				if ( j == i )
				elem.addEvent('click', function(){
									
					slider.toggle();
					
					if(slider.wrapper.offsetHeight == 0)
					this.setStyle('background', 'url(../../images/productgo_on.gif) left 10px no-repeat');
					
					else if (slider.wrapper.offsetHeight != 0)
					this.setStyle('background', 'url(../../images/productgo_off.gif) left 10px no-repeat');
				});

				if (j != i)
				elem.addEvent('click', function(){
					togslide[i].setStyle('background', 'url(../../images/productgo_off.gif) left 10px no-repeat');
					slider.slideOut();
				});
			});			
		});		
	}


});//fin domready
