
function isUndefined(variable){return(typeof variable=='undefined'||variable=="")?true:false;}
function doane(event){e=event?event:window.event;if(is_ie){e.returnValue=false;e.cancelBubble=true;}else if(e){e.stopPropagation();e.preventDefault();}}
var jsmenu=new Array();var ctrlobjclassName;jsmenu['active']=new Array();jsmenu['timers']=new Array();jsmenu['iframe']=new Array();function initCtrl(ctrlobj,click,duration,timeout,layer){if(ctrlobj&&!ctrlobj.initialized){ctrlobj.initialized=true;ctrlobj.unselectable=true;ctrlobj.outfunc=typeof ctrlobj.onmouseout=='function'?ctrlobj.onmouseout:null;ctrlobj.onmouseout=function(){if(this.outfunc)this.outfunc();if(duration<3)jsmenu['timers'][ctrlobj.id]=setTimeout('hideMenu('+layer+')',timeout);}
ctrlobj.overfunc=typeof ctrlobj.onmouseover=='function'?ctrlobj.onmouseover:null;ctrlobj.onmouseover=function(e){doane(e);if(this.overfunc)this.overfunc();if(click){clearTimeout(jsmenu['timers'][this.id]);}else{for(var id in jsmenu['timers']){if(jsmenu['timers'][id]){clearTimeout(jsmenu['timers'][id])};}}}}}
function initMenu(ctrlid,menuobj,duration,timeout,layer,drag,offset){if(menuobj&&!menuobj.initialized){menuobj.initialized=true;menuobj.ctrlkey=ctrlid;menuobj.onclick=ebygum;menuobj.style.position='absolute';if(duration<3){if(duration>1){menuobj.onmouseover=function(){clearTimeout(jsmenu['timers'][ctrlid]);}}
if(duration!=1){menuobj.onmouseout=function(){jsmenu['timers'][ctrlid]=setTimeout('hideMenu('+layer+')',timeout);}}}
if(typeof offset!="undefined"&&offset=="10")
menuobj.style.zIndex=9991;else
menuobj.style.zIndex=999;if(is_ie){menuobj.style.filter+="progid:DXImageTransform.Microsoft.shadow(direction=135,color=#CCCCCC,strength=2)";}
if(drag){menuobj.onmousedown=function(event){try{menudrag(menuobj,event,1);}catch(e){}};document.body.onmousemove=function(event){try{menudrag(menuobj,event,2);}catch(e){}};menuobj.onmouseup=function(event){try{menudrag(menuobj,event,3);}catch(e){}};}}}
var menudragstart=new Array();function menudrag(menuobj,e,op){if(op==1){if(in_array(is_ie?event.srcElement.tagName:e.target.tagName,['TEXTAREA','INPUT','BUTTON','SELECT'])){return;}
menudragstart=is_ie?[event.clientX,event.clientY]:[e.clientX,e.clientY];menudragstart[2]=parseInt(menuobj.style.left);menudragstart[3]=parseInt(menuobj.style.top);doane(e);}else if(op==2&&menudragstart[0]){var menudragnow=is_ie?[event.clientX,event.clientY]:[e.clientX,e.clientY];menuobj.style.left=(menudragstart[2]+menudragnow[0]-menudragstart[0])+'px';menuobj.style.top=(menudragstart[3]+menudragnow[1]-menudragstart[1])+'px';doane(e);}else if(op==3){menudragstart=[];doane(e);}}
function showMenu(ctrlid,click,offset,duration,timeout,layer,showid,maxh,drag){if(is_ie&&document.readyState!="complete"){return;}
if($("statusbar_autotip_img")&&$("tabId5_menu")){autoclose_show_statusbar_tip(1);}
var ctrlobj=$(ctrlid);if(!ctrlobj){return;}
if(isUndefined(click))click=false;if(isUndefined(offset))offset=0;if(isUndefined(duration))duration=2;if(isUndefined(timeout))timeout=500;if(isUndefined(layer))layer=0;if(isUndefined(showid))showid=ctrlid;var showobj=$(ctrlid);var menuobj=$(showid+'_menu');if(!showobj||!menuobj)return;if(isUndefined(maxh))maxh=500;if(isUndefined(drag))drag=false;if(drag)menuobj.style.cursor="move";if(click&&jsmenu['active'][layer]==menuobj){hideMenu(layer);return;}else{hideMenu(layer);}
var len=jsmenu['timers'].length;if(len>0){for(var i=0;i<len;i++){if(jsmenu['timers'][i])clearTimeout(jsmenu['timers'][i]);}}
initCtrl(ctrlobj,click,duration,timeout,layer);ctrlobjclassName=ctrlobj.className;ctrlobj.className+=' hover';initMenu(ctrlid,menuobj,duration,timeout,layer,drag,offset);menuobj.style.display='';if(!is_opera){menuobj.style.clip='rect(auto, auto, auto, auto)';}
setMenuPosition(ctrlid,showid,offset);if(is_ie&&is_ie<7){if(!jsmenu['iframe'][layer]){var iframe=document.createElement('iframe');iframe.style.display='none';iframe.style.position='absolute';iframe.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';$('append_parent')?$('append_parent').appendChild(iframe):menuobj.parentNode.appendChild(iframe);jsmenu['iframe'][layer]=iframe;}
jsmenu['iframe'][layer].style.top=menuobj.style.top;jsmenu['iframe'][layer].style.left=menuobj.style.left;jsmenu['iframe'][layer].style.width=menuobj.w;jsmenu['iframe'][layer].style.height=menuobj.h;jsmenu['iframe'][layer].style.display='block';}
if(maxh&&menuobj.scrollHeight>maxh){menuobj.style.height=maxh+'px';if(is_opera){menuobj.style.overflow='auto';}else{menuobj.style.overflowY='auto';}}
if(!duration){setTimeout('hideMenu('+layer+')',timeout);}
jsmenu['active'][layer]=menuobj;}
function setMenuPosition(ctrlid,showid,offset){var showobj=$(ctrlid);var menuobj=$(showid+'_menu');if(isUndefined(offset))offset=0;if(showobj){showobj.pos=fetchOffset(showobj);if((showid=="endTime"||showid=="sortArea_fkplay")&&typeof leftExcursion_modiTime!="undefined"&&is_ie&&is_ie<7){showobj.X=showobj.pos['left']-leftExcursion_modiTime;showobj.Y=showobj.pos['top']-topExcursion_modiTime;}else{showobj.X=showobj.pos['left'];showobj.Y=showobj.pos['top'];}
showobj.w=showobj.offsetWidth;showobj.h=showobj.offsetHeight;menuobj.pos=fetchOffset(menuobj);menuobj.w=menuobj.offsetWidth;menuobj.h=menuobj.offsetHeight;if(offset!=-1){if(offset==3){menuobj.style.left=(showobj.X+menuobj.w>document.body.clientWidth)&&(showobj.X+showobj.w-menuobj.w>=0)?showobj.X+showobj.w-menuobj.w+'px':showobj.X+'px';menuobj.pos=fetchOffset(menuobj);menuobj.X=menuobj.pos['left'];menuobj.Y=menuobj.pos['top'];menuobj.style.left=showobj.X+showobj.w-menuobj.w+'px';menuobj.style.bottom=30+"px";}else if(offset==4){menuobj.style.left=(showobj.X+menuobj.w>document.body.clientWidth)&&(showobj.X+showobj.w-menuobj.w>=0)?showobj.X+showobj.w-menuobj.w+'px':showobj.X+'px';menuobj.pos=fetchOffset(menuobj);menuobj.X=menuobj.pos['left'];menuobj.Y=menuobj.pos['top'];showobj_parent=showobj.parentNode;showobj_parent.pos=fetchOffset(showobj_parent);showobj_parent.X=showobj_parent.pos['left'];showobj_parent.Y=showobj_parent.pos['top'];menuobj.style.top=showobj_parent.Y-menuobj.h+((is_ie&&is_ie<7)?document.documentElement.scrollTop:(document.documentElement.scrollTop||document.body.scrollTop))+1+'px';}else if(offset==5){menuobj.style.left=(showobj.X+menuobj.w>document.body.clientWidth)&&(showobj.X+showobj.w-menuobj.w>=0)?showobj.X+showobj.w-menuobj.w+'px':showobj.X+'px';menuobj.pos=fetchOffset(menuobj);menuobj.X=menuobj.pos['left'];menuobj.Y=menuobj.pos['top'];menuobj.style.left=showobj.X+showobj.w-menuobj.w+'px';menuobj.style.top=showobj.Y+showobj.h-document.body.scrollTop+'px';}else if(offset==6){menuobj.style.left=(showobj.X+menuobj.w>document.body.clientWidth)&&(showobj.X+showobj.w-menuobj.w>=0)?showobj.X+showobj.w-menuobj.w+'px':showobj.X+'px';menuobj.style.top=(showobj.Y+showobj.h+menuobj.h>document.body.scrollTop+document.documentElement.scrollTop+document.documentElement.clientHeight)?(showobj.Y-menuobj.h-document.body.scrollTop)+'px':showobj.Y+showobj.h-document.body.scrollTop+'px'}else if(offset==8){var o=menuobj;var x=y=0;while((o=o.parentNode)&&(o.tagName!='BODY')){x+=o.scrollLeft;y+=o.scrollTop;}
menuobj.style.left=((showobj.X+menuobj.w>document.body.clientWidth)&&(showobj.X+showobj.w-menuobj.w>=0)?showobj.X+showobj.w-menuobj.w:showobj.X)-x+'px';menuobj.style.top=(((showobj.Y+showobj.h+menuobj.h>document.documentElement.scrollTop+document.documentElement.clientHeight)&&(showobj.Y-menuobj.h>=0))?(showobj.Y-menuobj.h-document.body.scrollTop):showobj.Y+showobj.h-document.body.scrollTop)-y+'px';}else if(offset==9){menuobj.style.left=(showobj.X+menuobj.w>document.body.clientWidth)&&(showobj.X+showobj.w-menuobj.w>=0)?showobj.X+showobj.w-menuobj.w+'px':showobj.X+'px';menuobj.style.top=((showobj.Y+showobj.h+menuobj.h>document.documentElement.scrollTop+document.documentElement.clientHeight)&&(showobj.Y-menuobj.h>=0)?(showobj.Y-menuobj.h):showobj.Y+showobj.h-document.body.scrollTop)-menuobj.h-showobj.h+'px';}else if(offset==10){if(is_ie&&is_ie<7){menuobj.style.left=showobj.X+showobj.w-menuobj.w+6+'px';menuobj.style.bottom="34px";}else{menuobj.style.left=showobj.X+showobj.w-menuobj.w+2+'px';menuobj.style.bottom=34-document.documentElement.scrollTop+"px";}}else if(offset==11){menuobj.style.left=(showobj.X+menuobj.w>document.body.clientWidth)&&(showobj.X+showobj.w-menuobj.w>=0)?showobj.X+showobj.w-menuobj.w+'px':showobj.X+'px';if(is_ie&&is_ie<7){var scrollTop_value=document.body.scrollTop;menuobj.style.top=offset==1?showobj.Y-scrollTop_value+30+'px':(offset==2||((showobj.Y+showobj.h+menuobj.h>scrollTop_value+document.documentElement.clientHeight)&&(showobj.Y-menuobj.h>=0))?(showobj.Y-menuobj.h)+'px':showobj.Y+showobj.h-scrollTop_value+'px');}else{menuobj.style.top=offset==1?showobj.Y-document.body.scrollTop+30+'px':(offset==2||((showobj.Y+showobj.h+menuobj.h>document.documentElement.scrollTop+document.documentElement.clientHeight)&&(showobj.Y-menuobj.h>=0))?(showobj.Y-menuobj.h)+'px':showobj.Y+showobj.h-document.body.scrollTop+'px');}}else{menuobj.style.left=(showobj.X+menuobj.w>document.body.clientWidth)&&(showobj.X+showobj.w-menuobj.w>=0)?showobj.X+showobj.w-menuobj.w+'px':showobj.X+'px';menuobj.style.top=offset==1?showobj.Y-document.body.scrollTop+30+'px':(offset==2||((showobj.Y+showobj.h+menuobj.h>document.documentElement.scrollTop+document.documentElement.clientHeight)&&(showobj.Y-menuobj.h>=0))?(showobj.Y-menuobj.h)+'px':showobj.Y+showobj.h-document.body.scrollTop+'px');}}else if(offset==-1){menuobj.style.left=(document.body.clientWidth-menuobj.w)/2+'px';var divtop=document.documentElement.scrollTop+(document.documentElement.clientHeight-menuobj.h)/2;if(divtop>100)divtop=divtop-100;menuobj.style.top=divtop+'px';}
if(menuobj.style.clip&&!is_opera){menuobj.style.clip='rect(auto, auto, auto, auto)';}}}
function hideMenu(layer){if(isUndefined(layer))layer=0;if(jsmenu['active'][layer]){try{$(jsmenu['active'][layer].ctrlkey).className=ctrlobjclassName;}catch(e){}
clearTimeout(jsmenu['timers'][jsmenu['active'][layer].ctrlkey]);jsmenu['active'][layer].style.display='none';if(is_ie&&is_ie<7&&jsmenu['iframe'][layer]){jsmenu['iframe'][layer].style.display='none';}
jsmenu['active'][layer]=null;}}
function ebygum(eventobj){if(!eventobj||is_ie){window.event.cancelBubble=true;return window.event;}else{if(eventobj.target.type=='submit'){eventobj.target.form.submit();}
eventobj.stopPropagation();return eventobj;}}