function marketsummary_jslib(){this.regionId="US";
this.marketSymbol="593933";
this.chartLabel="S&P 500";
this.environmentPath="http://investing.businessweek.com/";
var siteLocation=document.domain;
if(siteLocation=="dev2.wallst.com"){this.chartPath="http://dev2.wallst.com/businessweek"
}else{if(siteLocation=="businessweek.wsodqa.com"){this.chartPath="http://businessweek.wsodqa.com"
}else{this.chartPath="http://charts.businessweek.com"
}}this.className="className";
var browserName=navigator.appName;
var userAgent=navigator.userAgent;
if(browserName=="Microsoft Internet Explorer"){if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var ieversion=new Number(RegExp.$1)
}if(ieversion>=8){this.className="className"
}else{this.className="className"
}}else{if(document.addEventListener){this.className="class"
}}}marketsummary_jslib.prototype.initPage=function(el,dur,alt){if(this.regionId=="US"){this.marketSymbol="593933";
this.chartLabel="S&P 500"
}else{if(this.regionId=="Europe"){this.marketSymbol="572009 ";
this.chartLabel="FTSE 100"
}else{if(this.regionId=="Asia"){this.marketSymbol="586621";
this.chartLabel="Shanghai"
}}}};
marketsummary_jslib.prototype.getActiveTab=function(section){if(section==1){var us=document.getElementById("ms-us-top");
var eu=document.getElementById("ms-eu-top");
var as=document.getElementById("ms-as-top")
}else{if(section==2){var us=document.getElementById("ms-us-bottom");
var eu=document.getElementById("ms-eu-bottom");
var as=document.getElementById("ms-as-bottom")
}}var activeTab=0;
if(us.className.indexOf("active")>-1){activeTab=0
}else{if(eu.className.indexOf("active")>-1){activeTab=1
}else{if(as.className.indexOf("active")>-1){activeTab=2
}}}return activeTab
};
marketsummary_jslib.prototype.getActiveTabBottom=function(div,className){if(div!="ms-nav"){var el=div
}else{var el=document.getElementById(div)
}var tabs=[];
var activeTab=0;
var j=0;
for(var i=0;
i<el.childNodes.length;
i++){if(el.childNodes[i].nodeType==1){tabs[j]=el.childNodes[i];
if(el.childNodes[i].className==className){activeTab=j
}j++
}}return activeTab
};
marketsummary_jslib.prototype.changeTab=function(tab){this.tab=tab;
var usMarketsDiv=document.getElementById("ms-us-top");
var europeMarketsDiv=document.getElementById("ms-eu-top");
var asianMarketsDiv=document.getElementById("ms-as-top");
var usMarketsDivBottom=document.getElementById("ms-us-bottom");
var europeMarketsDivBottom=document.getElementById("ms-eu-bottom");
var asianMarketsDivBottom=document.getElementById("ms-as-bottom");
var activeTab=marketSummary.getActiveTab(1);
if(this.tab==0){document.getElementById("ms-nav-image").src="http://charts.businessweek.com/research/markets/summary/images/ustabimage.png";
usMarketsDiv.setAttribute(this.className,"active");
europeMarketsDiv.setAttribute(this.className,"");
asianMarketsDiv.setAttribute(this.className,"");
usMarketsDivBottom.setAttribute(this.className,"active");
europeMarketsDivBottom.setAttribute(this.className,"");
asianMarketsDivBottom.setAttribute(this.className,"");
this.regionId="US";
this.marketSymbol="593933";
this.chartLabel="S&P 500";
this.changeChartLabel(this.regionId)
}if(this.tab==1){document.getElementById("ms-nav-image").src="http://charts.businessweek.com/research/markets/summary/images/eutabimage.png";
usMarketsDiv.setAttribute(this.className,"");
europeMarketsDiv.setAttribute(this.className,"active");
asianMarketsDiv.setAttribute(this.className,"");
usMarketsDivBottom.setAttribute(this.className,"");
europeMarketsDivBottom.setAttribute(this.className,"active");
asianMarketsDivBottom.setAttribute(this.className,"");
this.regionId="Europe";
this.marketSymbol="572009";
this.chartLabel="FTSE 100";
this.changeChartLabel(this.regionId)
}if(this.tab==2){document.getElementById("ms-nav-image").src="http://charts.businessweek.com/research/markets/summary/images/astabimage.png";
usMarketsDiv.setAttribute(this.className,"");
europeMarketsDiv.setAttribute(this.className,"");
asianMarketsDiv.setAttribute(this.className,"active");
usMarketsDivBottom.setAttribute(this.className,"");
europeMarketsDivBottom.setAttribute(this.className,"");
asianMarketsDivBottom.setAttribute(this.className,"active");
this.regionId="Asia";
this.marketSymbol="568838";
this.chartLabel="Hang Seng";
this.changeChartLabel(this.regionId)
}};
marketsummary_jslib.prototype.setRegionId=function(num,div,title){var activeTab=this.getActiveTab("ms-nav","first active");
if(activeTab==0){this.regionId="US"
}else{if(activeTab==1){this.regionId="Europe"
}else{if(activeTab==2){this.regionId="Asia"
}}}};
marketsummary_jslib.prototype.changeRowTimeOut=function(num,div,title){var activeTab=this.getActiveTab(1);
if(activeTab==0){this.regionId="US"
}if(activeTab==1){this.regionId="Europe"
}if(activeTab==2){this.regionId="Asia"
}var table=document.getElementById(div);
var rows=[];
for(var i=0;
i<table.getElementsByTagName("tr").length;
i++){row=table.getElementsByTagName("tr")[i];
if(row.className=="selected"){this.oldActiveRow=i
}row.setAttribute(this.className,"");
rows[i]=row
}rows[num].setAttribute(this.className,"selected");
var time=500;
var that=this;
this.changeRowTimer=window.setTimeout(function(){changeIndexRow(num,table,title)
},time);
function changeIndexRow(rowNumber,tableDiv,graphTitle){var rows=[];
for(var i=0;
i<tableDiv.getElementsByTagName("tr").length;
i++){row=tableDiv.getElementsByTagName("tr")[i];
rows[i]=row
}var chartLabel=rows[rowNumber].title;
if(rows[rowNumber].id=="SPX"){that.marketSymbol="SPX:IND";
graphTitle="S&amp;P 500"
}else{if(rows[rowNumber].id=="DJI"){that.marketSymbol="INDU:IND";
graphTitle="DJIA"
}else{if(rows[rowNumber].id=="COMP"){that.marketSymbol="CCMP:IND";
graphTitle="NASDAQ"
}else{if(rows[rowNumber].id=="FTSE"){that.marketSymbol="UKX:IND";
graphTitle="FTSE 100"
}else{if(rows[rowNumber].id=="CAC"){that.marketSymbol="CAC:IND";
graphTitle="CAC 40"
}else{if(rows[rowNumber].id=="DAX"){that.marketSymbol="DAX:IND";
graphTitle="DAXX Index"
}else{if(rows[rowNumber].id=="SHI"){that.marketSymbol="SHCOMP:IND";
graphTitle="Shanghai"
}else{if(rows[rowNumber].id=="HSI"){that.marketSymbol="HSI:IND";
graphTitle="Hang Seng"
}else{if(rows[rowNumber].id=="NSX"){that.marketSymbol="NIFTY:IND";
graphTitle="India NSE 50"
}}}}}}}}}if(graphTitle){var altTag=graphTitle
}else{var altTag=that.marketSymbol
}that.updateChart("1",altTag,chartLabel);
that.oldActiveRow=rowNumber
}};
marketsummary_jslib.prototype.updateChart=function(dur,alt,chartLabel){marketSummary.chartLabel=chartLabel;
var chartSym=this.marketSymbol;
var target="ms-us-chart-img";
var chartSRC="http://www.bloomberg.com/apps/chart?h=145&w=205&timeout=300&type=intraday&ticks="+chartSym+"&cfg=ChartBuilderIntra_bw.xml";
if(chartSym=="US&DJI"){var chartSym="DJI"
}if(this.regionId=="US"){var imagesrc='<img alt="" title="Graph of  '+alt+' Stock Market Index Performance" src="'+chartSRC+'" /><div id=chart-label-us>'+this.chartLabel+"</div>";
target="ms-us-chart-img"
}else{if(this.regionId=="Europe"){var imagesrc='<img alt="" title="Graph of  '+alt+' Stock Market Index Performance" src="'+chartSRC+'" /><div id=chart-label-eu>'+this.chartLabel+"</div>";
target="ms-eu-chart-img"
}else{if(this.regionId=="Asia"){var imagesrc='<img alt="" title="Graph of  '+alt+' Stock Market Index Performance" src="'+chartSRC+'" /><div id=chart-label-as>'+this.chartLabel+"</div>";
target="ms-as-chart-img"
}}}document.getElementById("imageStaging").innerHTML=imagesrc;
window.setTimeout(function(){document.getElementById(target).innerHTML=imagesrc
},100)
};
marketsummary_jslib.prototype.changeSection=function(num,region){if(region=="US"){var el="ms-us-screener-tabs";
var divPrefix="ms-us-screener-"
}else{if(region=="Europe"){var el="ms-eu-screener-tabs";
var divPrefix="ms-eu-screener-"
}else{if(region=="Asia"){var el="ms-as-screener-tabs";
var divPrefix="ms-as-screener-"
}}}var tabs=[];
var j=0;
var navigation=document.getElementById(el).getElementsByTagName("ul")[0];
var activeTab=marketSummary.getActiveTabBottom(navigation,"first active");
if(activeTab!=num){for(var i=0;
i<navigation.childNodes.length;
i++){if(navigation.childNodes[i].nodeType==1){tabs[j]=navigation.childNodes[i];
j++
}}var listItems=navigation.getElementsByTagName("li");
tabs[num].setAttribute(this.className,"first active");
tabs[activeTab].setAttribute(this.className,"");
if(num==0){document.getElementById(divPrefix+"gainers").setAttribute(this.className,"screener-stats screener-gainers");
document.getElementById(divPrefix+"losers").setAttribute(this.className,"screener-stats screener-losers");
document.getElementById(divPrefix+"actives").setAttribute(this.className,"screener-stats screener-actives active");
listItems[0].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/activesactivetab.png";
listItems[1].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/gainerstab.png";
listItems[2].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/loserstab.png"
}if(num==1){document.getElementById(divPrefix+"gainers").setAttribute(this.className,"screener-stats screener-gainers active");
document.getElementById(divPrefix+"losers").setAttribute(this.className,"screener-stats screener-losers");
document.getElementById(divPrefix+"actives").setAttribute(this.className,"screener-stats screener-actives");
listItems[0].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/activestab.png";
listItems[1].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/gainersactivetab.png";
listItems[2].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/loserstab.png"
}if(num==2){document.getElementById(divPrefix+"gainers").setAttribute(this.className,"screener-stats screener-gainers");
document.getElementById(divPrefix+"losers").setAttribute(this.className,"screener-stats screener-losers active");
document.getElementById(divPrefix+"actives").setAttribute(this.className,"screener-stats screener-actives");
listItems[0].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/activestab.png";
listItems[1].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/gainerstab.png";
listItems[2].getElementsByTagName("img")[0].src=this.environmentPath+"/research/markets/summary/images/losersactivetab.png"
}}};
marketsummary_jslib.prototype.initPopUp=function(evt,sym){sym=sym.replace(";","semi");
newsym=sym.replace("semi",";");
var chartSRC="http://www.bloomberg.com/apps/chart?h=145&w=205&timeout=300&type=intraday&ticks="+newsym+"&cfg=ChartBuilderIntra_bw.xml";
var flyoutImage=document.getElementById("flyoutImage"+sym);
flyoutImage.src=chartSRC;
var popupContentDiv=document.getElementById("ms-popup-content");
var individualPopups=popupContentDiv.childNodes;
for(var i in individualPopups){if(individualPopups[i].id){individualPopups[i].setAttribute(this.className,"iH")
}}var e=evt;
var x=0;
var y=0;
if(e.pageX||e.pageY){x=e.pageX;
y=e.pageY
}else{if(e.clientX||e.clientY){x=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
y=e.clientY+document.body.scrollTop+document.documentElement.scrollTop
}}var popUpContentDivId="ms-popup-symbol-"+sym;
var popUpDiv=document.getElementById("ms-popup");
var popUpSymbolDiv=document.getElementById(popUpContentDivId);
popUpDiv.style.top=(y-0)+"px";
popUpDiv.style.left=(x+10)+"px";
popUpDiv.style.zIndex="10";
popUpDiv.setAttribute(this.className,"active");
document.getElementById("ms-popup-content").setAttribute(this.className,"");
popUpSymbolDiv.setAttribute(this.className,"")
};
marketsummary_jslib.prototype.closePopUp=function(evt,sym){sym=sym.replace(";","semi");
var popUpDiv=document.getElementById("ms-popup");
var popUpContentDivId="ms-popup-symbol-"+sym;
var popUpContentDiv=document.getElementById(popUpContentDivId);
popUpDiv.setAttribute(this.className,"iH");
document.getElementById("ms-popup-content").setAttribute(this.className,"iH");
popUpContentDiv.setAttribute(this.className,"iH")
};
marketsummary_jslib.prototype.changeChartLabel=function(region){if(region=="US"){document.getElementById("chart-label-us").innerHTML=this.chartLabel
}else{if(region=="Europe"){document.getElementById("chart-label-eu").innerHTML=this.chartLabel
}else{document.getElementById("chart-label-as").innerHTML=this.chartLabel
}}};
marketsummary_jslib.prototype.popUpTimeOut=function(evt,sym,time){var symbol=sym;
this.popUpTimer=window.setTimeout(function(evt,symbol){marketSummary.closePopUp(evt,sym)
},time)
};
marketsummary_jslib.prototype.popUpCancelTimeOut=function(evt,sym){window.clearTimeout(this.popUpTimer)
};
marketsummary_jslib.prototype.changeRowCancelTimeOut=function(div){window.clearTimeout(this.changeRowTimer);
var table=document.getElementById(div);
var rows=[];
for(var i=0;
i<table.getElementsByTagName("tr").length;
i++){row=table.getElementsByTagName("tr")[i];
row.setAttribute(this.className,"");
rows[i]=row
}rows[this.oldActiveRow].setAttribute(this.className,"selected")
};
var marketSummary=new marketsummary_jslib();
(function($){$.fn.tabControl=function(settings){settings=$.extend({tabSection:".tabSection",tabTitle:".tabTitle"},settings);
return this.each(function(){var $self=$(this),$tabSections;
$tabSections=$(settings.tabSection,this);
$tabSections.not(":first").hide();
var $tabs=$(this).find("ul.tabs");
$tabSections.each(function(i){$(settings.tabTitle,this).remove().text()
});
$tabs.find("li").each(function(i){var $tab=$(this);
$tab.bind("click",function(){if($tab.hasClass("active")){return false
}$tab.addClass("active").siblings().removeClass("active");
$tabSections.hide().filter(":eq("+i+")").show();
return false
}).css("outline","none")
})
})
};
$.fn.ellipsis=function(enableUpdating){var s=document.documentElement.style;
if(!("textOverflow" in s||"OTextOverflow" in s)){return this.each(function(){var el=$(this);
if(el.css("overflow")=="hidden"){var originalText=el.html(),text=originalText,w=el.width()-15,t=$("#_ellipsis_calc"),tWidth=t.length>0?t.width():0;
if(t.length<1){t=$("<span id='_ellipsis_calc'/>").appendTo("body")
}t.html(originalText).hide();
while(text.length>0&&t.width()>w){text=text.substr(0,text.length-1);
t.html(text+"...")
}el.html(t.html());
if(t.length>0){t.remove()
}if(enableUpdating==true){var oldW=w;
setInterval(function(){if(w!=oldW){oldW=w;
el.html(originalText);
el.ellipsis()
}},200)
}}})
}else{return this
}}
})(jQuery);
$(document).ready(function(){if(typeof marketSummary!="undefined"){marketSummary.initPage()
}});
