var E={};
E.IE=Prototype.Browser.IE;
E.animationDuration=0.3;    

/*

		var uhoHeight=_("uho").getHeight()+"px";
		var uhoWidth=_("uho").getWidth()+"px";
		var uhoMoving=false;
		
		function uhoho(t)
		{
		      if(uhoMoving){return;}
		      if(_('uho').visible())
		          {
		              uhoMoving=1;
		              Element.removeClassName(t,'subscribe-shadow');
		              
		              new Effect.Morph('uho',{style:'width:0px;opacity:0;',afterFinish:function(){_("uho").hide();uhoMoving=false;}});
		              new Effect.Morph(t,{style:'opacity:0.5;',afterFinish:function(){ t.style.opacity=1;t.style.filter='';}});
		              
		          }else{
		          uhoMoving=1;
		              _("uho").style.width="0px";
		              _("uho").style.opacity=0;
		              t.style.opacity=0.3;
		              _("uho").show();
		              Element.addClassName(t,'subscribe-shadow');
		               new Effect.Morph('uho',{style:'width:'+uhoWidth+';opacity:1;',afterFinish:function(){ uhoMoving=false;}});
		               new Effect.Morph(t,{style:'opacity:1;'});
		              };
		}


*/
E.Ears=[];
E.EarActive=false;



E.Karma2=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       element:false,
        	       prefix:"karma"
                }, arguments[0] || { });
             
             this.id = this.options.element.id.replace(/.*_/,"");
             this.element = _(this.options.element);
             this.minusLink=this.element.select(".i-minus-new")[0];
             this.plusLink=this.element.select(".i-plus-new")[0];
             if(!this.minusLink||!this.plusLink){ return;}
             this.counterPlus =this.element.select(".plus-num")[0];
             this.counterMinus = this.element.select(".minus-num")[0];
             this.trackPlus=this.element.select(".plus-track")[0];
             this.trackMinus=this.element.select(".minus-track")[0];
             
             this.minusCnt = Number(this.counterMinus.innerHTML);
             this.plusCnt = Number(this.counterPlus.innerHTML);
             this.plusLink.observe("click",this.plus.bind(this));
             this.minusLink.observe("click",this.minus.bind(this));
         },
         plus:function(e){
            Event.stop(e);
            this.action(this.plusLink.href); 
            this.plusCnt++;
            this.counterPlus.update(this.plusCnt);
            new Effect.Highlight(this.counterPlus);
            new Effect.Fade(this.plusLink);
            new Effect.Fade(this.minusLink);
            this.track();
         },
         minus:function(e){
            Event.stop(e);
            this.action(this.minusLink.href); 
            this.minusCnt++;
            this.counterMinus.update(this.minusCnt);
            new Effect.Highlight(this.counterMinus);
            new Effect.Fade(this.plusLink);
            new Effect.Fade(this.minusLink);
            this.track();
         },
         track:function(){
            var sum = this.minusCnt+this.plusCnt;
            new Effect.Morph(this.trackPlus,{style:'width:'+Math.floor( this.plusCnt/(sum/100 ))+"%",duration:1});
            new Effect.Morph(this.trackMinus,{style:'width:'+Math.ceil( this.minusCnt/(sum/100 ))+"%",duration:1});
         },
         action:function(url){
         new Ajax.Request(url, {
              method: 'get',
              onSuccess: function(transport) {
                    var data=transport.responseText.evalJSON();
                    if(data.status!="ok"){
                        alert(data.message);
                    }
                    console.warn("OK",data);
                    
                        this.counterPlus.update(data.up); 
                        this.plusCnt=data.up;    
                        this.counterMinus.update(data.down);
                        this.minusCnt=data.down;     
                    
                    this.track();
              }.bind(this),
              onFailure:function(){
              alert("В ходе выполнения запроса произошла ошибка.");
                new Effect.Morph(this.element,{style:'opacity:0.3',duration:1});
              }.bind(this)
            });
         }
});


