AUI().ready('aui-node','aui-overlay-context','aui-delayed-task', function(A) {
A.all('.menuB').each(function(){
var menu=this;
menu.one(".fx").setStyle('display','none');
 var genericTask = new A.DelayedTask(function(){
showMenu(menu);			
});
var instance = new A.OverlayContext({
boundingBox: menu.one('.innerMenu'),
showDelay: 0,
hideDelay: 100,
hideOn: 'mouseleave',
showOn: 'mouseenter',
trigger: menu,
on: {
hide: function(event) {
genericTask.cancel();		
menu.one(".fx").setStyle('display','none');
}},
after: {
show: function(event) {genericTask.delay(100);},
hide: function(event) {
menu.removeClass('reversed');
menu.one('span').html('Открыть меню');
}}});
function showMenu(menu){
 menu.addClass('reversed');
 menu.one('span').html('<a href="javascript:return(\'false\')">Все содержание!</a>');
 menu.one(".fx").setStyle('opacity',0);	
 menu.one(".fx").setStyle('display','block');
 menu.one(".fx").fadeIn();
}
instance.align('#home1',[A.WidgetPositionAlign.TL,A.WidgetPositionAlign.TR]);
instance.render();
});
A.one('#findIMG').on('mouseenter',function(){
taskFind.cancel();
A.one('#find').addClass('findRevers');
this.setAttribute('src','http://exxo.ru/find1.png');});
A.one('#find').on('focus',function(){
taskFind.cancel();
A.one('#findIMG').setAttribute('src','http://exxo.ru/find1.png');
A.one('#find').addClass('findRevers');
taskFind.delay(2000);
});
var taskFind = new A.DelayedTask(function(){A.one('#findIMG').setAttribute('src','http://exxo.ru/find.png');A.one('#find').removeClass('findRevers');});
A.one('#findIMG').on('mouseleave',function(){taskFind.delay(400)});

A.all('.headContent a').each(function(){
this.on('mouseenter', function(){this.addClass('hoverHead');});
this.on('mouseleave', function(){this.removeClass('hoverHead');});
});
A.all('.mainContent a').each(function(){
this.on('mouseenter', function(){this.addClass('hoverMain');});
this.on('mouseleave', function(){this.removeClass('hoverMain');});
});
A.all('.all a').each(function(){
this.on('mouseenter', function(){this.addClass('hoverAll');});
this.on('mouseleave', function(){this.removeClass('hoverAll');});
});
A.one('#home1').on('click',function(){location="http://exxo.ru/clients-main/"});
A.one('#home2').on('click',function(){location=""});
A.one('#home3').on('click',function(){location="http://exxo.ru/intranet/howto/"});
});
