var Scroller = new Class({	Implements: [Events, Options],	options: {		area: 250,		velocity: 1,		onChange: function(x, y){		    			this.element.scrollTo(x, y);		},		fps: 50,		horizontal: false, //v3 modified		vertical: true	},	initialize: function(element, options){		this.setOptions(options);		this.element = document.id(element);				this.listener = ($type(this.element) != 'element') ? document.id(this.element.getDocument().body) : this.element;		this.timer = null;		this.bound = {			attach: this.attach.bind(this),			detach: this.detach.bind(this),			getCoords: this.getCoords.bind(this)		};	},	start: function(){		this.listener.addEvents({			mouseenter: this.bound.attach, //v3 modified			mouseleave: this.bound.detach		});	},	stop: function(){		this.listener.removeEvents({			mouseenter: this.bound.attach,			mouseleave: this.bound.detach		});		this.detach();		this.timer = $clear(this.timer);	},	attach: function(){		this.listener.addEvent('mousemove', this.bound.getCoords);	},	detach: function(e){		var node = this;		this.detachTimer = (function() {			node.listener.removeEvent('mousemove', node.bound.getCoords);			node.timer = $clear(node.timer);		}).delay(50);	},	getCoords: function(event){			this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;		if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);	},	scroll: function(){				var size = this.element.getSize(),			scroll = this.element.getScroll(),			pos = this.element.getOffsets(),			scrollSize = this.element.getScrollSize(),			change = {x: 0, y: 0};		// v3 modified		if (!this.options.horizontal) delete this.page.x;		if (!this.options.vertical) delete this.page.y;		for (var z in this.page){						if (this.page[z] < (this.options.area + pos[z]) ) {							change[z] = (this.page[z] - this.options.area - pos[z]) * this.options.velocity;							}			else if (this.page[z] + this.options.area > (size[z] + pos[z]) )			{							change[z] = (this.page[z] - size[z] + this.options.area - pos[z]) * this.options.velocity;			}		}						if (change.y || change.x) {		    			this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);					}	}});Shadowbox.init({	language: 'ru',	adapter: 'mootools',	skipSetup: true,	players:  ['img']});window.addEvent('domready', function() {	// включаем shadowbox  var Shadowbox_options = {    resizeDuration: 0.2,    fadeDuration: 0.2,    viewportPadding: 10,    handleOversize: 'drag',    overlayOpacity: 0.5,    viewportPadding: 5,    autoDimensions: true,		animate: false  };    function init_image() {	list = $$(document.links);  list = list.filter(function(item){  	//if (item.hasClass('no')) return false;    return item.href.test(/\.(jpe?g|png|gif|swf)$/)  });  if (list && list.length) {		Shadowbox.setup(list, Shadowbox_options);  }  }    init_image() ;    //скрол в товаре  $$('.mi').each(function(item) {		var area = 100;				item.myScroller = new Scroller(item, {				area: area,				velocity: 0.05						});		item.myScroller.start();	});  //Кнопки в скроле   	$$('.arrow').addEvent('mousedown', function(e) {  			var  deltay=0;		var node =this.getParent().getParent().getElement('.mi');	         if (this.hasClass('up')) deltay = -6;		     if (this.hasClass('down')) deltay = 6;		     			this.timer = (function() {			var curCroll = node.getScroll();					node.scrollTo(0,curCroll.y+deltay);				}).periodical(20);		       	e.preventDefault(); 	}).addEvent('mouseup', function(e) {					this.timer = $clear(this.timer);				e.preventDefault();	}).addEvent('click', function(e) {      	e.preventDefault();    });   //менюшка if ($chk('#topmenu')) {		$$('#topmenu li').addEvent('mouseenter', function(event) {						event.preventDefault();		   		 if (!this.hasClass('current'))	 this.addClass ('Ho'); 									     }).addEvent('mouseleave', function(event) {						event.preventDefault();		          this.removeClass ('Ho');					      				     });}if ($chk('.topm')) {		$$('.topm li').addEvent('mouseenter', function(event) {				 event.preventDefault();		   	    this.addClass ('active'); 									     }).addEvent('mouseleave', function(event) {					event.preventDefault();		      this.removeClass ('active');					      				     });}if ($chk('.childmenu ul li.active')) {    $$('.childmenu ul li.active').each(function(item) {       item.getParent('.childmenu').setStyle('display', 'block');       item.getParent('.js-catName').addClass('active');       item.getParent('.js-catName').addClass('not');       item.getParent('.js-catName').addClass('open');         $$('.js-catName').each(function(item) {		         		      if (!item.hasClass('open'))       				           item.morph({      									'opacity': 0.3						      								});         });     })    }if ($chk('.js-catName')) {		$$('.js-catName').addEvent('mouseenter', function(event) {		       this.addClass ('active');		      	var node = this;		        var man_str=node.get('rel');				    mans=man_str.split(',');				    				    $$('.js-topMan').each(function(item) {		         		 				           item.getParent().morph({									'opacity': 0.3														}); ;		                                			        }); 				 	for (i=0; i<mans.length;i++) {				         if ($chk('.man'+mans[i])) { 					 			$$('.man'+mans[i]).getParent().addClass('active');								$$('.man'+mans[i]).getParent().morph({									'opacity': 1														}); ; 					     }					 }		    						     				   															     }).addEvent('mouseleave', function(event) {						event.preventDefault();				 if (!this.hasClass('not'))		      this.removeClass ('active');			     		     $$('.js-topMan').each(function(item) {		         		    if (!item.hasClass('not'))				           item.getParent().removeClass('active');				           item.getParent().morph({									'opacity': 1														}); ;		                                			        }); 				     });          $$('.js-catName ').addEvent('click', function(event) {   	      		            		     	 if (!this.hasClass('open')) {      		     	    $$('.js-catName').each(function(item) {                           node =item.getElement('.childmenu');    			                if (node!=null) node.setStyle('display', 'none');                            item.removeClass ('open');                           ;                            	                     });                                        node = this.getElement('.childmenu');    			          node.setStyle('display', 'block');   				    			          event.preventDefault();    			          this.addClass ('open');    			           $$('.js-catName').each(function(item) {		         		      if (!item.hasClass('open'))       				           item.morph({      									'opacity': 0.3						      								});                      }); 			          }          		 });		 $$('.js-close ').addEvent('click', function(event) {      		              		     	   this.getParent().setStyle('display', 'none');                      $$('.js-catName').each(function(item) {		         		         				           item.morph({      									'opacity': 1						      								}); ;      		              			        });     	    			        // this.getParent('.js-catName').removeClass ('open');    			        			             event.preventDefault();          		 });}  $$('.js-topMan').each(function(item) {				item.addEvent('mouseenter', function(e) {		      				var node = this;		        var cats_str=node.get('rel');				    cats=cats_str.split(',');				    				    $$('.js-catName').each(function(item) {		         		   				           item.morph({									'opacity': 0.3														}); ;		        			        }); 				 	for (i=0; i<cats.length;i++) {				         if ($chk('.cat'+cats[i])) { 					 			$$('.cat'+cats[i]).addClass('active');								$$('.cat'+cats[i]).morph({									'opacity': 1														}); ; 					     }					 }		    		          		          								 							     	}).addEvent('mouseleave', function(event) {    					         	$$('.js-catName').each(function(item) {		         		   if (!item.hasClass('not'))				           item.removeClass('active');				           item.morph({									'opacity': 1														}); ;		        			        });      });;    	     });			     }); 