window.addEvent('domready', function() {





// Second Example

//Gewicht

	var el = $('setColor'), color = [0, 0, 0];

	var updateColor = function(){

		// Sets the color of the output text and its text to the current color

		var erg = color.toString();

		var spliter = erg.split(",");

		//alert (spliter[0]);
		if (spliter[0] == 1){
				 var anzeige = '650 Gramm';
		}else{
			if (spliter[0] == 2){
				var anzeige = '510 Gramm';
			}else{
				if (spliter[0] == 3){
					var anzeige = '380 Gramm';
				}else{
					if (spliter[0] == 4){
						var anzeige = '250 Gramm';
					}else{
						if (spliter[0] == 5){
							var anzeige = '120 Gramm';
						} else { var anzeige = '> 650 Gramm'; }
							
					}
				}
			}
		}
		el.setStyle('color', color).set('text',anzeige);

		if (spliter[0] >0){

			setRequest('selection.php?auswahl=gewicht&wert=' + 1/spliter[0] ,'productsFinder');

		}

	};

	updateColor();

	$$('div.slider.advanced').each(function(el, i){
		var slider = new Slider(el, el.getElement('.knob'), {
			steps: 5,  // Steps from 0 to 255
			wheel: true, // Using the mousewheel is possible too
			onChange: function(){

			// Based on the Slider values set an RGB value in the color array
				color[i] = this.step;
				// and update the output to the new value
				updateColor();
			}

		}).set(0);
	});

//Gewicht Ende




	

		

	

	

	//create our Accordion instance

	var myAccordion = new Accordion($('accordion'), 'h3.toggler', 'div.element', {

		opacity: false,

		onActive: function(toggler, element){

			toggler.setStyle('color', '#41464D');

		},

		onBackground: function(toggler, element){

			toggler.setStyle('color', '#528CE0');

		}

	});



	//add click event to the "add section" link

	$('add_section').addEvent('click', function(event) {

		event.stop();

		

		// create toggler

		var toggler = new Element('h3', {

			'class': 'toggler',

			'html': 'Common descent'

		});

		

		// create content

		var content = new Element('div', {

			'class': 'element',

			'html': '<p>A group of organisms is said to have common descent if they have a common ancestor. In biology, the theory of universal common descent proposes that all organisms on Earth are descended from a common ancestor or ancestral gene pool.</p><p>A theory of universal common descent based on evolutionary principles was proposed by Charles Darwin in his book The Origin of Species (1859), and later in The Descent of Man (1871). This theory is now generally accepted by biologists, and the last universal common ancestor (LUCA or LUA), that is, the most recent common ancestor of all currently living organisms, is believed to have appeared about 3.9 billion years ago. The theory of a common ancestor between all organisms is one of the principles of evolution, although for single cell organisms and viruses, single phylogeny is disputed</p>'

		});

		

		// position for the new section

		var position = 0;

		

		// add the section to our myAccordion using the addSection method

		myAccordion.addSection(toggler, content, position);

	});









});





