﻿function addLoadEvent(func)
{
    var oldonload = window.onload;
    if (typeof window.onload != 'function')
    {
        window.onload = func;
    }
    else
    {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

function prepareLinks()
{
    if (!document.getElementById) return false;
    if (!document.getElementsByTagName) return false;
    
    var content = document.getElementById("content");
    if (!content) return false;
    
    var images = content.getElementsByTagName("img");
    for (var i = 0; i < images.length; i++)
    {
        var anchor = images[i].parentNode;
        if (anchor.nodeName == "A")
        {
            anchor.onclick = function()
            {
                return showDetails(this);
            }
        }
    }
}

function showDetails(anchor)
{
    var href = anchor.getAttribute("href");
    var target = anchor.getAttribute("target");
    
    var win = window.open(href, target, "width=650,height=750,scrollbars=1,resizable=1");
    if (win && !win.closed)
    {
        win.focus();
    }
}

function confirmDelete(title)
{
	return confirm("Are you sure you want to delete '" + title + "'?");
}

addLoadEvent(prepareLinks);