/* $Id$
* Copyright (c) 2011 IBM Corporation
* Owner: Corporate Webmaster (NUS_N_NIWWW)
*/

dojo._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","ibmweb.homepage"],["provide","ibmweb.homepage.expandsection"],["require","dojo.fx"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["ibmweb.homepage"]){_4._hasResource["ibmweb.homepage"]=true;_4.provide("ibmweb.homepage");_4.provide("ibmweb.homepage.expandsection");_4.require("dojo.fx");ibmweb.homepage={};ibmweb.homepage.leadspaceRibbon=null;ibmweb.homepage.promotionRibbon=null;ibmweb.homepage.newsticker=function(){var _7={interval:5000};var _8=_4.query("#ibm-news-feed-inner a.ibm-rss-link");if(_8){_7.url=_8[0].getAttribute("href");}_4.xhrGet({url:_7.url,handleAs:"xml",preventCache:true,error:function(){},load:function(_9){if(_9==null){this.error();return false;}_4.query("#ibm-news-feed-inner a.ibm-rss-link").addClass("ibm-access");var _a=_4.create("ul",{id:"ibm-news-feed-data"},_4.query("#ibm-news-feed-inner p")[0]);_4.query("item",_9).forEach(function(_b){var _c=_4.query("link",_b)[0].childNodes[0].nodeValue;var _d=_4.query("text",_b)[0].childNodes[0].nodeValue;var li=_4.create("li",{style:{"display":"none"}},_a);_4.create("a",{innerHTML:_d,href:_c},li);});var _e=1;var _f=_4.query("#ibm-news-feed-data > li");var max=_f.length;var _10=false;_f[0].style.display="inline";var _11=window.setInterval(function(){if(_10){return false;}_f.forEach(function(_12){_12.style.display="none";});_f[_e].style.display="inline";_f[_e].style.opacity="0";_4.anim(_f[_e],{opacity:1},600);_e=_e+1;if(_e==max){_e=0;}},_7.interval);_4.connect(_4.byId("ibm-news-feed-inner"),"onmouseover",_4.hitch(this,function(){_10=true;}));_4.connect(_4.byId("ibm-news-feed-inner"),"onmouseout",_4.hitch(this,function(){_10=false;}));}});};_4.declare("ibmweb.homepage.expandsection",null,{box:null,left:null,constructor:function(_13){this.box=_4.query("div.ibm-expand-overlay",_13.item)[0];this.left=_4.coords(_13.item).l;_4.connect(_13.item,"onmouseenter",_4.hitch(this,this.show));var _14=_4.query("div.ibm-expand-head > div.ibm-sp-icons",this.box)[0];_4.query("div.ibm-expand-body ul li a",this.box).forEach(_4.hitch(this,function(i){_4.connect(i,"onmouseover",_4.hitch(this,function(){var cl=i.className;_4.removeClass(_14);_4.addClass(_14,"ibm-sp-icons "+cl);var _15=_4.connect(i,"onmouseleave",_4.hitch(this,function(){_4.removeClass(_14);_4.addClass(_14,"ibm-sp-icons");_4.disconnect(_15);}));}));_4.connect(i,"onclick",function(e){var _16=i.href;var _17=i.innerHTML;ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"CS1","ibmEvTarget":_16,"ibmEvLinkTitle":_17});});}));var _18=_4.query(".ibm-expand-head a",this.box);if(_18.length>0){_4.connect(_18[0],"onclick",function(e){var _19=_18[0].href;var _1a=_18[0].innerHTML.indexOf("em")>-1?_4.query(".ibm-expand-head a em",this.box)[0].innerHTML:_18[0].innerHTML;ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"CS1","ibmEvTarget":_19,"ibmEvLinkTitle":_1a});});}var _1b=_4.query(".ibm-sp-tools a",this.box);if(_1b.length>0){_1b.forEach(function(_1c){_4.connect(_1c,"onclick",function(e){var _1d=_1c.href;var _1e=_1c.title;ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"CS1","ibmEvTarget":_1d,"ibmEvLinkTitle":_1e});});});}},show:function(evt){_4.place(this.box,_4.query("#ibm-promotion-module > div.ibm-container-body")[0]);_4.style(this.box,{opacity:"0",display:"block",top:"20px",left:this.left+"px",zIndex:2000});_4.anim(this.box,{opacity:1},500);var _1f=_4.connect(this.box,"onmouseleave",_4.hitch(this,function(e){_4.disconnect(_1f);this.hide(e);}));},hide:function(){_4.anim(this.box,{opacity:0},500,null,_4.hitch(this,function(){this.box.style.display="none";}));}});ibmweb.homepage.onWindowResize=function(){var _20=_4.window.getBox();_4.query("#ibm-leadspace-head > div.ibm-container-body > div.ibm-ribbon-pane")[0].style.width=(_20.w>1030?_20.w:1030)+"px";_4.query("#ibm-leadspace-head > div.ibm-container-body > div.ibm-ribbon-pane > div.ibm-ribbon-section > div").forEach(function(i){var _21=_20.w+30;if(_21<1030){_21=1030;}i.style.width=_21+"px";});var _22=_4.query("#ibm-leadspace-head > div.ibm-container-body > div.ibm-ribbon-pane > div.ibm-ribbon-section")[0];if(!_22.style.left||_22.style.left=="0px"){}else{var dim=_20.w;if(dim<1000){dim=1000;}_22.style.left="-"+((ibmweb.homepage.leadspaceRibbon.currentSlideIndex*dim)+(ibmweb.homepage.leadspaceRibbon.currentSlideIndex*30))+"px";}};ibmweb.homepage.ibm100promotion=function(){_4.xhrGet({url:"/ibm100/us/en/icons/v17-hp.html",handleAs:"text",preventCache:true,load:function(_23){if(!_23){return false;}var _24=_4.query("#ibm-promotion-module div.ibm-columns > div.ibm-col-6-2");if(!!_24&&_24.length>2){var _25=_24[2];_25.innerHTML=_23;ibmweb.homepage.addUnicaForPromotionBox(_4.query("#ibm-iop > a")[0],2);}}});};ibmweb.homepage.addUnicaForPromotionBox=function(_26,_27){var _28=_26.getAttribute("href");var _29=_4.query("img:first-child",_26)[0];var alt=_29.getAttribute("alt");var id=_27+1;_4.connect(_26,"onclick",function(e){ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"CS"+id,"ibmEvTarget":_28,"ibmEvLinkTitle":alt});});_4.connect(_26,"onmouseenter",function(e){ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"ibmhover","ibmEvTarget":"cs"+id+"v","ibmEvLinkTitle":"cs"+id+"v"});});};ibmweb.homepage.logoAnimation=function(){_4.style(_4.byId("ibm-home"),{position:"relative",display:"block",width:"85px"});var el=_4.query("#ibm-home a")[0];_4.style(el,{position:"absolute",left:"0px",top:"0px",backgroundPosition:"0px -900px",opacity:1,visibility:"visible"});for(var i=8;i>=0;i-=1){var _2a=_4.create("a",{href:"http://www.ibm.com/"+ibmweb.meta.cc+"/"+ibmweb.meta.lc+"/",tabIndex:0,"aria-label":(ibmweb.dynnav.PMM.accessibilityData)?ibmweb.dynnav.PMM.accessibilityData.home:null},"ibm-home");if(ibmweb.config.config=="www"&&_4.byId("ibm-com").className=="dijit_a11y"){_4.create("img",{src:"/i/v17/t/ibm-logo.png",id:"ibm-hcontrast-home"},_2a);}_4.style(_2a,{opacity:0,position:"absolute",left:"0px",top:"0px",display:"block",zIndex:10});if(i!==0){_4.style(_2a,{backgroundPosition:"0px -"+i+"00px"});}}var _2b=_4.query("#ibm-home > a");var _2c=[];var _2d=[];for(var i=0;i<10;i+=1){_2c[i]=_4.animateProperty({node:_2b[i],properties:{opacity:{start:0,end:1}},duration:245});_2d[i]=_4.animateProperty({node:_2b[i],properties:{opacity:{start:1,end:0}},duration:145});}var _2e=_4.fx.chain([_4.fx.combine([_2d[0],_2c[1]]),_4.fx.combine([_2d[1],_2c[2]]),_4.fx.combine([_2d[2],_2c[3]]),_4.fx.combine([_2d[3],_2c[4]]),_4.fx.combine([_2d[4],_2c[5]]),_4.fx.combine([_2d[5],_2c[6]]),_4.fx.combine([_2d[6],_2c[7]]),_4.fx.combine([_2d[7],_2c[8]]),_4.fx.combine([_2d[8],_2c[9]])]);_4.connect(_2e,"onEnd",function(){_4.query("#ibm-home a:not(:last-child)").orphan();});_2e.play();};_4.addOnLoad(function(){_4.query("#ibm-home a")[0].style.visibility="hidden";if(!!_4.byId("ibm-news-feed")){ibmweb.homepage.newsticker();}else{var tmp=_4.byId("ibm-promotion-module");if(!!tmp){tmp.style.borderTop="0px";}}if(ibmweb.meta.lc=="en"){ibmweb.homepage.ibm100promotion();}_4.query("#ibm-promotion-module div.ibm-expand-section").forEach(function(el){var _2f=new ibmweb.homepage.expandsection({item:el});});var _30=[];_4.query("#ibm-leadspace-body > div.ibm-columns").forEach(function(_31,i){_30.push(_4.hasClass(_31,"ibm-alternate"));});ibmweb.homepage.leadspaceRibbon=new ibmweb.ribbon({srcNodeRef:_4.query("#ibm-leadspace-head > div.ibm-container-body")[0],autoscroll:!ibmweb.info.iDevice,interval:7500,rotationCount:2,customSeekAnimation:function(_32,_33,_34){var _35=_4.query("#ibm-lead-1 h1")[0];if(this.currentSlideIndex==1){var _35=_4.query("#ibm-lead-2 h2")[0];}else{if(this.currentSlideIndex==2){var _35=_4.query("#ibm-lead-3 h2")[0];}}var _36=_4.fx.chain([_4.animateProperty({node:_35,properties:{left:{start:0,end:-2000,unit:"px"}},duration:950,easing:function(n){return -1*(Math.sqrt(1-Math.pow(n,2))-1);}}),_4.animateProperty({node:_35,properties:{left:{start:-1000,end:0,unit:"px"}},duration:200})]);var _37=_4.animateProperty({node:this.scrollableNode,properties:{left:{start:this.scrollableNode.style.left||0,end:_32*_33*-1,nit:"px"}},duration:2100,easing:function(n){if(n==0){return 0;}if(n==1){return 1;}n=n*2;if(n<1){return Math.pow(2,10*(n-1))/2;}--n;return (-1*Math.pow(2,-10*n)+2)/2;}});var _38=_4.fx.combine([_36,_37]);_38.play();_4.connect(_38,"onEnd",_4.hitch(this,function(){if(_34){this.scrollableNode.style.left="0px";}this._isBeingAnimated=false;}));if(!!_4.byId("ibm-news-feed-inner")){if(_30[_33>2?0:_33]){_4.addClass(_4.byId("ibm-news-feed-inner"),"ibm-alternate");}else{_4.removeClass(_4.byId("ibm-news-feed-inner"),"ibm-alternate");}}}});if(ibmweb.homepage.leadspaceRibbon.slides.length>1){ibmweb.homepage.leadspaceRibbon.startup();_4.query("#ibm-leadspace-body div.ibm-ribbon-nav a").forEach(function(i,e){var pos=e+1;_4.connect(i,"onclick",function(){ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"ibmlink","ibmEvLinktitle":"ls"+pos,"ibmEvSection":"ls"+pos});return true;});_4.connect(i,"onmouseenter",function(e){e.stopPropagation();ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"ibmhover","ibmEvLinktitle":"ls"+pos,"ibmEvSection":"ls"+pos});return false;});});}ibmweb.homepage.promotionRibbon=new ibmweb.ribbon({srcNodeRef:_4.query("#ibm-promotion-module > div.ibm-container-body")[0]});if(ibmweb.homepage.promotionRibbon.slides.length>3){ibmweb.homepage.promotionRibbon.slides.length-=2;}else{ibmweb.homepage.promotionRibbon.slides.length=1;}ibmweb.homepage.promotionRibbon.hideNavigationDots();ibmweb.homepage.promotionRibbon.startup();_4.query("#ibm-lead-2, #ibm-lead-3").forEach(function(_39){_39.style.display="block";});_4.query("#ibm-lead-1, #ibm-lead-2, #ibm-lead-3").forEach(function(_3a,_3b){_3a.style.cursor="pointer";_4.connect(_3a,"onclick",function(e){_4.stopEvent(e);var _3c=_4.query("div.ibm-col-1-1 a",_3a);if(_3c&&_3c.length>0){var _3d=_3c[0].getAttribute("href");var _3e=_4.query("img:first-child",_3a)[0];var alt=_3e.getAttribute("alt");var id=_3b+1;ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"LS"+id,"ibmEvTarget":_3d,"ibmEvLinkTitle":alt});window.location=_3d;}});_4.connect(_3a,"onmouseenter",function(e){var id=_3b+1;ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":"ibmhover","ibmEvTarget":"ls"+id+"v","ibmEvLinkTitle":"ls"+id+"v"});});});if(!!_4.byId("ibm-news-feed-inner")){if(_30[0]){_4.addClass(_4.byId("ibm-news-feed-inner"),"ibm-alternate");}else{_4.removeClass(_4.byId("ibm-news-feed-inner"),"ibm-alternate");}}if(ibmweb.homepage.leadspaceRibbon.slides.length>1){_4.query("#ibm-leadspace-head .ibm-ribbon-nav a").forEach(function(_3f,i){var j=i+1;_4.place("<div class=\"ibm-ribbon-view ibm-lead-thumb-"+j+"\"><div class=\"ibm-pagination-overlay\"></div></div>",_3f);var alt=_4.query("#ibm-lead-"+j+" img:first-child")[0].getAttribute("alt");var em=_4.query("#ibm-lead-"+j+" p em")[0].innerHTML;em=em.replace(/<span>(?:[a-zA-Z1-9 \.,]*)<\/span>/ig,"");var _40="<span class=\"ibm-lead-thumb-"+j+"\"></span><h2>"+alt+"</h2><p>"+em+"</p>";var _41=_4.query("#ibm-leadspace-head .ibm-ribbon-nav a:nth-child("+j+") div.ibm-pagination-overlay")[0];_4.place(_40,_41);var _42=_4.query("div.ibm-pagination-overlay",_3f)[0];_4.connect(_3f,"onmouseenter",function(e){if(_42.style.display=="block"){return false;}if(_4.isIE<7){_4.style(_42,{display:"block"});}else{_4.style(_42,{opacity:"0",display:"block"});_4.anim(_42,{opacity:1},300);}var _43=_4.connect(_3f,"onmouseleave",function(){if(_4.isIE<7){_42.style.display="none";}else{_4.anim(_42,{opacity:0},200,null,function(){_42.style.display="none";});}_4.disconnect(_43);});});});}else{_4.query(ibmweb.homepage.leadspaceRibbon.navNode).orphan();}if(_4.isIE<8){_4.byId("ibm-leadspace-body").style.position="static";}_4.connect(window,"resize",ibmweb.homepage.onWindowResize);ibmweb.homepage.onWindowResize();_4.query("#ibm-promotion-module div.ibm-col-6-2 > a").forEach(ibmweb.homepage.addUnicaForPromotionBox);_4.forEach([ibmweb.homepage.promotionRibbon.scrollRightButton,ibmweb.homepage.promotionRibbon.scrollLeftButton],function(_44,_45){_4.forEach(["onclick","onmouseenter"],function(ev){_4.connect(_44,ev,function(){ibmweb.util.statsHelper({"ibmEV":"track","ibmEvAction":ev=="onclick"?"ibmlink":"ibmhover","ibmEvTarget":_45==0?"csnext":"csprevious","ibmEvLinkTitle":_45==0?"csnext":"csprevious"});});});});var _46=_4.query("#ibm-leadspace-head div.ibm-ribbon-nav a");_4.connect(_4.query("#ibm-leadspace-head div.ibm-ribbon-pane")[0],"onkeypress",_4.hitch(this,function(evt){if(evt.keyCode==_4.keys.TAB&&!evt.shiftKey){if(_46.length>0){_4.query("#ibm-leadspace-head div.ibm-ribbon-nav a:first-child")[0].focus();}else{_4.byId("ibm-promotion-module").focus();}_4.stopEvent(evt);}}));if(_46.length>0){_46.forEach(function(_47,_48){_4.connect(_47,"onkeypress",_4.hitch(this,function(evt){if(evt.keyCode==_4.keys.TAB&&!evt.shiftKey){if(_48<=_46.length-1){ibmweb.homepage.leadspaceRibbon.slideTo(_48+1);}}if(evt.keyCode==_4.keys.TAB&&evt.shiftKey){if(_48>0){ibmweb.homepage.leadspaceRibbon.slideTo(_48-1);}}}));_4.connect(_47,"onfocus",_4.hitch(this,function(evt){ibmweb.homepage.leadspaceRibbon.slideTo(_48);}));});}if(_4.isIE<7){_4.query("#ibm-leadspace-body div.ibm-columns img:first-child").forEach(function(_49){var _4a=_49.width;var _4b=_49.height;var src=_49.src;_4.query(_49).wrap("<span style=\"width:"+_4a+"px;height:"+_4b+"px;display:inline-block; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"');\"></span>");_49.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)";});var _4c=_4.query("#ibm-home > a")[0];_4.style(_4c,{visibility:"visible"});}else{window.setTimeout("ibmweb.homepage.logoAnimation()",1200);}});}}};});

