(function () {
	var A={
		maxTabs:5,init:function () {
			var C=document.getElementById("id-home-tasks"),D=[],G=0,B=[],F,E=document.getElementById("id-home-task-nav");
			for(G=0;G<A.maxTabs;G++) {
				F=document.getElementById("id-tab-content-"+G);
				if(F!==null) {
					B[B.length]=F
				}
			}A.tabs=E.getElementsByTagName("li");
			for(G=0;G<A.tabs.length;G++) {
				if(G===0) {
					A.tabs.item(G).isFirst=true
				}else {
					if(G===(A.tabs.length-1)) {
						A.tabs.item(G).isLast=true
					}
				}
			}for(G=0;G<B.length;G++) {
				if(B[G].nodeName.toLowerCase()==="div") {
					D[D.length]=B[G]
				}
			}for(G=1;G<D.length;G++) {
				D[G].style.display="none"
			}B=jQuery("div.id-tab-content-submenu",C).get();
			for(G=0;G<B.length;G++) {
				A.setMenuStyles(B[G])
			}
		},setMenuStyles:function () {
			if(arguments.length<1) {
				return
			}var B=arguments[0];
			B.style.backgroundColor="#FFFFFF";
			B.style.border="#CCC solid 1px";
			B.style.display="none";
			B.style.position="absolute";
			B.style.width="208px";
			B.style.zIndex="9"
		},deactivateAll:function () {
			var D=document.getElementById("id-home-tasks"),E,F;
			if(D===null) {
				return
			}var C=jQuery("div.id-active",D).get();
			var B=C.length;
			for(E=0;E<B;E++) {
				F=C[E];
				idCommon.deleteClassName(F,"id-active");
				if(F.nodeName.toLowerCase()==="div") {
					F.style.display="none"
				}
			}B=A.tabs.length;
			for(E=0;E<B;E++) {
				F=A.tabs[E];
				if(F.isFirst) {
					F.className="id-first-tab"
				}else {
					if(F.isLast) {
						F.className="id-last-tab"
					}else {
						F.className=""
					}
				}
			}
		},focusContent:function (G) {
			var E=document.getElementById(G);
			var C=jQuery("a.id-access",E).get();
			var B=C.length;
			for(var D=0;D<B;D++) {
				var F=C[D];
				if(F.nodeName.toLowerCase()==="a") {
					F.focus();
					return
				}
			}
		},setActive:function (D,F) {
			var C=null,E="",B=D.parentNode;
			A.deactivateAll();
			E=B.nodeName.toLowerCase();
			while(E!=="li"&&E!=="body"&&E!=="html") {
				B=B.parentNode
			}if(B.isFirst) {
				B.className="id-active-first-tab"
			}else {
				if(B.isLast) {
					B.className="id-active-last-tab"
				}else {
					B.className="id-active"
				}
			}A.setActivePrevious(B);
			A.setActiveNext(B);
			C=document.getElementById(F);
			C.className+=" id-active";
			C.style.display="block";
			A.focusContent(F)
		},setActiveNext:function (C) {
			var B=A.getNextTab(C);
			if(B===null) {
				return
			}if(B.isLast) {
				B.className="id-active-next-last-tab"
			}else {
				B.className="id-active-next-tab"
			}
		},setActivePrevious:function (C) {
			var B=A.getPreviousTab(C);
			if(B===null) {
				return
			}if(B.isFirst) {
				B.className="id-active-first-previous-tab"
			}else {
				B.className="id-active-previous-tab"
			}
		},delay:400,delayedSetActive:function (B,C) {
			B._timerId=window.setTimeout(function () {
				A.setActive(B,C)
			},A.delay)
		},cancelSetActive:function (B) {
			if(B._timerId) {
				window.clearTimeout(B._timerId)
			}B._timerId=null
		},delayedHideHPT:function (C) {
			if(!idCommon.isDOM) {
				return
			}var B=document.getElementById(C);
			if(B===null) {
				return
			}B._timerId=window.setTimeout(function () {
				A.hideHPT(C)
			},A.delay)
		},getNextTab:function (C) {
			if(typeof C.nextSibling==="undefined") {
				return null
			}var B=C.nextSibling;
			while(B!==null) {
				if(B.nodeName.toLowerCase()==="li") {
					return B
				}B=B.nextSibling
			}return null
		},getPreviousTab:function (C) {
			if(typeof C.previousSibling==="undefined") {
				return null
			}var B=C.previousSibling;
			while(B!==null) {
				if(B.nodeName.toLowerCase()==="li") {
					return B
				}B=B.previousSibling
			}return null
		},getX:function (C) {
			var B=0;
			if(C.offsetParent) {
				while(C.offsetParent) {
					B+=C.offsetLeft;
					C=C.offsetParent
				}
			}else {
				if(C.x) {
					B+=C.x
				}
			}return B
		},getY:function (B) {
			var C=0;
			if(B.offsetParent) {
				while(B.offsetParent) {
					C+=B.offsetTop;
					B=B.offsetParent
				}
			}else {
				if(B.y) {
					C+=B.y
				}
			}return C
		},hideAllHPT:function () {
			if(A.hptCache===null) {
				A.hptCache=jQuery("div.id-tab-content-submenu",document.documentElement).get()
			}for(var B=0;B<A.hptCache.length;B++) {
				A.delayedHideHPT(A.hptCache[B].id)
			}
		},hideHPT:function (C) {
			if(!idCommon.isDOM) {
				return
			}var B=document.getElementById(C);
			if(B===null) {
				return
			}B.style.display="none";
			if(B._timerId) {
				B._timerId=null
			}
		},setPosition:function (D) {
			if(!D._triggerId) {
				return
			}var C=document.getElementById(D._triggerId);
			var B=A.getX(C);
			var E=A.getY(C);
			D.style.top=(E-D.offsetHeight+18)+"px";
			D.style.left=(B+C.offsetWidth)+"px"
		},showHPT:function (B,E) {
			if(!idCommon.isDOM) {
				return
			}var D=document.getElementById(E);
			if(D===null) {
				return
			}var C=D.getElementsByTagName("a");
			if(C.length<1) {
				window.location=B.getAttribute("href");
				return
			}if(D._timerId) {
				window.clearTimeout(D._timerId);
				D._timerId=null
			}if(B!==null) {
				if(!B.id||B.id===""||B.id===null) {
					B.id=idCommon.generateId()
				}D._triggerId=B.id
			}D.style.display="block";
			A.setPosition(D)
		},hptCache:null,hideSubmenuMarker:function () {
			var D=document.getElementById("id-interest-dd1");
			if(D===null) {
				return
			}var C=D.getElementsByTagName("a");
			if(C.length>0) {
				return
			}var B=document.getElementById("id-interest-dd1-trigger");
			B.className=B.className.replace(/id-tab-content-submenu-trigger/,"")
		},cancelDelayedHideHPT:function (C) {
			if(!idCommon.isDOM) {
				return
			}var B=document.getElementById(C);
			if(B&&B._timerId) {
				window.clearTimeout(B._timerId)
			}
		},showAccountsTab:function () {
			var E,B,C,D;
			if(typeof window.SA_Message!=="string") {
				return
			}E=window.SA_Message.replace(/audience=/,"");
			if(E.indexOf("all")!==0&&E.indexOf("ibm")!==0) {
				C=document.getElementById("id-home-tab-my-ibm");
				if(C===null) {
					return
				}B=C.getElementsByTagName("a");
				if(B.length<1) {
					return
				}D=B.item(0);
				A.setActive(D,"id-tab-content-3")
			}
		}
	};
	window.HomePageTabs=A;
	window.HomePageTabs=A
})();
