/*

functions used by the product detail page

*/
function setImageSource(baseSKU, thisSport, thisColor) {
  //var baseSKU = "MZ-W104";
  //var thisColor = "Y";
  if(thisSport && thisColor) var imageDirectory = "images/productZoom/" + baseSKU + "/" + baseSKU + "-" + thisSport + "-" + thisColor + "/";
  else if(!thisSport && thisColor) var imageDirectory = "images/productZoom/" + baseSKU + "/" + baseSKU + "-" + thisColor + "/";
  //alert(imageDirectory);
  window.document.imageViewer.Rewind();
  window.document.imageViewer.SetVariable("zoomifyImagePath", imageDirectory);
  window.document.imageViewer.Play();
}

var tabCountForPopup = 5

var imageArray = new Array(); // JavaScript Array Element to Hold the image path of relevent images in Tab Structure

imageArray[0] = "images/features_off.gif"+","+"images/features_over.gif";
imageArray[1] = "images/description_off.gif"+","+"images/description_over.gif";
imageArray[2] = "images/addition_off.gif"+","+"images/addition_over.gif";
imageArray[3] = "images/shipping_off.gif"+","+"images/shipping_over.gif";
imageArray[4] = "images/sizing_off.gif"+","+"images/sizing_over.gif";
 
var tabUrl = "/gp/detail-tab-popup.html/ref=in_de_detail-item-tab-struct/602-5278460-3761433?%5Fencoding=UTF8&orgUnit=16&prodGroup=&asin=B0007U0MHO";

// Variables to hold the count of features, additional info, shipping info , description
var featureCount = "3";
var descriptionCount = "286";
var addInfoCount = "3";
var shipInfoCount = "4";
   
var countOfMoreImages = "1"; // Get the count of Large Images in Product Directory

var tabFlag = 0;

function changeDetailPageTab(imgIndex, tabCount) {
  for (var i=0; i<tabCount; i++) {
    document.getElementById('tab'+i).src = (imageArray[i].split(','))[0];
    document.getElementById('div'+i).style.display = "none";
  }
  document.getElementById('tab'+imgIndex).src = (imageArray[imgIndex].split(','))[1];
  document.getElementById('div'+imgIndex).style.display = "block";
  tabFlag = imgIndex;
  changeSeeMoreInfoImage(imgIndex, tabCount);
  suppressImageTab(tabCount)
}

function changeSeeMoreInfoImage(imgIndex, tabCount) {
  if((imgIndex==0)&&(tabCount==4)) {
    if( featureCount <= 6 ) {
      document.getElementById('more_info_img').style.display = "none";
    } else {
      document.getElementById('more_info_img').style.display = "block";
    }
  } else if ((imgIndex==1)&&(tabCount==4)) {
    if( descriptionCount <= 500 ) {
      document.getElementById('more_info_img').style.display = "none";
    } else {
      document.getElementById('more_info_img').style.display = "block";
    }
  } else if ((imgIndex==2)&&(tabCount==4)) {
    if( addInfoCount <= 6 ) {
      document.getElementById('more_info_img').style.display = "none";
    } else {
      document.getElementById('more_info_img').style.display = "block";
    }
  } else if ((imgIndex==3)&&(tabCount==4)) {
    if( shipInfoCount <= 6 ) {
      document.getElementById('more_info_img').style.display = "none";
    } else {
      document.getElementById('more_info_img').style.display = "block";
    }
  }
}

function suppressImageTab(tabCount) {
  if((tabCount==5)&&(countOfMoreImages==0)) {
    document.getElementById('tab4').style.display = "none";
  }
}

