<!-- Javascript for photo swap -->

// array can contain object references, element ids, or both
var thumbIds = ["CT08_thumb_1", "CT08_thumb_2", "CT08_thumb_3", "CT08_thumb_4", "CT08_thumb_5", "CT08_thumb_6", "CT08_thumb_7", "CT08_thumb_8", "CT08_thumb_9", "CT08_thumb_10", "CT08_thumb_11", "CT08_thumb_12", "CT08_thumb_13"];
var mainIds = ["CT_Product_1", "CT_Product_2", "CT_Product_3", "CT_Product_4", "CT_Product_5", "CT_Product_6", "CT_Product_7", "CT_Product_8", "CT_Product_9", "CT_Product_10", "CT_Product_11", "CT_Product_12", "CT_Product_13"];

function fnCallback(e) {
      var thumbId = YAHOO.util.Event.getTarget(e).id;
      // 16 is the number of characters in the id (before the trailing number)
      var targetId = thumbId.substring(11, thumbId.length); // the number at the end of the thumbnail      
      var mainId = 'CT_Product_' + targetId;
  
      // set all main content to hidden
      for (var i = 1; i <= mainIds.length; i++) {
            var temp = 'CT_Product_' + i;
            document.getElementById(temp).style.visibility = 'hidden';
      }
      
      // make main content of clicked on thumb visible
      document.getElementById(mainId).style.visibility = 'visible';
}

YAHOO.util.Event.addListener(thumbIds, "click", fnCallback);
  