﻿//
// Highlight an element in a marble slab and show it is clickable.
//
function highlight() {
    $(this).addClass("marbleplatehigh"); 
    var linkto = $(this).find("a").attr("href");
    if ((linkto != null) && (linkto != "#")) {
        $(this).css("cursor", "pointer");
        status = linkto;
    }
    else {
        status = "";
    }
}
//
// Undo hihglight
//
function lowlight() {
    $(this).removeClass("marbleplatehigh");
}

//
// This makes the box surrounding a hyperlick a clickable object
//
function clickmenu() {
    location = $(this).find("a").attr("href");
}

//
// Use superfish plugin to make sliding menus
//
function makeSlidingMenu() {
    //$('.nav li:has(ul)').find('a:first').addClass('sub');
    $('ul.nav').superfish({
        delay: 500
    });
}

//
// show picture from thumbnail gallery
//
function showGallery(evt) {
    evt.preventDefault();
    var imgPath = $(this).attr("href");
    var oldImg = $("#fadeinblock img");
    var thumb = $(this).children("[src]");
    if (thumb == null) { alert("bah"); return; }
    var altStr = thumb.attr("alt");
    var target;
    if (altStr == "Overzicht1") {
        target = './museum/P1280775.JPG';
    }
    if (altStr == "Overzicht2") {
        target = './museum/P1280777.JPG';
    }
    else if (altStr == "Overzicht3") {
        target = './museum/P1280779.JPG';
    }
    else if (altStr == "Maquette1") {
        target = './museum/P1230445.JPG'
    }
    else if (altStr == "Maquette2") {
        target = './museum/P1280484.JPG'
    }
    else if (altStr == "Stempels") {
        target = './museum/P1230465.JPG'
    }
    else if (altStr == "Bouwmateriaal") {
        target = './museum/P1230446.JPG'
    }
    else if (altStr == "Munten") {
        target = './museum/P1000279.JPG'
    }    
    else {
        target = './museum/P1280775.JPG'
    }
    var imgName = '<img src="' + target + '" alt="' + altStr + '" />';
    var newImg = $(imgName);
    newImg.hide();
    $("#fadeinblock").append(newImg);
    newImg.fadeIn(500);
    //oldImg.remove();
    oldImg.fadeOut(100, function() { $(this).remove(); });
    
}