E.Karma=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       element:false,
        	       prefix:"karma"
                }, arguments[0] || { });
             
             this.id = this.options.element.id.replace(/.*_/,"");
             this.counter = _(this.options.prefix+"_"+this.id);
             this.options.element.observe("click",this.action.bind(this));
             
             
         },
         action:function(e){
         Event.stop(e);
         new Ajax.Request(this.options.element.href, {
              method: 'get',
              onSuccess: function(transport) {
                    var data=transport.responseText.evalJSON();
                    if(data.status!="ok"){
                        alert(data.message);
                    }
                    this.counter.update(data.score);
                    if(data.score<0)
                    {
                        this.counter.addClassName("neg");
                        this.counter.removeClassName("pos");
                        
                    }
                    else
                    {
                        this.counter.addClassName("pos");
                        this.counter.removeClassName("neg");
                    }
                    new Effect.Highlight(this.counter);
                    new Effect.Fade('karma_minus_'+this.id);
                    new Effect.Fade('karma_plus_'+this.id);
              }.bind(this),
              onFailure:function(){
              alert("В ходе выполнения запроса произошла ошибка.");
              }
            });
         }
});
E.Elda=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       element:false,
        	       closeButton:false
                }, arguments[0] || { });
             
            if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) {
                this.options.element.hide(); return;
            }
             
            this.closed = false;  
            
            this.width=this.options.element.getWidth();
            this.height=this.options.element.getHeight();
            
            var ddim = document.viewport.getDimensions();
	        if(this.height+10>ddim.height){ return; }
            
            
            this.options.element.position = 'relative';    
            this.element = this.options.element.wrap(new Element('div',{ 'class':'navblock-again'}));
            this.process=false;
            
            if(_(this.options.closeButton))
            {
                _(this.options.closeButton).observe('click',function(e){Event.stop(e); new Effect.Fade(this.element); this.closed=true; return(false);}.bind(this));
            }
            
            this.make();
            if(typeof window.onscroll == "function"){
            this.oldonscroll =window.onscroll;
            }else{this.oldonscroll =function(){};}
            
            window.onscroll=function(){
	               window.clearTimeout(this.eldTimer);
	               this.eldTimer=this.action.bind(this).delay(0.1);
	               this.oldonscroll();
	           }.bind(this)
	       
	       
	       if(typeof window.onresize == "function"){
            this.oldonresize= window.onresize;
            }else{this.oldonresize =function(){};}
               
	       window.onresize=function(){
	               
	               window.clearTimeout(this.eldTimer2);
	               this.eldTimer2=(function(){
	                       var ddim = document.viewport.getDimensions();
	                       if(this.height+10>ddim.height){
	                               if(this.element.visible()){
	                                   this.element.fade({duration:0.2})
	                               }
	                        }else{
	                        if(!this.element.visible()){
	                                   this.element.appear({duration:0.2})
	                               }
	                        }
	                        }.bind(this)).delay(0.3);
	                        
	                        this.oldonresize();
	       }.bind(this)
        },
        action:function(){
        if(this.closed){ return; }
        this.process=true;
            var pagescroll={top:((document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop),left:((document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft)};
	        var ddim = document.viewport.getDimensions();
	        if(this.height+10>ddim.height*1.5){ return; }
	           if(pagescroll.top>ddim.height*1.5){
                        if(this.element.visible()){ return; }
                        this.element.show();
                        new Effect.Tween(null, 0,this.width,{duration:0.8, transition: Effect.Transitions.spring, afterFinish:function(){ this.process=false; }.bind(this)}, function(p){
	                       this.element.style.width = p+"px";
	      	            }.bind(this));
                        
	               }else
	               {
	                   new Effect.Tween(null, this.width,0, {duration:0.3, afterFinish:function(){ this.element.hide(); this.process=false; }.bind(this)}, function(p){
	                       this.element.style.width = p+"px";
	      	            }.bind(this));
	               }
        },
        make:function()
        {

            this.options.element.show();
            this.element.setStyle({
                                    position:'fixed',
                                    bottom:"10px",
                                    right:"0px",
                                   // left:'none !important',
                                   // top:'none !important',
                                    overflow:'hidden',
                                    width:'0px',
                                    height:this.height+"px"
                                });
            this.element.toFront().hide();
        }
        
    });


