// 美しい
function largeimg(large, caption)
{
    var ih = document.getElementById('largeimg');
    var img = new Image();
    var t;

    ih.innerHTML = 'wait...';
    img.src = large;
    if (img.complete) {
        ih.style.height = img.height + 'px';
        t = '<img src="' + large + '" width="' + img.width
          + '" height="' + img.height;
        if (caption != undefined) {
            t += '" alt="' + caption + '" /><br />' + caption;
        } else {
            t += '" alt="" />';
        }
        ih.innerHTML = t;
    } else {
        img.onload = function() {
            ih.style.height = img.height + 'px';
            t = '<img src="' + large + '" width="' + img.width
              + '" height="' + img.height;
            if (caption != undefined) {
                t += '" alt="' + caption + '" /><br />' + caption;
            } else {
                t += '" alt="" />';
            }
            ih.innerHTML = t;
        }
        img.onerror = function() {
            alert('画像の読み込みに失敗しました：' + large);
        }
    }
}

function externalLink()
{
    if (!document.getElementsByTagName) return;

    var links = new Array('a', 'area');
    var target = new Array('href', 'href');

    for (var i = 0; i < links.length; i++) {
        var as = document.getElementsByTagName(links[i]);
        for (var j = 0; j < as.length; j++) {
            var a = as[j];
            var link = a.getAttribute(target[i]);
            if (!link.match(/orgm\.jp\/yell/)) {
                link = link.replace("orgm.jp/", "orgm.jp/yell/");
                a.setAttribute(target[i], link);
            }
            if (link.match(/^\//)) {
                link = '/yell' + link;
                a.setAttribute(target[i], link);
            }
            if (a.getAttribute('rel') &&
                a.getAttribute('rel') == 'external') {
                a.setAttribute('target', '_blank');
            }
        }
    }
}
