// Aspen Fasteners functions

// Clickable image rotation used in "features" cell
var AspenRotateImgs;
var AspenRotateLnks;
var AspenRotateImgRef;
var AspenRotateLnkRef;
var AspenRotateWait = 7000;
function AspenRotateImages(nImage) {
   var aImg = AspenRotateImgs;
   var aLnk = AspenRotateLnks;
   var oImgRef = AspenRotateImgRef;
   var oLnkRef = AspenRotateLnkRef;
   
   if (nImage >= aImg.length) {
      nImage = 0;
   }
   oImgRef.src = aImg[nImage];
   oLnkRef.href = aLnk[nImage];
   window.setTimeout("AspenRotateImages(" + (nImage + 1) + ")", AspenRotateWait);
}

// Slifers - text messages that "slide" onto the page
function AspenSlideMsg(sMsgId, nWidth, nDuration, nWhen) {
   var sExec = "AspenSlideMsgTimer('" 
   	+ sMsgId + "'," 
   	+ nWidth + "," 
   	+ nDuration + ");"
   window.setTimeout(sExec, Math.ceil(nWhen * 1000));
   return false;
}
function AspenSlideMsgTimer(sMsgId, nFinalWidth, nFinalDuration) {
   var oStyle = document.getElementById(sMsgId).style;
   var nWidth;
   var nFinalDurationMs;
   var nDurationMs
   var sExec;
   nFinalDurationMs = Math.ceil(nFinalDuration * 1000)
   oStyle.overflow = "hidden";
   oStyle.whiteSpace = "nowrap";
   oStyle.display = "block";
   oStyle.visibility = "visible";
   oStyle.clear = "both";
   for (var i=0; i <= 100; i += 10) {
      nWidth = Math.ceil(nFinalWidth * (i/100));
      nDurationMs = Math.ceil(nFinalDurationMs * (i/100));
      sExec = "document.getElementById('" + sMsgId + "').style.width='" + nWidth + "px'";
      window.setTimeout(sExec, nDurationMs);
   }
}