E.Ear=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       button:false,
        	       element:false,
        	       buttonActiveClassName:'subscribe-shadow'
                }, arguments[0] || { });
        this.uhoHeight=_(this.options.element).getHeight()+"px";
		this.uhoWidth=_(this.options.element).getWidth()+"px";
		this.uhoMoving=false;
		_(this.options.button).observe('click',this.toggle.bind(this));
		Element.clonePosition(_(this.options.element), _(this.options.button),{setLeft:false,setWidth:false,setHeight:false});
		E.Ears.push(this);
        },
        toggle:function(e)
        {
            if(e){Event.stop(e);}
            if(this.uhoMoving){return;}
           /* E.Ears.each(function(el){
                if(el!=this &&_( el.options.element).visible() && !el.uhoMoving){ el.toggle.bind(el).call()}
            }.bind(this));
            */
            
            if(_(this.options.element).visible())
		          {
		              this.close();
		           }else{
		       
		              this.open();
		              }
        },
        close:function(){
        if(_(this.options.element).visible())
		          {
		              this.uhoMoving=1;
		              Element.removeClassName(_(this.options.button),this.options.buttonActiveClassName);
		              
		              new Effect.Morph(_(this.options.element),{style:'width:0px;opacity:0;',duration:0.3,afterFinish:function(){_(this.options.element).hide();this.uhoMoving=false;}.bind(this)});
		              
		              new Effect.Morph(_(this.options.button),{style:'opacity:0.5;',duration:0.3,afterFinish:function(){ _(this.options.button).style.opacity=1;_(this.options.button).style.filter='';E.EarActive=false;}.bind(this)});
		              
		          }
        },
        open:function(){
                    if(!_(this.options.element).visible())
		          {
		         
		          
		          E.Ears.each(function(el){
                if(el!=this &&_( el.options.element).visible() && !el.uhoMoving){ el.close.bind(el).call()}
            }.bind(this));
            
             		          this.uhoMoving=1;
		                  _(this.options.element).style.width="0px";
		                  _(this.options.element).style.opacity=0;
		                  _(this.options.button).style.opacity=0.3;
		                  _(this.options.element).show();
		                  Element.addClassName(_(this.options.button),this.options.buttonActiveClassName);
		                  new Effect.Morph(_(this.options.element),{style:'width:'+this.uhoWidth+';opacity:1;',duration:0.3,afterFinish:function(){ this.uhoMoving=false;E.EarActive=this;}.bind(this)});
		                  new Effect.Morph(_(this.options.button),{style:'opacity:1;'},{duration:0.3});
             
		              }
        }
});


E.Bs=[];
E.bActive=false;
E.bTimer=false;
E.Tb=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       bc:false,
        	       cc:false,
        	       allc:[],
        	       allb:[],
        	       wrap:1,
        	       activeButClassName:'actived-tab'
                }, arguments[0] || { });
                
                
                this.options.cc.insert(new Element("div",{style:'clear:both;'}));
               
               try{
                this.height = Number(this.options.cc.getStyle('height').replace("px"));//(this.options.cc.getHeight() || Number(this.options.cc.style.height.replace('px','')));
                }catch(x){
                this.height = (this.options.cc.getHeight() || Number(this.options.cc.style.height.replace('px','')));
               
                }
                this.width = this.options.cc.getWidth();
                
                 _(this.options.cc).style.overflow='hidden';
                if(this.options.wrap){
                this.options.cc.update("<div class='tabWraper'>"+this.options.cc.innerHTML+"</div>");
                }
                this.options.bc.observe("click",function(e){
                
                    Event.stop(e);
                    if(this.options.cc.visible()){return;}
                   
                     this.options.allc.each(function(d){
                               
                                     new Effect.Morph(((this.options.wrap)?d.select(".tabWraper")[0]:d), {
                                              style: 'opacity:0', 
                                              duration: E.animationDuration
                                            });  
                                                                         
                                     new Effect.Morph(d, {
                                              style: 'height:'+((this.height)?this.height+"px":'auto'), // CSS Properties
                                              duration: E.animationDuration,
                                                        afterFinish:function(){
                                                            if(d.visible()){
                                                            d.style.display='none';
                                                            this.options.cc.style.display='';
                                                            }
                                                            
                                                            new Effect.Morph(((this.options.wrap)?this.options.cc.select(".tabWraper")[0]:d),{
                                                                                        style:"opacity:1",
                                                                                        duration:E.animationDuration,
                                                                                        afterFinish:function(){
                                                                                                    //_(this.options.cc).undoClipping(); 
                                                                                                    //_(document.body).style.overflow='auto';
                                                                                                }.bind(this)});
                                                                                                        
                                                        }.bind(this)
                                            });
                                           
                        }.bind(this));
                     this.options.allb.each(function(d){ d.removeClassName(this.options.activeButClassName);}.bind(this));
                     
                     this.options.bc.addClassName(this.options.activeButClassName);
                }.bind(this));
        }
    });
           
