var popupBoxName = '';
function popupBoxOn(popupBox) {
  document.getElementById(popupBox).style.visibility = 'visible';
  document.getElementById(popupBox).style.display = 'block';
}
function popupBoxOff(popupBox) {
  document.getElementById(popupBox).style.visibility = 'hidden';
  document.getElementById(popupBox).style.display = 'none';
}

// TOGGLES THE DROPDOWN MENU ON THE SEE FOR YOURSELF PAGE
function toggleDrop(idName) {
  if (document.getElementById(idName).style.visibility!="visible")
    document.getElementById(idName).style.visibility = "visible";
  else
    document.getElementById(idName).style.visibility = "hidden";
}


var currDrop = '';
var currSubDrop = '';

function dropFilter(idName, idSubName, title) {
  if (currDrop != '') {
    document.getElementById(currDrop).style.visibility = "hidden";
  }
  if (document.getElementById('core_solutions_2').style.visibility!="visible") {
    toggleDrop(idName);
  }
  toggleDrop(idSubName);
  toggleDrop('core_drop_1');
  document.getElementById('selectCopy').innerHTML=title;
  document.getElementById('selectSubCopy').innerHTML = 'Please select';
  document.getElementById('coreTable').innerHTML = '';
  currDrop = idSubName;
  currSubDrop = idName;
}

function toggleTable(tableName,title) {
  toggleDrop(currDrop);
  document.getElementById('selectSubCopy').innerHTML=title;
  document.getElementById('coreTable').innerHTML = document.getElementById(tableName).innerHTML;
  document.getElementById('default_disclosure').style.display = 'block';
}

function toggleTableAlt(tableName,title) {
  if (currSubDrop != '') {
    document.getElementById(currSubDrop).style.visibility = "hidden";
  }
  if (currDrop != '') {
    document.getElementById(currDrop).style.visibility = "hidden";
  }
  toggleDrop('core_drop_1');
  document.getElementById('selectCopy').innerHTML=title;
  document.getElementById('coreTable').innerHTML = document.getElementById(tableName).innerHTML;
  document.getElementById('default_disclosure').style.display = 'block';
}


// FACILITATES ALL LINKS FROM THE FLASH/SEE FOR YOURSELF PAGES BACK TO THE MAIN PARENT WINDOW
function externalLink(link) {
 if (window.opener && !window.opener.closed) {
   window.opener.focus();
   window.opener.location.href = link;
 }
 else {
   isharesWindow=this.open(link,"iShares");
   isharesWindow.focus();
 }
} 

// IMPORTANT INFORMATION LINK ON THE SEE FOR YOURSELF PAGE -- LIGHTBOX EFFECT
function showDisclaimer() {
  document.getElementById('light').style.display='block';
  document.getElementById('fade').style.display='block';
}
function hideDisclaimer() {
  document.getElementById('light').style.display='none';
  document.getElementById('fade').style.display='none';
}


// DISCLAIMER FUNCTION FOR FLASH -- MAKES DISCLAIMER OPEN BELOW FLASH AND JUMPS TO ANCHOR
function flashDisclaimerOff(content) {
  document.getElementById('disclaimer_container').innerHTML = '';
  window.location.hash='versus_top';
}
function flashDisclaimerOn(content) {
  document.getElementById('disclaimer_container').innerHTML = document.getElementById(content).innerHTML;
  window.location.hash='information';
}      
function flashDisclaimer(content) {
  if (document.getElementById('disclaimer_container').innerHTML == '') {
    flashDisclaimerOn(content);
  }
  else {
    flashDisclaimerOff(content);
  }
}

// PULLS THE QUERYSTRING FOR THE pageName VARIABLE FOR DIFFERENT PAGE VIEWS WITHIN THE FLASH
function getQueryVariable(variable) { 
  var query = window.location.search.substring(1); 
  var vars = query.split("&"); 
  for (var i=0;i<vars.length;i++) { 
    var pair = vars[i].split("="); 
    if (pair[0] == variable) { 
      return pair[1]; 
    } 
  }  
} 

// LAUNCHES ANY LINKS TO VIDEOS IN A SIZED POPUP WINDOW
function openVideo(page){
  coreWindow=this.open(page,"Core_Video","toolbar=no,resizable=no,scrollbars=no,height=390,width=490");
  coreWindow.focus();
}

function openSpecial(name) {
  window.open('/misc/emailafriend.htm',name,"toolbar=no,resizable=no,scrollbars=no,height=580,width=420");
}

function hitboxDownload(doc_title) {
  _hbSet('cv.c18',doc_title+'|versus_mf'); 
  _hbSend(); 
  _hbDownload('versus_mf:'+doc_title);
}     

function mf_page_view(page_name,link_name) {
  var link_name = '';
  ntptEventTag('pv=1&cc1=' + cms_cc1 + '&cc2=' + cms_cc2 + '&cc3=' + cms_cc3 + '&pagename=' + escape(page_name) + '&fullpn=' + sitevar + ':' + cms_lang + ':' + escape(page_name));
  if (link_name != '') {
    ntptEventTag('ev=link&linkname=' + escape(link_name));
  }
}

function mf_video_start(video_name) {
  ntptEventTag('pv=1&cc1=Content&cc2=Resources&cc3=Video&pagename=' + escape(video_name) + '&fullpn=' + sitevar + ':' + cms_lang + ':' + escape(video_name));
}

function mf_download(path,link_name) {
  ntptEventTag('ev=filedownload&filename=US/EN/' + escape(path));
  ntptEventTag('ev=link&linkname=' + escape(link_name));
}

function unicaTrack() {
  ntptEventTag('ev=search_mf&tkr_mf=' + escape(document.tickerSearch.qt.value));
  ntptEventTag('ev=link&linkname=' + escape('Submit Button'));
}