var ua=navigator.userAgent;var opera=/opera [56789]|opera\/[56789]/i.test(ua);var ie=!opera&&/MSIE/.test(ua);var ie50=ie&&/MSIE 5\.[01234]/.test(ua);var ie6=ie&&/MSIE [6789]/.test(ua);var ieBox=ie&&(document.compatMode==null||document.compatMode!="CSS1Compat");var moz=!opera&&/gecko/i.test(ua);var nn6=!opera&&/netscape.*6\./i.test(ua);webfxMenuDefaultWidth=150;webfxMenuDefaultBorderLeft=1;webfxMenuDefaultBorderRight=1;webfxMenuDefaultBorderTop=1;webfxMenuDefaultBorderBottom=1;webfxMenuDefaultPaddingLeft=1;webfxMenuDefaultPaddingRight=1;webfxMenuDefaultPaddingTop=1;webfxMenuDefaultPaddingBottom=1;webfxMenuDefaultShadowLeft=0;webfxMenuDefaultShadowRight=ie&&!ie50&&/win32/i.test(navigator.platform)?4:0;webfxMenuDefaultShadowTop=0;webfxMenuDefaultShadowBottom=ie&&!ie50&&/win32/i.test(navigator.platform)?4:0;webfxMenuItemDefaultHeight=18;webfxMenuItemDefaultText="Untitled";webfxMenuItemDefaultHref="javascript:void(0)";webfxMenuSeparatorDefaultHeight=6;webfxMenuDefaultEmptyText="Empty";webfxMenuDefaultUseAutoPosition=nn6?false:true;webfxMenuImagePath="";webfxMenuUseHover=opera?true:false;webfxMenuHideTime=500;webfxMenuShowTime=200;var webFXMenuHandler={idCounter:0,idPrefix:"webfx-menu-object-",all:{},getId:function(){return this.idPrefix+this.idCounter++},overMenuItem:function(b){if(this.showTimeout!=null){window.clearTimeout(this.showTimeout)}if(this.hideTimeout!=null){window.clearTimeout(this.hideTimeout)}var a=this.all[b.id];if(webfxMenuShowTime<=0){this._over(a)}else{this.showTimeout=window.setTimeout("webFXMenuHandler._over(webFXMenuHandler.all['"+a.id+"'])",webfxMenuShowTime)}},insertHTMLAferEnd:function(a,c){if(a.insertAdjacentHTML!=null){a.insertAdjacentHTML("AfterEnd",c);return}var d;var b=a.ownerDocument.createRange();b.selectNodeContents(a);b.collapse(false);d=b.createContextualFragment(c);a.parentNode.insertBefore(d,a.nextSibling)},outMenuItem:function(b){if(this.showTimeout!=null){window.clearTimeout(this.showTimeout)}if(this.hideTimeout!=null){window.clearTimeout(this.hideTimeout)}var a=this.all[b.id];if(webfxMenuHideTime<=0){this._out(a)}else{this.hideTimeout=window.setTimeout("webFXMenuHandler._out(webFXMenuHandler.all['"+a.id+"'])",webfxMenuHideTime)}},blurMenu:function(a){window.setTimeout('webFXMenuHandler.all["'+a.id+'"].subMenu.hide();',webfxMenuHideTime)},_over:function(a){if(a.subMenu){a.parentMenu.hideAllSubs();a.subMenu.show()}else{a.parentMenu.hideAllSubs()}},_out:function(c){var b=c;var a;if(b instanceof WebFXMenuButton){a=b.subMenu}else{a=c.parentMenu;while(a.parentMenu!=null&&!(a.parentMenu instanceof WebFXMenuBar)){a=a.parentMenu}}if(a!=null&&!(a instanceof WebFXMenuBar)){a.hide()}},hideMenu:function(a){if(this.showTimeout!=null){window.clearTimeout(this.showTimeout)}if(this.hideTimeout!=null){window.clearTimeout(this.hideTimeout)}this.hideTimeout=window.setTimeout("webFXMenuHandler.all['"+a.id+"'].hide()",webfxMenuHideTime)},showMenu:function(c,b,a){if(this.showTimeout!=null){window.clearTimeout(this.showTimeout)}if(this.hideTimeout!=null){window.clearTimeout(this.hideTimeout)}if(arguments.length<3){a="vertical"}c.show(b,a)},extend:function(proto,obj){for(var property in obj){if(obj.hasOwnProperty(property)&&property!=="prototype"){proto[property]=obj[property]}}
/*@cc_on 
	     if(obj.toString!={}.toString){
	    		proto.toString = obj.toString;
	   }@*/
},click:function(e){var b=this.all[e.id],a;if(!b){return}var d,c=b.parentMenu._menuItems;for(d=0;d<c.length;d++){a=c[d];if(!a instanceof WebFXMenuCheckBox){continue}if(b==a){a.setSelected(true)}else{a.setSelected(false)}}webFXMenuHandler._out(b)}};function WebFXMenu(){this._menuItems=[];this._subMenus=[];this.id=webFXMenuHandler.getId();this.top=0;this.left=0;this.shown=false;this.parentMenu=null;webFXMenuHandler.all[this.id]=this}webFXMenuHandler.extend(WebFXMenu.prototype,{width:webfxMenuDefaultWidth,emptyText:webfxMenuDefaultEmptyText,useAutoPosition:webfxMenuDefaultUseAutoPosition,borderLeft:webfxMenuDefaultBorderLeft,borderRight:webfxMenuDefaultBorderRight,borderTop:webfxMenuDefaultBorderTop,borderBottom:webfxMenuDefaultBorderBottom,paddingLeft:webfxMenuDefaultPaddingLeft,paddingRight:webfxMenuDefaultPaddingRight,paddingTop:webfxMenuDefaultPaddingTop,paddingBottom:webfxMenuDefaultPaddingBottom,shadowLeft:webfxMenuDefaultShadowLeft,shadowRight:webfxMenuDefaultShadowRight,shadowTop:webfxMenuDefaultShadowTop,shadowBottom:webfxMenuDefaultShadowBottom,rendered:false,isRendered:function(){return(this.rendered&&document.getElementById(this.id))},add:function(a){this._menuItems[this._menuItems.length]=a;if(a.subMenu){this._subMenus[this._subMenus.length]=a.subMenu;a.subMenu.parentMenu=this}a.parentMenu=this;if(this.replace&&this.isRendered()){this.replace()}},show:function(c,b){if(this.useAutoPosition){this.position(c,b)}var a=document.getElementById(this.id);a.style.left=opera?this.left:this.left+"px";a.style.top=opera?this.top:this.top+"px";a.style.visibility="visible";this.shown=true;if(this.parentMenu){this.parentMenu.show()}},hide:function(){this.hideAllSubs();var a=document.getElementById(this.id);a.style.visibility="hidden";this.shown=false},hideAllSubs:function(){for(var a=0;a<this._subMenus.length;a++){if(this._subMenus[a].shown){this._subMenus[a].hide()}}},toString:function(){var b="<div id='"+this.id+"' class='webfx-menu' style='width:"+(!ieBox?this.width-this.borderLeft-this.paddingLeft-this.borderRight-this.paddingRight:this.width)+"px;"+(this.useAutoPosition?"left:"+this.left+"px;top:"+this.top+"px;":"")+(ie50?"filter: none;":"")+"'>";b+=this.toInnerHTML();b+="</div>";for(var a=0;a<this._subMenus.length;a++){this._subMenus[a].left=this.left+this.width-this._subMenus[a].borderLeft;b+=this._subMenus[a]}this.rendered=true;return b},toInnerHTML:function(){var c=this.top+this.borderTop+this.paddingTop;var d="";if(this._menuItems.length==0){d+="<span class='webfx-menu-empty'>"+this.emptyText+"</span>"}else{for(var b=0;b<this._menuItems.length;b++){var a=this._menuItems[b];d+=a;if(!this.useAutoPosition){if(a.subMenu&&!a.subMenu.useAutoPosition){a.subMenu.top=c-a.subMenu.borderTop-a.subMenu.paddingTop}c+=a.height}}}return d},position:function(g,d){var b=d,e,o=this;if(!g){var f=o.parentMenuItem;if(!o.parentMenuItem){return}g=document.getElementById(f.id);if(b==null){b=f instanceof WebFXMenuButton?"vertical":"horizontal"}e=getOuterRect(g)}else{if(g.left!=null&&g.top!=null&&g.width!=null&&g.height!=null){e=g}else{e=getOuterRect(g)}}var j=document.getElementById(o.id);var n=getOuterRect(j);var i=getDocumentRect();var a=getScrollPos();var m=o.parentMenu;if(b=="vertical"){if(e.left+n.width-a.left<=i.width){o.left=e.left}else{if(i.width>=n.width){o.left=i.width+a.left-n.width}else{o.left=a.left}}if(e.top+e.height+n.height<=i.height+a.top){o.top=e.top+e.height}else{if(e.top-n.height>=a.top){o.top=e.top-n.height}else{if(i.height>=n.height){o.top=i.height+a.top-n.height}else{o.top=a.top}}}}else{if(e.top+n.height-o.borderTop-o.paddingTop<=i.height+a.top){o.top=e.top-o.borderTop-o.paddingTop}else{if(e.top+e.height-n.height+o.borderTop+o.paddingTop>=0){o.top=e.top+e.height-n.height+o.borderBottom+o.paddingBottom+o.shadowBottom}else{if(i.height>=n.height){o.top=i.height+a.top-n.height}else{o.top=a.top}}}var l=m?m.paddingLeft:0;var h=m?m.borderLeft:0;var k=m?m.paddingRight:0;var c=m?m.borderRight:0;if(e.left+e.width+n.width+k+c-o.borderLeft+o.shadowRight<=i.width+a.left){o.left=e.left+e.width+k+c-o.borderLeft}else{if(e.left-n.width-l-h+o.borderRight+o.shadowRight>=0){o.left=e.left-n.width-l-h+o.borderRight+o.shadowRight}else{if(i.width>=n.width){o.left=i.width+a.left-n.width}else{o.left=a.left}}}}}});function WebFXMenuItem(c,d,b,a){this.text=c||webfxMenuItemDefaultText;this.href=(d==null||d=="")?webfxMenuItemDefaultHref:d;this.subMenu=a;if(a){a.parentMenuItem=this}this.toolTip=b;this.id=webFXMenuHandler.getId();webFXMenuHandler.all[this.id]=this}webFXMenuHandler.extend(WebFXMenuItem.prototype,{height:webfxMenuItemDefaultHeight,toString:function(){return"<a id='"+this.id+"' href=\""+this.href+'"'+(this.target?' target="'+this.target+'"':"")+(this.toolTip?' title="'+this.toolTip+'"':"")+(this.styleClass?'class="'+this.styleClass+'"':"")+" onmouseover='webFXMenuHandler.overMenuItem(this)'"+(webfxMenuUseHover?" onmouseout='webFXMenuHandler.outMenuItem(this)'":"")+(this.subMenu?" unselectable='on' tabindex='-1' onblur='webFXMenuHandler.blurMenu(this)' onfocus='webFXMenuHandler.overMenuItem(this)' ":"")+">"+this.getText()+"</a> "
},getText:function(){return(this.subMenu?" ":"")+this.text},setText:function(b){this.text=b;var a=byId(this.id);a.innerHTML=this.getText()}});function WebFXMenuSeparator(){this.id=webFXMenuHandler.getId();webFXMenuHandler.all[this.id]=this}WebFXMenuSeparator.prototype.height=webfxMenuSeparatorDefaultHeight;WebFXMenuSeparator.prototype.toString=function(){this.rendered=true;return"<div id='"+this.id+"'"+(webfxMenuUseHover?" onmouseover='webFXMenuHandler.overMenuItem(this)' onmouseout='webFXMenuHandler.outMenuItem(this)'":"")+"></div>"};function WebFXMenuBar(){this._parentConstructor=WebFXMenu;this._parentConstructor()}WebFXMenuBar.prototype=new WebFXMenu;webFXMenuHandler.extend(WebFXMenuBar.prototype,{toString:function(){var b="<div id='"+this.id+"' class='webfx-menu-bar'>";b+=this.toInnerHTML();b+="</div>";for(var a=0;a<this._subMenus.length;a++){b+=this._subMenus[a]}this.rendered=true;return b},toInnerHTML:function(){var b="";for(var a=0;a<this._menuItems.length;a++){b+=this._menuItems[a]}return b},replace:function(){var b=document.getElementById(this.id);b.innerHTML=this.toInnerHTML();for(var a=0;a<this._subMenus.length;a++){if(!this._subMenus[a].isRendered()){webFXMenuHandler.insertHTMLAferEnd(b,this._subMenus[a])}}this.rendered=true}});function WebFXMenuButton(c,d,b,a){this._parentConstructor=WebFXMenuItem;this._parentConstructor(c,d,b,a)}WebFXMenuButton.prototype=new WebFXMenuItem;function WebFXMenuCheckBox(b,d,a,c){this._parentConstructor=WebFXMenuItem;this._parentConstructor(b,d,a);this.selected=c}WebFXMenuCheckBox.prototype=new WebFXMenuItem;webFXMenuHandler.extend(WebFXMenuCheckBox.prototype,{selected:false,setSelected:function(b){this.selected=b;var a=document.getElementById(this.id);if(b){ts_addclass(a,"selected");this.parentMenu.parentMenuItem.setText(this.getText())}else{ts_removeClass(a,"selected")}},toString:function(){return"<a id='"+this.id+"' href=\""+this.href+'"'+(this.target?' target="'+this.target+'"':"")+(this.toolTip?' title="'+this.toolTip+'"':"")+(this.styleClass||this.selected?' class="'+this.styleClass+(this.selected?" selected":"")+'"':"")+(webfxMenuUseHover?(" onmouseover='webFXMenuHandler.overMenuItem(this)' onmouseout='webFXMenuHandler.outMenuItem(this)'"):(" onfocus='webFXMenuHandler.overMenuItem(this)'"+(this.subMenu?" onblur='webFXMenuHandler.blurMenu(this)'":"")))+" onclick='webFXMenuHandler.click(this)'>"+this.text+"</a> "},click:function(){webFXMenuHandler.click(document.getElementById(this.id))}});function getInnerLeft(a){if(a==null){return 0}if(ieBox&&a==document.body||!ieBox&&a==document.documentElement){return 0}return getLeft(a)+getBorderLeft(a)}function getLeft(a){if(a==null){return 0}return a.offsetLeft+getInnerLeft(a.offsetParent)}function getInnerTop(a){if(a==null){return 0}if(ieBox&&a==document.body||!ieBox&&a==document.documentElement){return 0}return getTop(a)+getBorderTop(a)}function getTop(a){if(a==null){return 0}return a.offsetTop+getInnerTop(a.offsetParent)}function getBorderLeft(a){return ie?a.clientLeft:parseInt(window.getComputedStyle(a,null).getPropertyValue("border-left-width"))}function getBorderTop(a){return ie?a.clientTop:parseInt(window.getComputedStyle(a,null).getPropertyValue("border-top-width"))}function opera_getLeft(a){if(a==null){return 0}return a.offsetLeft+opera_getLeft(a.offsetParent)}function opera_getTop(a){if(a==null){return 0}return a.offsetTop+opera_getTop(a.offsetParent)}function getOuterRect(a){return{left:(opera?opera_getLeft(a):getLeft(a)),top:(opera?opera_getTop(a):getTop(a)),width:a.offsetWidth,height:a.offsetHeight}}function getDocumentRect(a){return{left:0,top:0,width:(ie?(ieBox?document.body.clientWidth:document.documentElement.clientWidth):window.innerWidth),height:(ie?(ieBox?document.body.clientHeight:document.documentElement.clientHeight):window.innerHeight)}}function getScrollPos(a){return{left:(ie?(ieBox?document.body.scrollLeft:document.documentElement.scrollLeft):window.pageXOffset),top:(ie?(ieBox?document.body.scrollTop:document.documentElement.scrollTop):window.pageYOffset)}};
