  myId = "";
  mySource = "";

  function restoreThumbs() {
    for (i=0;i<thumbs.length;i++) {
      imgWallpaper = "wallpaper" + i;
      divLense     = "lense" + i;
      document.images[imgWallpaper].src = thumbs[i];
      setVisibility(divLense,1);
    }
  }

  function restoreLenses() {
    for (i=0;i<thumbs.length;i++) {
      divLense     = "lense" + i;
      setVisibility(divLense,1);
    }
  }

  function openDialog(thisDialog) {
    setVisibility("dialog" + thisDialog,1);
    for(i=0;i<thumbs.length;i++) {
      if (i != thisDialog) {
        layerName = "dialog" + i;
        setVisibility(layerName,0);
      }
    }
  }

  function preLoadBigImage(id) {
    myId = id;
    bigImage          = new Image();
    bigImage.onabort  = loadUpdate;
    bigImage.onerror  = loadUpdate;
    bigImage.onload   = loadUpdate;
    bigImage.src      = big_standard_url[id];
  }

  function loadUpdate() {
    if (checkObject()) {
      setVisibility("bigImageLoader",0);
      setClassName("wallpaperBody","");
      rewriteBigImageNavi(myId);
      document.images["bigImageDummy"].src = bigImage.src;
      setVisibility("bigImageLayer",1);
      setVisibility("bigImageNavi",1);
      //closeModulNavi();
      moduleNavigation.startFold( true );
      restoreLenses();
      restoreThumbs();
    }
  }

  function checkObject() {
    actualImageSrc = big_standard_url[myId].replace(/\.\.\//g,"");
    if (bigImage.src.indexOf(actualImageSrc) != -1) {
      return true;
    }
    else {
      return false;
    }
  }


  function nextImage(currentId, direction) {
    setVisibility("bigImageLoader",1);
    setClassName("wallpaperBody","loading");
    if(direction == "next") {
      if(currentId >= thumbs.length-1) {thisId = 0;} else {thisId = currentId + 1;}
    }
    else {
      if(currentId == 0) {thisId = thumbs.length-1;} else {thisId = currentId - 1;}
    }
    preLoadBigImage(thisId);
  }

  function prepareBigImage(id) {
    restoreThumbs();
    restoreLenses();
    imgWallpaper = "wallpaper" + id;
    lenseLayer   = "lense" + id;
    setVisibility(lenseLayer,0);
    document.images[imgWallpaper].src = loadingBoxImage;
    preLoadBigImage(id);
  }

  function rewriteBigImageNavi(id) {
    myNavigation = '<div class="dialogBox">';
    myNavigation += '<a id="nextImage" href="javascript:nextImage(' + id + ',\'next\')"  class="arrow">' + transImage + nextImageText + '</a><br>';
    myNavigation += '<div style="height:3px; overflow:hidden;"></div>';
    myNavigation += '<a id="prevImage" href="javascript:nextImage(' + id + ',\'prev\')" class="arrow">' + transImage + previousImageText + '</a><br>';
    myNavigation += '<div style="height:3px; overflow:hidden;"></div>';
    myNavigation += '<a href="javascript:closeMediaView();" class="arrow">' + transImage + returnText + '</a><br>';
    myNavigation += '<img src="' + greyGif + '" width="189" height="1" vspace="5">'
    myNavigation += '<a href="javascript:abortPreload();download(\'' + big_standard_url[id] + '\')" onClick="trackDownload(\'' + big_standard_url[id] + '\', \'' + downloadTrackFileType + '\', \'' + downloadTrackFileGroup + '\');" class="arrow">' + transImage + big_standard_dimension[id] +', JPG, ' + big_standard_size[id] + '</a><br>';
    if(big_second_url[id]) {
      myNavigation += '<div style="height:3px; overflow:hidden;"></div>';
      myNavigation += '<a href="javascript:abortPreload();download(\'' + big_second_url[id] + '\')" onClick="trackDownload(\'' + big_second_url[id] + '\', \'' + downloadTrackFileType + '\', \'' + downloadTrackFileGroup + '\');" class="arrow">' + transImage + big_second_dimension[id] + ', JPG, ' + big_second_size[id] + '</a><br>';
    }
    if(big_third_url[id]) {
      myNavigation += '<div style="height:3px; overflow:hidden;"></div>';
      myNavigation += '<a href="javascript:abortPreload();download(\'' + big_third_url[id] + '\')" onClick="trackDownload(\'' + big_third_url[id] + '\', \'' + downloadTrackFileType + '\', \'' + downloadTrackFileGroup + '\');" class="arrow">' + transImage + big_third_dimension[id] + ', JPG, ' + big_third_size[id] + '</a><br>';
    }
    myNavigation += '</div>';
    writeIntoLayer('bigImageNavi',myNavigation);
  }

  function closeMediaView() {
    restoreLenses();
    restoreThumbs();
    setVisibility('bigImageLayer',0);
    setVisibility('bigImageNavi',0);
    //openModulNavi();
    moduleNavigation.startFold( false );
  }

  function abortPreload() {
    setVisibility("bigImageLoader",0);
    setClassName("wallpaperBody","");
  }

  function closeNaviEvent() {
    setClassName("bigImageNavi","bigImageNaviTop");
  }

  function openNaviEvent() {
    setClassName("bigImageNavi","bigImageNaviBottom");
  }

  function setBigImageLayer() {
    getWindowInformation('winHeight');
    topSize = (getWindowInformation('winHeight') - 14 - 29) - 768;

    if(topSize < 0) {
      moveObject(bigImageLayer,0,topSize);
    }
  }

function trackDownload(fileName) {

    return true;
  }