// +++ acxmenu - Author:Csaba Keszler, Homepage:https://code.google.com/p/acxmenu/
// Licensed under the MIT license:http://www.opensource.org/licenses/mit-license.php
// Modified by 3d3.com for use with IcoMoon.
if(typeof(acxmenu_himg_1)=='undefined')acxmenu_himg_1='icon-plus'; //background-position open
if(typeof(acxmenu_himg_2)=='undefined')acxmenu_himg_2='icon-minus'; //background-position close
if(typeof(acxmenu_ac)=='undefined')acxmenu_ac=0;
if(typeof(acxmenu_set)=='undefined')var acxmenu_set={'m0':{ //settings var name = menu id
'h':1, //header image: 0(false), 1(true)
'i':0, //initial expanding level
'j':1, //jump backwards: 0(false), 1(true)
'l':3, //must be set to the maximum menulevel
'm':0, //mouseover: 0(false), 1(true)
'p':0, //position: 0(vertical), 1(horizontal)
's':'slow', //speed: 'fast', 'normal', 'slow', ...
't':1 //toggle: 0(self open, else close), 1(self toggle, else close), 2(self toggle)
}};
function acxmenu(x){
if(acxmenu_ac==1)return false;
else acxmenu_ac=1;
var b=$(x),c=b.closest('.m0'),d=c[0].id,m=b.next(),n,o,p=[],q=[],r=acxmenu_set[d],i,j;
for(i=1;i<=r.l;i++){
n='#'+d+' .m'+i;
o=m.index(n);
p[i]=b.closest(n);
if(o>=0){
if(r.t===0||(r.t>0&&m.is(':hidden')))p[i]=m;
if(r.t===0||(r.t==1&&m.is(':hidden'))||(r.t==2&&m.is(':visible')))q[i]=o;
}
if(r.t<2){
q[i]=p[i].index(n);
j=q[i]>=0?':not(:eq('+q[i]+'))':'';
}
else j=':eq('+q[i]+')';
h=r.p<1?'hide':b.outerHeight();
w=r.p>0?'hide':b.outerWidth();
c.find('.m'+i+j).animate({height:'hide',width:'hide'},r.s);
imgpos(c.find('.h'+i+j),acxmenu_himg_1,acxmenu_himg_2);
if(r.p<1)h='show';else w='show';
p[i].animate({height:'show',width:'show'},r.s);
imgpos(p[i].prev(),acxmenu_himg_2,acxmenu_himg_1);
}
c.find('a').removeClass('lm');
b.addClass('lm').focus();
setTimeout(function(){acxmenu_ac=0;},333);
}
function imgpos(i,cls1,cls2){i.find('span').removeClass(cls2).addClass(cls1);}
function knav(x,e,k){
if(k==9){
k=e.shiftKey?38:40;
knav(x,e,k);
e.preventDefault();
return false;
}
var c=$(x).closest('.m0'),a=c.find('a'),d=c[0].id,i=a.index(x),l=a.length,p;
if(k>36&&k<41){
if(k<39)i=(i===0)?l-1:i-1;
else i=(i==l-1)?0:i+1;
if(acxmenu_set[d].j>0){
p=a.eq(i).closest('div[class*="m"]');
if(p.is(':hidden'))i=a.index(p.prev());
}
acxmenu('#'+d+' a:eq('+i+')');
}
if(k==13)$(x).attr('href');
}
$(function(){
for(var i in acxmenu_set){
var j,r=acxmenu_set[i],m=$('#'+i),n;
for(j=r.l;j>0;j--){
if(r.h==1)m.find('.h'+j).append("");
if(r.i0)acxmenu(this);
});
$('.himg').click(function(){
acxmenu($(this).parent());
return false;
});
});
/*
Version tag, please don't remove
$Revision: 31470 $
$HeadURL: svn://3d3-p432/ShopFactory/branches/V14_60/bin/SFXTemplates/shared_files/acxmenu20141028.js $ */