  function changeItem(index){
    currIndex=index;
    for (var i=0;i<thumb.length;i++){
      document.all(thumb[i]).border="0";
    }
    document.all(thumb[index]).border="1";
    document.itemimage.src=imagesrc[index];
    document.all('itemdesc').innerHTML=itemdesc[index];
    document.all('describe').value=itemdesc[index];
    document.all('ID').value=itemid[index];
    document.all('thumbnail').value=imagesrc[index];
    document.cookie="thumb="+index;
    return false;
  }

  function setBorder(){
    for (var i=0;i<thumb.length;i++){
      document.all(thumb[i]).border="0";
    }
    document.all(thumb[getCookie("thumb")]).border="1";
  }

  function getCookie(name){
    var cookies = document.cookie;
    var cookieVal;
    if (cookies.indexOf(name) != -1){
      var startpos = cookies.indexOf(name)+name.length+1;
      var endpos = cookies.indexOf(";",startpos);
      if (endpos == -2) endpos = cookies.length;
      cookieVal=unescape(cookies.substring(startpos,endpos));
      if(cookieVal>thumb.length){
        cookieVal=0;
      }
      return cookieVal;
    }
    else {
      return 0; // the cookie couldn't be found! it was never set before, or it expired.
    }
  }

