
ishares.fundFilter={};ishares.fundFilter.rootFundAttribute=null;ishares.fundFilter.parents=null;ishares.fundFilter.listFunction=null;ishares.fundFilter.filterCount=3;ishares.fundFilter.categoryText=null;ishares.fundFilter.filters=null;ishares.fundFilter.performanceType=null;ishares.fundFilter.filterFor=null;ishares.fundFilter.initialize=function(){var parents=[];ishares.fundFilter.addParents(parents,null,ishares.fundFilter.rootFundAttribute);ishares.fundFilter.parents=parents;if(ishares.fundFilter.filters==null){ishares.fundFilter.filters=[];}
var enableLeft=true;for(var i=0;i<ishares.fundFilter.filterCount;++i){var leftFilter=$("#filter"+i+"Left");var rightFilter=$("#filter"+i+"Right");var filter=(i<ishares.fundFilter.filters.length)?ishares.fundFilter.filters[i]:null;if(filter!=null&&filter.attributeType!=null){var leftAttribute=ishares.fundFilter.findLeftAttribute(ishares.fundFilter.rootFundAttribute,filter.attributeType,filter.attributeCode);ishares.fundFilter.populateLeftFilter(leftFilter,leftAttribute.attributeCode);ishares.fundFilter.populateRightFilter(rightFilter,leftAttribute,filter.attributeCode);}else{ishares.fundFilter.populateLeftFilter(leftFilter,"");if(enableLeft==false){leftFilter.attr({disabled:true});}
rightFilter.attr({disabled:true});enableLeft=false;}
leftFilter.bind("change",(function(index){return function(){ishares.fundFilter.leftFilterChange(index);}})(i));rightFilter.bind("change",(function(index){return function(){ishares.fundFilter.rightFilterChange(index);}})(i));}
var currencySelect=$("#currencyCode");currencySelect.bind("change",(function(){return function(){ishares.fundFilter.performFilter();}})());};ishares.setValue=function(ele,value){var select=$(ele).get(0);for(var i=0;i<select.options.length;++i){if(select.options[i].value==value){select.selectedIndex=i;}}};ishares.getValue=function(ele,value){var select=$(ele).get(0);if(select==null)return null;return select.options[select.selectedIndex].value;};ishares.fundFilter.populateLeftFilter=function(jSelect,attributeCode){var firstCat=true;for(var i=0;i<ishares.fundFilter.parents.length;++i){var att=ishares.fundFilter.parents[i];var option=document.createElement("option");var selected=att.attributeCode==attributeCode;if(att.attributeType=='CATEGORY'){if(firstCat){firstCat=false;var catHeader=document.createElement("option");$(catHeader).attr({value:'CATEGORY',disabled:true}).addClass('hilight').html(ishares.fundFilter.categoryText);jSelect.append(catHeader);}
$(option).attr({value:att.attributeCode,selected:selected}).html("&nbsp;&nbsp;"+att.attributeName);}else{$(option).attr({value:att.attributeCode,selected:selected}).html(att.attributeName);}
jSelect.append(option);}};ishares.fundFilter.addParents=function(parents,parent,att){var children=att.childAttributes;if(children&&children.length>0){for(var i=0;i<children.length;++i){ishares.fundFilter.addParents(parents,att,children[i]);}}else{var found=false;for(var i=0;i<parents.length;++i){if(parents[i].attributeCode==parent.attributeCode){found=true;break;}}
if(!found){parents.push(parent);}}};ishares.fundFilter.populateRightFilter=function(jSelect,leftAttribute,attributeCode){var options=jSelect.get(0).options;ishares.fundFilter.removeOptions(jSelect);for(var i=0;i<leftAttribute.childAttributes.length;++i){var child=leftAttribute.childAttributes[i];var option=document.createElement("option");var selected=child.attributeCode==attributeCode;$(option).attr({value:child.attributeCode}).html(child.attributeName);$(option).attr({selected:selected});jSelect.append(option);}};ishares.fundFilter.findLeftAttribute=function(parent,attributeType,attributeCode){if(parent.childAttributes){for(var i=0;i<parent.childAttributes.length;++i){var child=parent.childAttributes[i];if(child.attributeCode==attributeCode&&child.attributeType==attributeType){return parent;}else{var leftAtt=ishares.fundFilter.findLeftAttribute(child,attributeType,attributeCode);if(leftAtt!=null){return leftAtt;}}}}
return null;};ishares.fundFilter.leftFilterChange=function(index){var attributeCode=$("#filter"+index+"Left").val();var jSelect=$("#filter"+index+"Right");if(attributeCode==""||attributeCode=="CATEGORY"){ishares.fundFilter.clear(index);}else{for(var i=0;i<ishares.fundFilter.parents.length;++i){var att=ishares.fundFilter.parents[i];if(att.attributeCode==attributeCode){ishares.fundFilter.populateRightFilter(jSelect,att,"");jSelect.removeAttr('disabled');break;}}}};ishares.fundFilter.rightFilterChange=function(index){ishares.grid.sSort=null;ishares.fundFilter.performFilter();var value=ishares.getValue("#filter"+index+"Left");var isPopulated=(value!="");if(isPopulated){if(index<ishares.fundFilter.filterCount-1){var nextLeft=$("#filter"+(index+1)+"Left");nextLeft.removeAttr("disabled");}}};ishares.fundFilter.performFilter=function(){var filters=[];for(var i=0;i<ishares.fundFilter.filterCount;++i){var parentCode=$("#filter"+i+"Left").val();var attributeCode=$("#filter"+i+"Right").val();if(attributeCode!==""){var att=ishares.fundFilter.findAttribute(ishares.fundFilter.rootFundAttribute,parentCode,attributeCode);filters.push({attributeType:att.attributeType,attributeCode:att.attributeCode});}}
var currency=$("#currencyCode").val();var data='';if(currency!="base"){data='<img  src="/assets/currency_'+currency+'.png"/>';}
$('.user_currency').html(data);if(ishares.fundFilter.listFunction){ishares.startSpinner("data","fo");var performanceType=ishares.fundFilter.performanceType;switch(ishares.fundFilter.filterFor){case"marketData":if(performanceType){ishares.fundFilter.listFunction(performanceType,filters,function(response){ishares.marketData.list.data=(response)?response.data||[]:[];ishares.marketData.list.refresh();});}else{ishares.fundFilter.listFunction(filters,function(response){ishares.marketData.list.data=(response)?response.data||[]:[];ishares.marketData.list.refresh();});}
break;default:if(performanceType){ishares.fundFilter.listFunction(performanceType,filters,currency,function(response){ishares.grid.oData=response;ishares.grid.refresh();});}else{ishares.fundFilter.listFunction(filters,currency,function(response){ishares.grid.oData=response;ishares.grid.refresh();});}
break;}}};ishares.fundFilter.findAttribute=function(ancestor,parentAttributeCode,attributeCode){if(parentAttributeCode!=null){var parent=ishares.fundFilter.findAttribute(ancestor,null,parentAttributeCode);return ishares.fundFilter.findAttribute(parent,null,attributeCode);}else if(ancestor.attributeCode==attributeCode){return ancestor;}else if(ancestor.childAttributes){for(var i=0;i<ancestor.childAttributes.length;++i){var child=ancestor.childAttributes[i];var att=ishares.fundFilter.findAttribute(child,null,attributeCode);if(att!=null){return att;}}
return null;}};ishares.fundFilter.clear=function(index){var prevLeft=null;var prevRight=null;var left=$("#filter"+index+"Left");var right=$("#filter"+index+"Right");var leftValue=left.val();for(var i=index;i<ishares.fundFilter.filterCount;++i){if(i<ishares.fundFilter.filterCount-1){var nextI=i+1;var nextLeft=$("#filter"+nextI+"Left");var nextRight=$("#filter"+nextI+"Right");var nextLeftValue=$(nextLeft).val();ishares.fundFilter.moveOptions(nextRight,right);if(nextRight.attr("disabled")){right.attr({disabled:true});}else{right.removeAttr("disabled");}
ishares.setValue("#filter"+i+"Left",nextLeftValue);if(i>0){if(nextLeft.attr("disabled")){left.attr({disabled:true});}else{left.removeAttr("disabled");}}
left=nextLeft;leftValue=nextLeftValue;right=nextRight;}else{ishares.setValue(left.get(0),"");if(i>0){left.attr({disabled:true});}
ishares.fundFilter.removeOptions(right);right.attr({disabled:true});}}
ishares.fundFilter.performFilter();};ishares.fundFilter.moveOptions=function(jFrom,jTo){var fromOpts=jFrom.get(0).options;ishares.fundFilter.removeOptions(jTo);for(var i=1;i<fromOpts.length;){var opt=fromOpts[i];$(opt).remove();jTo.append(opt);}};ishares.fundFilter.removeOptions=function(jSelect){var opts=jSelect.get(0).options;for(var i=opts.length-1;i>0;--i){$(opts[i]).remove();}};ishares.grid={sSort:null,oData:{},aData:{},oMessages:{},oContainer:{},oRowClone:{},headerLayout:null,nBuildRowCount:0,oColumnDecorators:{}};ishares.grid.sort=function(by){if(by){var direction=(by!==this.sSort||(by==="fundNm"&&this.sSort===null));var usd=String.fromCharCode(36),eur=String.fromCharCode(8364),gbp=String.fromCharCode(163);var arrow,arrowID;if(this.sSort||this.sSort===null){arrowID="arrow_"+(this.sSort||"fundNm");arrow=document.getElementById(arrowID);if(arrow){arrow.style.display="none";}}
arrowID="arrow_"+by;arrow=document.getElementById(arrowID);if(arrow){var src=arrow.src;if(typeof src==="string"){arrow.style.display="inline";arrow.src=(src.indexOf("up")>=0)?src.replace("up","down"):(src.indexOf("down")>=0)?src.replace("down","up"):src;}}
this.aData=(direction)?this.aData.sort(function(object1,object2){if(object1&&object2){var variant1,variant2,value1,value2;if(by==="fundNm"){value1=object1[by].toLowerCase().replace(usd,String.fromCharCode(36)).replace(eur,String.fromCharCode(37)).replace(gbp,String.fromCharCode(38));value2=object2[by].toLowerCase().replace(usd,String.fromCharCode(36)).replace(eur,String.fromCharCode(37)).replace(gbp,String.fromCharCode(38));if(value1>value2){return 1;}
if(value1<value2){return-1;}
return 0;}else if(by==="terPct"){variant1=object1[by];variant2=object2[by];value1=((value1=variant1.value)&&(typeof value1!=="object"))?value1:0;value2=((value2=variant2.value)&&(typeof value2!=="object"))?value2:0;if(value1>value2){return 1;}
if(value1<value2){return-1;}
return 0;}else if(by==="aum"||by==="nav"){var currencyCode1,currencyCode2;currencyCode1=ishares.currencyCodes[object1.baseCurrencyCd];currencyCode2=ishares.currencyCodes[object2.baseCurrencyCd];if(currencyCode1>currencyCode2){return 1;}
if(currencyCode1<currencyCode2){return-1;}
variant1=object1[by];variant2=object2[by];value1=((value1=variant1.value)&&(typeof value1!=="object"))?value1:0;value2=((value2=variant2.value)&&(typeof value2!=="object"))?value2:0;if(value1>value2){return 1;}
if(value1<value2){return-1;}
return 0;}else{variant1=object1[by]||"";variant2=object2[by]||"";value1=(typeof variant1==="string")?variant1.toLowerCase():((variant1=variant1.value)&&(typeof variant1==="string"))?variant1.toLowerCase():variant1;value2=(typeof variant2==="string")?variant2.toLowerCase():((variant2=variant2.value)&&(typeof variant2==="string"))?variant2.toLowerCase():variant2;if(value1>value2){return 1;}
if(value1<value2){return-1;}
return 0;}}}):this.aData.reverse();this.sSort=by;this.order();return true;}
return false;}
ishares.grid.order=function(){var a=this.aData;var i=0,j=a.length,rowData,rowElement;for(i=i;i<j;i++){rowData=a[i];rowElement=(rowData)?rowData.rowElement:null;if(rowElement){rowElement.className=(i%2)?"grid_row odd":"grid_row even";parentNode=rowElement.parentNode;if(parentNode){parentNode.appendChild(parentNode.removeChild(rowElement));}}}
return true;}
ishares.grid.init=function(){this.aData=this.oData.data;this.oMessages=this.oData.messageResources;this.oContainer=$("#data").get(0);this.oRowClone=$("#rowClone").get(0);aDataIds=this.getDataIds(this.oRowClone);if(this.aData[0]&&this.headerLayout){var dGridHeader=$('#grid_header').get(0);var aTH=$('#grid_header .build_runtime').get();this.headerLayout(dGridHeader,aTH);}}
ishares.grid.buildFromHtml=function(){ishares.grid.init();this.sort("fundNm");var nCount=0;var $dataRows=$("#data > .grid_row");while(this.aData[nCount]){this.aData[nCount].rowElement=$dataRows.get(nCount);nCount++;}}
ishares.grid.build=function(){ishares.grid.init();this.sort("fundNm");var nCount=0;while(this.aData[nCount]){var dRow=this.oRowClone.cloneNode(true);var oRowData=this.aData[nCount];dRow.id='';dRow.className=(nCount%2==1)?"grid_row odd":"grid_row even";var aColDivs=dRow.getElementsByTagName('DIV');for(var i=0;i<aDataIds.length;i++){var dDataNode=this.getDataNode(aColDivs[i]);if(dDataNode){var sColumnId=aDataIds[i];var columnDecorator=this.oColumnDecorators[sColumnId]||this.defaultDecorator;columnDecorator(dDataNode,oRowData,sColumnId);}}
this.aData[nCount].rowElement=dRow;this.oContainer.appendChild(dRow);nCount++;}};ishares.grid.getDataNode=function(dElement){if(dElement.className.match('cnode')){return dElement}
for(var i=0;i<dElement.childNodes.length;i++){var dChild=dElement.childNodes[i];if(dChild.nodeType!=3){if(dChild.className=='cnode'){return dChild}
else if(dChild.childNodes.length>0){return this.getDataNode(dChild)}
else{return null;}}}};ishares.grid.defaultDecorator=function(element,row,columnName){var data=row[columnName];var label=data;if(data&&data.label){label=data.label;}
else if(typeof(data)!='string'){label=ishares.grid.oMessages['user.labels.na'];if(label==undefined||label==null){label='N/A';}}
if(label==undefined||label==null){label=ishares.grid.oMessages['user.labels.na'];if(label==undefined||label==null){label='N/A';}}
element.innerHTML=label;};ishares.grid.getDataIds=function(el){var ids=[];if(el.childNodes){for(var i=0;i<el.childNodes.length;++i){var childNode=el.childNodes[i];if(childNode.id){ids.push(childNode.id);}
var subIds=ishares.grid.getDataIds(childNode);if(subIds.length>0){ids=ids.concat(subIds);}}}
return ids;};ishares.grid.refresh=function(){$("#data").html("");ishares.grid.build();ishares.stopSpinner('data');};ishares.currencyCodes={EUR:'&euro;',GBP:'&pound;',USD:'$'};ishares.grid.fundOverviewDecorators={fundNm:function(element,row){element.innerHTML='<a href="'+prefixURL+ishares.fundPath+row.absoluteTicker+'">'+row.fundNm+'</a>';},graph:function(element,row){if(row.tecAvailable===true){$(element).bind("click",function(){window.location.replace(prefixURL+"/tools/tec/"+row.ticker);return true;});}else{element.style.display='none';}},terPct:function(element,row){element.innerHTML=row.terPct.label+row.terPctSymbol;},aum:function(element,row){element.innerHTML=(row.aum.label)?row.aum.label+" "+row.navCurrencyCd:"&ndash;";},nav:function(element,row){var elementText='<span class="glob-tooltip-next">';if(row.nav1Flg==="Y"){elementText+="";}
elementText+=(row.nav.label)?row.nav.label+" "+row.navCurrencyCd:"&ndash;";if(row.nav1Flg==="Y"){elementText+="</span><span class=\"glob-tooltip-icon\" title=\""+ishares.grid.oMessages["user.labels.nav.tooltip"]+'"></span>';}
element.innerHTML=elementText;}};ishares.grid.fundStandarizedDecorators={fundNm:function(element,row){element.innerHTML='<a href="'+ishares.fundPath+row.absoluteTicker+'">'+row.fundNm+'</a>';},graph:function(element,row){if(row.tecAvailable===true){$(element).bind("click",function(){window.location.replace(prefixURL+"/tools/tec/"+row.ticker);return true;});}else{$(element).css("display","none");}},cy0Perf:function(element,row){var sCy0Perf=row.cy0Perf.label||ishares.grid.oMessages['user.labels.na'];var sCy0Idx=row.cy0Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sCy0Perf+'</span><span class="row2">'+sCy0Idx+'</span>';},cy1Perf:function(element,row){var sCy1Perf=row.cy1Perf.label||ishares.grid.oMessages['user.labels.na'];var sCy1Idx=row.cy1Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sCy1Perf+'</span><span class="row2">'+sCy1Idx+'</span>';},cy2Perf:function(element,row){var sCy2Perf=row.cy2Perf.label||ishares.grid.oMessages['user.labels.na'];var sCy2Idx=row.cy2Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sCy2Perf+'</span><span class="row2">'+sCy2Idx+'</span>';},cy3Perf:function(element,row){var sCy3Perf=row.cy3Perf.label||ishares.grid.oMessages['user.labels.na'];var sCy3Idx=row.cy3Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sCy3Perf+'</span><span class="row2">'+sCy3Idx+'</span>';},cy4Perf:function(element,row){var sCy4Perf=row.cy4Perf.label||ishares.grid.oMessages['user.labels.na'];var sCy4Idx=row.cy4Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sCy4Perf+'</span><span class="row2">'+sCy4Idx+'</span>';},asofDt:function(element,row){var sAsofDt=row.asofDt.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sAsofDt+'</span>';}};ishares.grid.fundCummulativeDecorators={fundNm:function(element,row){element.innerHTML='<a href="'+ishares.fundPath+row.absoluteTicker+'">'+row.fundNm+'</a>';},graph:function(element,row){if(row.tecAvailable===true){$(element).bind("click",function(){window.location.replace(prefixURL+"/tools/tec/"+row.ticker);return true;});}else{$(element).css("display","none");}},mo3Perf:function(element,row){var sMo3Perf=row.mo3Perf.label||ishares.grid.oMessages['user.labels.na'];var sMo3Idx=row.mo3Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+row.mo3Perf.label+'</span><span class="row2">'+row.mo3Idx.label+'</span>';},mo6Perf:function(element,row){var sMo6Perf=row.mo6Perf.label||ishares.grid.oMessages['user.labels.na'];var sMo6Idx=row.mo6Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sMo6Perf+'</span><span class="row2">'+sMo6Idx+'</span>';},yr1Perf:function(element,row){var sYr1Perf=row.yr1Perf.label||ishares.grid.oMessages['user.labels.na'];var sYr1Idx=row.yr1Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sYr1Perf+'</span><span class="row2">'+sYr1Idx+'</span>';},yr3Perf:function(element,row){var sYr3Perf=row.yr3Perf.label||ishares.grid.oMessages['user.labels.na'];var sYr3Idx=row.yr3Idx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sYr3Perf+'</span><span class="row2">'+sYr3Idx+'</span>';},siPerf:function(element,row){var sSiPerf=row.siPerf.label||ishares.grid.oMessages['user.labels.na'];var sSiIdx=row.siIdx.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sSiPerf+'</span><span class="row2">'+sSiIdx+'</span>';},asofDt:function(element,row){var sAsofDt=row.cy1Dt.label||ishares.grid.oMessages['user.labels.na'];element.innerHTML='<span>'+sAsofDt+'</span><span class="row2">'+sAsofDt+'</span>';}};ishares.grid.noteOverviewDecorators={fundNm:function(element,row){element.innerHTML='<a href="'+ishares.fundPath+row.absoluteTicker+'">'+row.fundNm+'</a>';},expenseRatio:function(element,row){element.innerHTML=row.expenseRatio.label||ishares.grid.oMessages['user.labels.na'];},noteStructure:function(element,row){element.innerHTML=row.noteStructure||ishares.grid.oMessages['user.labels.na'];}};if(typeof this['ishares']=='undefined')this.ishares={};if(typeof ishares['components']=='undefined')ishares.components={};if(typeof ishares.components['nav']=='undefined')ishares.components.nav={};if(typeof ishares.components['fundInformation']=='undefined')ishares.components.fundInformation={};if(typeof ishares.components['fundAdditional']=='undefined')ishares.components.fundAdditional={};if(typeof ishares.components['watchlist']=='undefined')ishares.components.watchlist={};if(typeof ishares['fundOverview']=='undefined')ishares.fundOverview={};if(typeof ishares['fundPerformance']=='undefined')ishares.fundPerformance={};ishares.components.gdSelects=function(){var jList=$('.gdselect');jList.hide();jList.each(function(){var jThis=$(this);var lis=jThis.children();var select=document.createElement('select');var jSelect=$(select);jSelect.bind('change',function(event){var link=$(lis[select.selectedIndex]).children()[0];$(link).click();});for(var i=0;i<lis.length;++i){var li=$(lis[i]);var link=li.children()[0];var option=document.createElement('option');if($(li).hasClass('gdselected')){$(option).attr('selected','selected');}
$(option).text($(link).text());jSelect.append(option);}
jSelect.insertBefore(jThis);});jList.remove();};$(document).ready(function(){ishares.components.gdSelects()});ishares._recordedFunctions=[];ishares.record=function(functionString){eval('ishares.components. '+functionString);if(ishares._recordedFunctions.length>0){ishares._recordedFunctions.push(',');}
ishares._recordedFunctions.push(encodeURIComponent(functionString));};ishares.components.excelDownload=function(urlBase){var url=urlBase;if(ishares._recordedFunctions.length>0){url+="/"+ishares._recordedFunctions.join("");}
window.location.href=url;};ishares.components.print=function(urlBase){var url=urlBase;if(ishares._recordedFunctions.length>0){url+="/"+ishares._recordedFunctions.join("");}
doPrintUrl(null,url);};ishares.components.refresh=function(componentId,componentService,values){var spinner=ishares.startSpinner(componentId);var callback=function(html,callbackSpinner){$("#"+componentId).replaceWith(html);ishares.components.gdSelects();ishares.stopSpinner(componentId,callbackSpinner);};componentService.refresh(componentId,values,{arg:spinner,callback:callback});};ishares.components.backgroundRefresh=function(componentId,componentService,values,callback){componentService.refresh(componentId,values,function(html){$("#"+componentId).replaceWith(html);ishares.components.gdSelects();callback();});};ishares.components.edit=function(componentId,componentService,values){componentService.edit(componentId,values,function(html){$("#"+componentId).replaceWith(html);});};ishares.components.close=function(componentId){$("#"+componentId).remove();};ishares.components.save=function(componentId,componentService){var values=ishares.components.getValues(componentId);var cookieJar=new CookieJar({});var components=cookieJar.get("components");if(components==null){components={};}
components[componentId]=values;cookieJar.put("components",components);ishares.components.refresh(componentId,componentService,values);};ishares.components.getValues=function(containerId){var container=$("#"+containerId).get(0);var inputs=container.getElementsByTagName("input");var selects=container.getElementsByTagName("select");var component={};for(var i=0;i<inputs.length;++i){var input=inputs[i];component[input.name]=$(input).val();}
for(var i=0;i<selects.length;++i){var select=selects[i];component[select.name]=$(select).val();}
return component;};ishares.components.navDateChange=function(componentId,fundId,asofDt){var values={fundId:fundId,asofDt:asofDt};ishares.components.refresh(componentId,FundNavComponentService,values);};ishares.components.indexFundamentalsDateChange=function(componentId,fundId,asofDt){var values={fundId:fundId,asofDt:asofDt};ishares.components.refresh(componentId,FundIndexFundamentalsComponent,values);};ishares.components.fundInformation.asofDtChange=function(componentId,fundId){var values={fundId:fundId,asofDt:$("#"+componentId+"-asofDt").val()};ishares.components.refresh(componentId,FundInformationComponentService,values);};ishares.components.fundAdditional.asofDtChange=function(componentId,fundId){var values={fundId:fundId,asofDt:$("#"+componentId+"-asofDt").val()};ishares.components.refresh(componentId,FundAdditionalComponentService,values);};ishares.fundOverview.persistComponentOrdering=function(request){ishares.persistComponentOrdering(request,'fundOverview.containers');};ishares.fundPerformance.persistComponentOrdering=function(request){ishares.persistComponentOrdering(request,'fundPerformance.containers');};ishares.persistComponentOrdering=function(request,persistId){var containerId=request.id;var itemIds=[];for(var i=0;i<request.childNodes.length;++i){itemIds.push(request.childNodes[i].id);}
var cookieJar=new CookieJar({});var componentContainers=cookieJar.get(persistId);if(componentContainers==null){componentContainers={};}
componentContainers[containerId]=itemIds;cookieJar.put(persistId,componentContainers);};ishares._listeners={};ishares.components.currency={};ishares.components.currency.changeCurrency=function(currencyCd){var data='<img  src="/assets/currency_'+currencyCd+'.png"/>';$('.user_currency').html(data);ishares.components.fireEvent('onCurrencyChange',{currencyCode:currencyCd});}
ishares.components.fireEvent=function(eventName,extraValues){dwr.engine.beginBatch();var eventListeners=ishares.getListeners(eventName);for(var componentId in eventListeners){var data=eventListeners[componentId];var service=data.service;var values={};for(var key in data){if(key!='service'){values[key]=data[key];}}
for(var key in extraValues){values[key]=extraValues[key];}
ishares.components.refresh(componentId,service,values);}
dwr.engine.endBatch();};ishares.components.fireBackgroundEvent=function(eventName,extraValues,callback){dwr.engine.beginBatch();var eventListeners=ishares.getListeners(eventName);for(var componentId in eventListeners){var data=eventListeners[componentId];var service=data.service;var values={};for(var key in data){if(key!='service'){values[key]=data[key];}}
for(var key in extraValues){values[key]=extraValues[key];}
ishares.components.backgroundRefresh(componentId,service,values,callback);}
dwr.engine.endBatch();};ishares.components.exchange={};ishares.components.exchange.changeExchange=function(exchangeCd){ishares.components.fireEvent('onExchangeChange',{exchangeCode:exchangeCd});}
ishares.components.exchange.changeExchange2=function(fundId,exchangeCd){dwr.engine.beginBatch();var listeners=ishares.getListeners('onExchangeChange');for(var i=0;i<listeners.length;++i){var extraValues={exchangeCode:exchangeCd};var listener=listeners[i];var service=listener.service;var componentId=listener.componentId;var values={};for(var key in listener){if(key!='service'&&key!='componentId'){values[key]=listener[key];}}
for(var key in extraValues){values[key]=extraValues[key];}
ishares.components.refresh(componentId,service,values);}
ishares.components.exchange.changeTitle(fundId,exchangeCd);dwr.engine.endBatch();};ishares.components.exchange.changeTitle=function(fundId,exchangeCd){FundPageService.getFundTitle(fundId,exchangeCd,function(fundTitle){$("#fundTitle").val(fundTitle);var oldTitle=document.title;var pipeIndex=oldTitle.indexOf('|');var newTitle=fundTitle+' '+oldTitle.substring(pipeIndex);document.title=newTitle;});};ishares.components.exchange.changeNoteExchange=function(fundId,exchangeCd){ishares.components.fireEvent('onExchangeChange',{exchangeCode:exchangeCd})}
ishares.components.exchange.changeNoteExchange2=function(fundId,exchangeCd){dwr.engine.beginBatch();var listeners=ishares.getListeners('onExchangeChange');for(var i=0;i<listeners.length;++i){var values={fundId:fundId,exchangeCode:exchangeCd};var listener=listeners[i];var service=listener.service;var componentId=listener.componentId;for(var key in listener){if(key!='service'&&key!='componentId'){values[key]=listener[key];}}
ishares.components.refresh(componentId,service,values);}
dwr.engine.endBatch();};ishares.registerListener=function(eventName,service,componentId,data){var eventListeners=ishares._listeners[eventName];if(eventListeners==null){eventListeners={};ishares._listeners[eventName]=eventListeners;}
data.service=service;eventListeners[componentId]=data;};ishares.getListeners=function(eventName){var listeners=ishares._listeners[eventName];return listeners==null?[]:listeners;}
ishares.components.dividends={};ishares.components.dividendToggle=function(componentId,fundId,showAll){ishares.components.refresh(componentId,FundDividendsComponentService,{fundId:fundId,showAll:showAll});};ishares.components.holdings={};ishares.components.holdings.changeAsOfDate=function(asOfDate){ishares.components.fireEvent('onAsOfDateChange',{asOfDate:asOfDate});$("#utilities > li > a.excel").attr("href","../"+asOfDate+"/true");}
ishares.components.holdings.changeAsOfDate2=function(fundId,asOfDate){dwr.engine.beginBatch();var listeners=ishares.getListeners('onAsOfDateChange');for(var i=0;i<listeners.length;++i){var values={fundId:fundId,asOfDate:asOfDate};var listener=listeners[i];var service=listener.service;var componentId=listener.componentId;for(var key in listener){if(key!='service'&&key!='componentId'){values[key]=listener[key];}}
ishares.components.refresh(componentId,service,values);}
dwr.engine.endBatch();};ishares.components.watchlist.addFund=function(fundId){ishares.components.fireEvent('onAddFund',{fundId:fundId});}
ishares.components.watchlist.removeFund=function(fundId){ishares.components.fireEvent('onRemoveFund',{fundId:fundId});}
ishares.components.watchlist.addField=function(fieldName){ishares.components.fireEvent('onAddField',{fieldName:fieldName});}
ishares.components.watchlist.removeField=function(fieldName){ishares.components.fireEvent('onRemoveField',{fieldName:fieldName});}
ishares.components.watchlist.edit=function(callback){ishares.components.fireBackgroundEvent('onEdit',{},callback);}
ishares.components.watchlist.save=function(callback){ishares.components.fireBackgroundEvent('onSave',{},callback);}