﻿var currentImgPos = 0;
var arrayOfImgSrcs;

function changeMainImg(newsrc, newhref)
{
  document.getElementById("productpagebigimage").src = newsrc;
  document.getElementById("maina").href = newhref;
}    

function moveNext()
{
  if (arrayOfImgSrcs != null && arrayOfImgSrcs.length > 0)
  {
    if (currentImgPos < arrayOfImgSrcs.length - 1)
    {
      currentImgPos++;
    }
    else
    {
      currentImgPos = 0;
    }          
    document.getElementById("productpagebigimage").src = arrayOfImgSrcs[currentImgPos];
    //document.getElementById("maina").href = arrayOfImgSrcs[currentImgPos];
  }
}    

function movePrev()
{
  if (arrayOfImgSrcs != null && arrayOfImgSrcs.length > 0)
  {
    if (currentImgPos > 0)
    {
      currentImgPos--;
    }
    else
    {
      currentImgPos = arrayOfImgSrcs.length - 1;
    }          
    document.getElementById("productpagebigimage").src = arrayOfImgSrcs[currentImgPos];
    //document.getElementById("maina").href = arrayOfImgSrcs[currentImgPos];
  }
}    

function intialImgList(listOfImgs)
{
  var currentImgPos = 0;
  if (listOfImgs != null)
  {
    arrayOfImgSrcs = listOfImgs.split(' ');
  }
}