E.T=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       container:document.body,
        	       buttonsSelector:".tabs-nav li",
        	       containersSelector:".tabs-ins-cont",
        	       activeButClassName:'actived-tab'
                }, arguments[0] || { });
           
          try{ this.butns=_(this.options.container).select(this.options.buttonsSelector);
           this.conrs=_(this.options.container).select(this.options.containersSelector);
                     }catch(x){ return; }
           for (var i = 0, length = this.butns.length; i < length; i++) 
           {
              new E.Tb({
                bc:this.butns[i],
                cc:this.conrs[i],
                allc:this.conrs,
                allb:this.butns
              });
              
              if(this.butns[i].hasClassName(this.options.activeButClassName)){this.conrs[i].show();}else{this.conrs[i].hide();}
           }
           
           
        }
        
    });
E.B=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       button:false,
        	       element:false,
        	       duration:E.animationDuration,
        	       activeClassName:'actived',
        	       collapsed:true,
        	       parallel:0,
        	       alpha:1,
        	       event:"click",
        	       onUp:function(){},
        	       onDown:function(){}
                }, arguments[0] || { });
            
            this.opened=false;
            this.process=false;
            this.clickCounter=0;
            this.options.element.show();
            this.height=Number(this.options.element.getStyle('height').replace('px',''));
            this.options.element.hide();
            this.make();   
            E.Bs.push(this); 
            if(!this.options.collapsed){this._up()}//else{this._down()}
            return(this);
        
        },
        make:function()
        {
            this.options.button.style.cursor="pointer";
            if(this.options.event=="mouseover"){
            //document.body.observe("mousemove",function(e){ window.clearTimeout(E.bTimer);});
            this.options.button.observe("mouseover",function(){ 
                                        window.clearTimeout(E.bTimer);
                                        if(!this.opened){
                                        E.bTimer=this.down.bind(this).delay(0.5);
                                        }
                                        }.bind(this));
                                        }
                                        else
                                        {
                        this.options.button.observe(this.options.event,this.toggle.bind(this));                        
                                        }
                                        
               /* window.onscroll=function(){
                            for (var i = 0, length = E.Bs.length; i < length; i++) 
                         {
                            if(E.Bs[i].opened ){ 
                                E.Bs[i].up(); 
                                }
                        }
                }*/
            
           /*  this.options.button.observe("contextmenu",function(e){ Event.stop(e);});
            this.options.button.observe("mouseup",function(e){ 
                    if(!Event.isLeftClick(e) && typeof this.options.button.href=="string"){
                    Event.stop(e);
                    location=this.options.button.href;
                    }
                    }.bind(this));*/
        },
        _up:function(z,a)
        {
            if( this.process){ return; }
            this.process=1;
            try{ this.options.button.removeClassName(this.options.activeClassName+"-arrow"); this.options.button.previous().removeClassName(this.options.activeClassName); }catch(x){}
            this.opened=false;
           
            if(this.options.alpha&&a)
            {
                new Effect.Morph(this.options.element, { style:'opacity:0.5;height:'+((a)?a+"px":""),duration:this.options.duration, afterFinish:function(){
                this.options.element.hide();
                this.options.element.style.opacity=1;
                    E.bActive=false;
                     this.process=0;
                    this.options.onUp();
                    if(z){ z(); }
                    
                }.bind(this) });                   
            }
            else
            {
                new Effect.BlindUp(this.options.element, { duration:this.options.duration, afterFinish:function(){
                
                    E.bActive=false;
                     this.process=0;
                    this.options.onUp();
                    if(z){ z(a); }
                    
                }.bind(this) });            
            }

            
        },
        _down:function(z){
             if( this.process){ return; }
            this.process=1;
           try{ 
           
            this.options.button.addClassName(this.options.activeClassName+"-arrow");
            this.options.button.previous().addClassName(this.options.activeClassName);
            }catch(x){}
            this.opened=true;
            
            if(this.options.alpha && !z )
            {
               // alert(1);
                this.options.element.style.height=this.height+"px";
                this.options.element.style.display="";
                this.options.element.style.opacity=0.5;
                new Effect.Morph(this.options.element, { style:"opacity:1;",duration:this.options.duration, afterFinish:function(){
                    E.bActive=this;
                    this.process=0;
                    this.options.onDown();
                }.bind(this)});            
            }
            else
            {
               this.options.element.style.height=0+'px';this.options.element.show();
                new Effect.Morph(this.options.element, {style:'height:'+this.height+'px',duration:this.options.duration, afterFinish:function(){
                    E.bActive=this;
                    this.process=0;
                    this.options.onDown();
                }.bind(this)});
            }
        },
        up:function(x,a)
        {
            
            this._up(x,a);
            
           
            
        },
        down:function()
        {
         
          var dela=0;
             for (var i = 0, length = E.Bs.length; i < length; i++) 
             {
                
                if(E.Bs[i].opened )
                { 
                     
                    
                        if( !E.Bs[i].options.parallel && !this.options.parallel )
                            {
                                //alert("1 == "+this.height+" :: "+E.Bs[i].height+" -- "+(this.options.alpha &&  E.Bs[i].options.alpha)+" ")
                                dela=1;
                                E.Bs[i].up(this._down.bind(this),((this.options.alpha &&  E.Bs[i].options.alpha)?this.height:""));
                            }
                            else
                            {
                                //alert("2 == "+this.height+" :: "+E.Bs[i].height+" -- "+(this.options.alpha &&  E.Bs[i].options.alpha)+" ")
                                E.Bs[i].up();
                            }
                    }
            }
          //  });
         //try{ alert("3 == "+this.height+" :: "+E.Bs[i].height)}catch(er){}
                if(!dela){ this._down(1); }
            
            
        },
        toggle:function(e)
        {
            Event.stop(e);
            this.clickCounter++;
           // if(this.clickCounter > 30){ _('page').puff({duration:3}); alert("Ай ай ай!!! Сайт сломался..."); }
            if(!this.opened){  this.down(); } else  { this.up(); }
        }
            
    });



