﻿        
        function moveToPrevious(imageBoxInside)
        {
         
          var xCor = getObjectLeft(document.getElementById(imageBoxInside));
          
          if ((isNaN(xCor)) || (xCor >= 0))
          {
             return;
          }
          
          var moveVal = xCor + 100;
        
          if(moveVal >= 0)
          {
                moveVal = 100 - (xCor + 100);
                
             } 
           else
                moveVal = 100; 
                
           var moveVal;
          
          
          new Effect.Move(imageBoxInside, { x: moveVal, y: 0, transition: Effect.Transitions.sinoidal});
        } 

        function moveToNext(imageBox,imageBoxInside,tbImageList)
        {
          var otrImgBoxWdth = getObjectWidth(document.getElementById(imageBox));
          var xCor = getObjectLeft(document.getElementById(imageBoxInside));
          
          var tbWidth = getObjectWidth(document.getElementById(tbImageList));
          if (tbWidth < otrImgBoxWdth) return;
          var moveVal = tbWidth + xCor - 500;

          if (moveVal > 100)
          {
            moveVal=-100;
          }
          else
          if (moveVal <= 100)
          {
             moveVal = moveVal * -1;
          }
          if (isNaN(moveVal))
          moveVal = -100;
          new Effect.Move(imageBoxInside, { x: moveVal, y: 0, transition: Effect.Transitions.sinoidal});  
      
        }
             


function getObjectWidth(obj)  {
    var elem = getRawObject(obj);
    var result = 0;
    if (elem.offsetWidth) {
        result = elem.offsetWidth;
    } else if (elem.clip && elem.clip.width) {
        result = elem.clip.width;
    } else if (elem.style && elem.style.pixelWidth) {
        result = elem.style.pixelWidth;
    }
    return parseInt(result);
}
function getRawObject(obj) {
    var theObj;
    if (typeof obj == "string") {
        if (isW3C) {
            theObj = document.getElementById(obj);
        } else if (isIE4) {
            theObj = document.all(obj);
        } else if (isNN4) {
            theObj = seekLayer(document, obj);
        }
    } else {
        // pass through object reference
        theObj = obj;
    }
    return theObj;
}
function getObjectLeft(obj)  {
    var elem = getRawObject(obj);
    var result = 0;
    if (document.defaultView) {
        var style = document.defaultView;
        var cssDecl = style.getComputedStyle(elem, "");
        result = cssDecl.getPropertyValue("left");
    } else if (elem.currentStyle) {
        result = elem.currentStyle.left;
    } else if (elem.style) {
        result = elem.style.left;
    } else if (isNN4) {
        result = elem.left;
    }
    return parseInt(result);
}
