﻿//**********************************************************
// Author: Maciej Lewinski
// Created on: 16.07.2008
//
// Description:
//   This file contains functions to manipulate images
//*********************************************************

// Function that searches for image with id=source* in de sourcediv and put it in src of the 
// destination image
function showBigImage(source, sourcediv, destination) {
    // Do it only if not in editor
    if (!CmsEditorActive) {
        // Get big images
        var div = document.getElementById(sourcediv);
        var images = div.getElementsByTagName('img');
        
        // Search fot the big image of the hovered image
        for (var i = 0; i < images.length; i++) {
            var id = images[i].getAttribute('id');
            id = id.substring(0,id.indexOf(':'));
            
            if (id == source) {
                document.getElementById(destination).src = images[i].src;
            } // end if
        } // end for

    }
}

// Funcion that searches for an image in sourcediv and shows the first one found
function showAnBigImage(sourcediv, destination) {
    // Do it only if not in editor
    if (!CmsEditorActive) {
        // Get big images
        var div = document.getElementById(sourcediv);
        var images = div.getElementsByTagName('img');
        
        // Show the first one if it exists
         if (images.length != 0) {
            document.getElementById(destination).src = images[0].src;
            document.getElementById(destination).style.display = "block";
         } 
    }
}

function showpicture(source, destination) {
    document.getElementById(destination).src = document.getElementById(source).src
}
