// JavaScript Document



  var selectedDetailTabName;

  function changeDetailPageTab(tabName) {

    for (var i in tabArray) {
    
      var tabObj = tabArray[i];
      
      if (tabObj == null)
        continue;
        
      // set the tab image to 'on' or 'off'
      var tab = document.getElementById('tab_' + tabObj.name);
      if (tab != null){
        tab.type = "image";
        if (tabObj.name == tabName)
          tab.src = tabObj.onImg;
        else
          tab.src = tabObj.offImg;
      }
      // show this tab, hide all others
      var div = document.getElementById('div_' + tabObj.name);
      if (div != null)
        if (tabObj.name == tabName) 
          div.style.display = "block";
        else
          div.style.display = "none";
      // Turn the accessibility images off.
       var div2 = document.getElementById('access_' + tabObj.name);
       if (div2 != null) 
          div2.style.display = "none";
  
    } // foreach tab

    // remeber which tab is selected
    selectedDetailTabName = tabName;
   
    // Handle accessibility text.
    var access = document.getElementById('ddiv');
    var text = "There are " + tabArray.length + " buttons in the next section, to make the tab readable click it and navigate past the buttons. The currently selected tab is " + tabName + ".";
    access.innerHTML = text;
 
    // hide or display the "see more info" link
    var moreInfoLink = document.getElementById('moreInfoLink');
    if (moreInfoLink != null) {
      if (tabObj.enableMoreInfoLink)
        moreInfoLink.style.display = "block";
      else
        moreInfoLink.style.display = "none";
    }
    

  }

  function setTabFocus(e, tabName) {
    var key;
    if (window.event) key = e.keyCode;
    if (e.which) key = e.which;
    if (key != 13) return;
    changeDetailPageTab(tabName);
  }

  function openDetailTabPopup(url, tabToSelect) {
    
    if (tabToSelect != null)
      url  = url + '&tabToSelect=' + tabToSelect;

    window_handle = window.open(url,
                                'ProductDetail',
                                "location=0,menubar=0,resizable=no,height=550,width=600,scrollbars=yes,left=220,screenX=220,top=70,screenY=70"
                              );
    if( window_handle ){
        window_handle.focus();
    }
  }
 
 
 





function promotionDetailsPopup(mylink, choice) {

  if (! window.focus) return true;
  var href;
  if (typeof(mylink) == 'string')
    href=mylink;
  else
    href=mylink.href;
    
  href+='?choice='+choice;
  window.open(href, 'OfferDetailsPopUp', 'location=0,menubar=0,resizable=no,height=600,width=295,scrollbars=yes,left=220,screenX=220,top=70,screenY=70');
  return false;
}


function openHolidayPopUp() {
  var h;
  h = window.open('/gp/redirect.html?location=http://www.target.com/gp/browse.html?node=3003591', '', 'location=0,menubar=0,resizable=no,width=579,height=510,scrollbars=yes,left=20,screenX=20,top=20,screenY=20');
  if( h ){
      h.focus();
  }
}

function hm_popup_onclick() {
    var anc = document.getElementById("hm_popup_anchor");
    if(anc && anc.href) {
      var ContextWindow = window.open(anc.href, "top", "width=447,height=500,scrollbars=1");
      ContextWindow.focus();
      return false;
    }
}



