-Ext.onReady(function(){\r
-\r
- var activeMenu;\r
-\r
- function createMenu(name){\r
- var el = Ext.get(name+'-link');\r
- var tid = 0, menu, doc = Ext.getDoc();\r
-\r
- var handleOver = function(e, t){\r
- if(t != el.dom && t != menu.dom && !e.within(el) && !e.within(menu)){\r
- hideMenu();\r
- }\r
- };\r
-\r
- var hideMenu = function(){\r
- if(menu){\r
- menu.hide();\r
- el.setStyle('text-decoration', '');\r
- doc.un('mouseover', handleOver);\r
- doc.un('mousedown', handleDown);\r
- }\r
- };\r
-\r
- var handleDown = function(e){\r
- if(!e.within(menu)){\r
- hideMenu();\r
- }\r
- };\r
-\r
- var showMenu = function(){\r
- clearTimeout(tid);\r
- tid = 0;\r
-\r
- if (!menu) {\r
- menu = new Ext.Layer({shadow:'sides',hideMode: 'display'}, name+'-menu');\r
- }\r
- menu.hideMenu = hideMenu;\r
-\r
- menu.el = el;\r
- if(activeMenu && menu != activeMenu){\r
- activeMenu.hideMenu();\r
- }\r
- activeMenu = menu;\r
-\r
- if (!menu.isVisible()) {\r
- menu.show();\r
- menu.alignTo(el, 'tl-bl?');\r
- menu.sync();\r
- el.setStyle('text-decoration', 'underline');\r
-\r
- doc.on('mouseover', handleOver, null, {buffer:150});\r
- doc.on('mousedown', handleDown);\r
- }\r
- };\r
-\r
- el.on('mouseover', function(e){\r
- if(!tid){\r
- tid = showMenu.defer(150);\r
- }\r
- });\r
-\r
- el.on('mouseout', function(e){\r
- if(tid && !e.within(el, true)){\r
- clearTimeout(tid);\r
- tid = 0;\r
- }\r
- });\r
- }\r
-\r
- createMenu('products');\r
- createMenu('support');\r
- createMenu('store');\r
-\r
- // expanders\r
- Ext.getBody().on('click', function(e, t){\r
- t = Ext.get(t);\r
- e.stopEvent();\r
-\r
- var bd = t.next('div.expandable-body');\r
- bd.enableDisplayMode();\r
- var bdi = bd.first();\r
- var expanded = bd.isVisible();\r
-\r
- if(expanded){\r
- bd.hide();\r
- }else{\r
- bdi.hide();\r
- bd.show();\r
- bdi.slideIn('l', {duration:0.2, stopFx: true, easing:'easeOut'});\r
- }\r
-\r
- t.update(!expanded ? 'Hide details' : 'Show details');\r
-\r
- }, null, {delegate:'a.expander'});\r
-});\r
+Ext.onReady(function(){
+ // expanders
+ Ext.getBody().on('click', function(e, t){
+ t = Ext.get(t);
+ e.stopEvent();
+
+ var bd = t.next('div.expandable-body');
+ bd.enableDisplayMode();
+ var bdi = bd.first();
+ var expanded = bd.isVisible();
+
+ if(expanded){
+ bd.hide();
+ }else{
+ bdi.hide();
+ bd.show();
+ bdi.slideIn('l', {duration:0.2, stopFx: true, easing:'easeOut'});
+ }
+
+ t.update(!expanded ? 'Hide details' : 'Show details');
+
+ }, null, {delegate:'a.expander'});
+});