﻿// JScript File

/* 
Created by:
    David Hantson, who failed javascript on his examn.
*/


/*================================

Table of content:

closezoom()
makeimgvisible(id)
hideloader(id)
fadeIn(id)
zoom(igmlocation,imgalt)

================================*/
function closezoom()
{
    document.getElementById('foto_zoom').style.display='none';
    document.getElementById('zoom').style.display='none';
}

function makeimgvisible(id)
{
    document.getElementById(id).style.display='inline';
}

function hideloader(id)
{
    document.getElementById(id).getElementsByTagName('img')[0].style.display='none';
}

function fadeIn(id)
{
    if(opac<48)
    {
        //opac+=4;
        opac+=2+Math.round(opac/13);
        //Enable this if you want to fade it faster towards the end.
        //To wat i have noticed, IE gifs stop with the first and advance with the second.
        //Disable the first if u use the second and visa versa
        if(typeof document.getElementById(id).style.opacity == "string") {
            document.getElementById(id).style.opacity = (opac/100);
            document.getElementById('foto_zoom').style.opacity = ((opac+Math.round(opac/(2/3)))/100);
            //Enable this if you want the picture to fade along in FF (makes it slower)
        } 
        else
        {
            document.getElementById(id).filters.alpha.opacity = opac;
        }
        setTimeout("fadeIn('zoom')",40);
    }
}

function zoom(igmlocation,imgalt)
{
    opac = 0;
    var nodeloader = document.getElementById('zoom').getElementsByTagName('img')[0];
    nodeloader.style.display='inline';
    var node = document.getElementById('zoom');
    var nodeimg = document.getElementById('foto_zoom');
    node.style.display='inline';
    nodeimg.getElementsByTagName('img')[0].src=igmlocation;
    nodeimg.getElementsByTagName('img')[0].alt=imgalt;
    fadeIn('zoom');
    setTimeout("hideloader('zoom')",1400);
    setTimeout("makeimgvisible('foto_zoom')",700);
}