var mymenu={
arrowimages: {down:[
'downarrowclass', // 菜单右侧三角的样式
url+'js/menu/down.gif', // 右侧三角图片的路径
0 // 每个菜单项在原有宽度的基础上再增加一定的宽度
], right:[
'rightarrowclass', // 子菜单右侧三角的样式
url+'js/menu/right.gif' // 子菜单右侧三角的路径
]},
transition: {overtime:300, outtime:300},
shadow: {
enable:false, // 是否开启阴影效果
offsetx:2, // 阴影的距离
offsety:2
},
///////stop configuring beyond here///////////////////////////
detectwebkit: navigator.useragent.tolowercase().indexof("applewebkit")!=-1, //detect webkit browsers (safari, chrome etc)
detectie6: document.all && !window.xmlhttprequest,
getajaxmenu:function($, setting){ //function to fetch external page containing the panel divs
var $menucontainer=$('#'+setting.contentsource[0]) //reference empty div on page that will hold menu
$menucontainer.html("loading menu...")
$.ajax({
url: setting.contentsource[1], //path to external menu file
async: true,
error:function(ajaxrequest){
$menucontainer.html('error fetching content. server response: '+ajaxrequest.responsetext)
},
success:function(content){
$menucontainer.html(content)
mymenu.buildmenu($, setting)
}
})
},
buildmenu:function($, setting){
var smoothmenu=mymenu;
var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu ul
$mainmenu.parent().get(0).classname=setting.classname || "mymenu"
var $headers=$mainmenu.find("ul").parent()
$headers.hover(
function(e){
$(this).children('a:eq(0)').addclass('selected')
},
function(e){
$(this).children('a:eq(0)').removeclass('selected')
}
)
$headers.each(function(i){ //loop through each li header
var $curobj=$(this).css({zindex: 100-i}) //reference current li header
var $subul=$(this).find('ul:eq(0)').css({display:'block'})
this._dimensions={w:this.offsetwidth, h:this.offsetheight, subulw:$subul.outerwidth(), subulh:$subul.outerheight()}
this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header?
$subul.css({top:this.istopheader && setting.orientation!='v'? this._dimensions.h+"px" : 0})
$curobj.children("a:eq(0)").css(this.istopheader? {paddingright: smoothmenu.arrowimages.down[2]} : {}).append(
''
)
if (smoothmenu.shadow.enable){
this._shadowoffset={x:(this.istopheader?$subul.offset().left+smoothmenu.shadow.offsetx : this._dimensions.w), y:(this.istopheader? $subul.offset().top+smoothmenu.shadow.offsety : $curobj.position().top)} //store this shadow's offsets
if (this.istopheader)
$parentshadow=$(document.body)
else{
var $parentli=$curobj.parents("li:eq(0)")
$parentshadow=$parentli.get(0).$shadow
}
this.$shadow=$('