/*  Сворачиваемый блок */
E.Blind=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       button:false,
        	       element:false,
        	       buttonOffStyle:"",
        	       buttonOnStyle:"",
        	       folded:false,
        	       onUp:function(){},
        	       onDown:function(){},
        	       duration:E.animationDuration
                }, arguments[0] || { });
                
                        this.b = _(this.options.button); this.e=_(this.options.element);
                        if(typeof this.b != "object" || typeof this.e != "object" ){  throw("No elements for E.Blind"); }
                        this.b.style.cursor='pointer';
                        this.b.observe("click",this.toggle.bind(this));
                        if(this.options.folded)
                        {
                            this.toggle();
                        }
               
        },
        toggle:function(){
            if(this.e.visible())
            {
                this.up();
            }
            else
            {
                this.down();
            }
        },
        up:function(){
                new Effect.Parallel([
                          new Effect.BlindUp(this.e),
                        new Effect.Morph(this.b,{style:this.options.buttonOffStyle})
                        ], { 
                          duration: this.options.duration,
                          afterFinish:this.options.onUp.bind(this)
                        });
        },
        down:function(){
                new Effect.Parallel([
                          new Effect.BlindDown(this.e),
                        new Effect.Morph(this.b,{style:this.options.buttonOnStyle})
                        ], { 
                          duration: this.options.duration,
                          afterFinish:this.options.onDown.bind(this)
                });          
        }
});
/*  Сворачиваемый блок */
E.AjaxActiveButton=false;
E.Ajax=Class.create({
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       button:false,
        	       element:false,
        	       buttonActiveClassName:'hover',
        	       url:false,
        	       duration:E.animationDuration/1.5,
        	       effectOut:Effect.BlindUp,
        	       effectIn:Effect.BlindDown
                }, arguments[0] || { });
                this.b = _(this.options.button); this.e=_(this.options.element);
                if(typeof this.b != "object" || typeof this.e != "object" ){  throw("No elements for E.Ajax"); }
                if(typeof this.options.url != "string" ){  throw("No url for E.Ajax"); }
                
                this.b.observe("click",this.action.bind(this));
         },
         action:function(e)
         {
                Event.stop(e);
                if(E.AjaxActiveButton==this.b && this.e.visible()){ return; }
                try{ E.AjaxActiveButton.removeClassName(this.options.buttonActiveClassName); }catch(x){}
                this.b.addClassName(this.options.buttonActiveClassName);
                E.AjaxActiveButton=this.b;
            if(this.e.visible())
            {
                             this.options.effectOut(this.e,{ duration: this.options.duration, afterFinish:function(){
                            new Ajax.Updater(this.e, this.options.url, 
                            { 
                                onComplete:function(){
                                        this.options.effectIn(this.e,{ duration: this.options.duration });
                            
                                    }.bind(this)
                             });                  
                        }.bind(this) });
                        
                }
                else
                {
                            new Ajax.Updater(this.e, this.options.url, 
                            { 
                                onComplete:function(){
                                        this.options.effectIn(this.e,{ duration: this.options.duration });
                            
                                    }.bind(this)
                             });                  
                }

         }
});

