/*
Class: ProductChoice [Built on MooTools framework: www.mootools.net]
Author: Martin Jezek 2011
Version: 1.0
*/  
var ProductChoice=new Class({Implements:Options,options:{products_id:"",product_class:"",defalut_top:183,new_top:0},initialize:function(options){this.setOptions(options);if($(this.options.products_id).getElements("."+this.options.product_class).length>0){this.initProducts();this.initEvents();}},initProducts:function(){this.choice=$(this.options.products_id);this.products=this.choice.getElements("."+this.options.product_class);this.heading=this.choice.getElements("."+this.options.product_class+" h2");},initEvents:function(){this.heading.each(function(heading,index){heading.addEvent("click",this.headingClick.bind(this,{"heading":heading,"index":index}));},this);},headingClick:function(product){if(product.heading.hasClass("act")){var top=this.options.defalut_top;}else{var top=this.options.new_top;}
this.products[product.index].tween("top",top);product.heading.toggleClass("act");}});