E.EEs=[];
E.EEsDef=false;
E.EEsDefSt=true;
E.EE=Class.create({
        closed:true,
       	initialize: function() 
        {
                      
        	this.options = Object.extend({
        	       button:false,
        	       element:false,
        	       nav:false,
        	       noclick:false,
        	       buttonActiveClassName:'main-nav-actived'
                }, arguments[0] || { });
                
            if(this.options.button.hasClassName(this.options.buttonActiveClassName)){ E.EEsDef = this; this.options.button.removeClassName(this.options.buttonActiveClassName);}
            
            this.options.button.select('a')[0].observe("mouseover",function(e){ Event.stop(e);  window.clearTimeout(this.timer); window.clearTimeout(this.timer2); this.show();this.options.button.addClassName(this.options.buttonActiveClassName);}.bind(this));
            
            this.options.nav.select('a').each(function(el){ el.observe("mouseover",function(e){ Event.stop(e);this.options.button.addClassName(this.options.buttonActiveClassName);  window.clearTimeout(this.timer); window.clearTimeout(this.timer2);/* this.timer2 =  function(){this.options.element.show();}.bind(this).delay(1); */}.bind(this));}.bind(this));
            
            
            
          //  this.options.button.observe("mouseout",function(e){ Event.stop(e);  window.clearTimeout(this.timer); window.clearTimeout(this.timer2); /*this.timer = this.hide.bind(this).delay(0.4)*/}.bind(this));
                E.EEs.push(this);
          //   this.options.button.observe("mouseover", function(e){ Event.stop(e);  window.clearTimeout(this.timer); }.bind(this));
            
            this.options.nav.observe("mouseover", function(e){ Event.stop(e);  window.clearTimeout(this.timer); }.bind(this));
            
            this.options.element.observe("mouseover", function(e){ Event.stop(e); window.clearTimeout(this.timer);window.clearTimeout(this.timer2); }.bind(this));
            
            if(this.options.noclick)
            {
                this.options.button.select('a')[0].observe("click",function(e){
                             Event.stop(e); window.clearTimeout(this.timer); window.clearTimeout(this.timer2); if(this.closed){this.show();this.options.button.addClassName(this.options.buttonActiveClassName); }else{this.hide(); this.options.button.removeClassName(this.options.buttonActiveClassName);}
                             }.bind(this));
            
            }
            
            _(document.body).observe("mouseover", function(e){ window.clearTimeout(this.timer); window.clearTimeout(this.timer2); this.timer2 =  function(){this.options.element.hide(); this.options.button.removeClassName(this.options.buttonActiveClassName);}.bind(this).delay(0.5);  this.timer = this.hide.bind(this).delay(0.6)  }.bind(this));
            
        },
        show:function(t)
        {
           if( E.EEsDef != this){ E.EEsDefSt=false; }else{ E.EEsDefSt=true; } 
           
           E.EEs.each(function(e){e.hide();window.clearTimeout(e.timer);});
           if(this.options.noclick)
           {
           this.options.element.show();
           }
           else
           {
           if(!t){this.timer2 =  function(){this.options.element.show();}.bind(this).delay(0.5);}
          
           }
           try{ this.options.nav.show(); }catch(x){}
           
           
         //   this.options.button.addClassName(this.options.buttonActiveClassName);
          
            this.closed=false;
            
        },
        hide:function()
        {
           if( E.EEsDefSt && E.EEsDef == this ){ return; }
           this.options.element.hide();
           try{  this.options.nav.hide();}catch(x){}
         this.options.button.removeClassName(this.options.buttonActiveClassName);
            this.closed=true;
            
             (function(){ 
            var allclosed =1;
           
             for (var i = 0, length = E.EEs.length; i < length; i++)
            {
                if(!E.EEs[i].closed){allclosed = false;}
            }
            if(allclosed){
               try{ E.EEsDef.show(1);
                E.EEsDefSt=true; }catch(x){}
            }
            }.bind(this)).delay(0.01)
        }
});
