function externalLinks() {
    if (! document.getElementsByTagName ) return;
    var anchors = document.getElementsByTagName("a");
    var isIE = (document.documentElement.getAttribute("style") == document.documentElement.style);
    for (var i=0; i<anchors.length; i++) {
        if(anchors[i].getAttribute("href") && anchors[i].getAttribute("rel") == "external"){
            if(isIE) anchors[i].setAttribute("onclick",new Function("window.open(this.href); return false;"));
            else anchors[i].setAttribute("onclick","window.open(this.href); return false;");
        }
    }
}

function mail(account) {
    var tckw = [116,97,99,104,105,107,97,119,97,64,115,101,112,116,109,105,103,110,111,110,46,106,112];
    var osk  = [105,110,102,111,64,115,101,112,116,109,105,103,110,111,110,46,106,112];
    var mm1  = [116,45,115,101,112,116,109,105,103,110,111,110,49,64,111,99,45,105,46,106,112];
    var mm2  = [116,45,115,101,112,116,109,105,103,110,111,110,50,64,111,99,45,105,46,106,112];
    var ary;
    if(account == 'osk') {
        ary = osk;
    } else if(account == 'tckw') {
        ary = tckw;
    } else if(account == 'mm1') {
        ary = mm1;
    } else if(account == 'mm2') {
        ary = mm2;
    }
    var mail = ''
    for (var i=0; i<ary.length; i++)
        mail+=String.fromCharCode(ary[i])

    document.write('<a href="mailto:'+mail+'">'+mail+'</a>')
}

function formatMonthNavi() {
	$("div.navi-month > a").each(function() {
		var txt = $(this).html();
		ret = txt.match(/\d+/g);
		if(ret[1]) {
			txt = ret[1];
			txt = txt + '月';
			$(this).html(txt);
		}
	});
}

$(function() {

/* temporaly */
	$('.body .mag img').css('display','block');
	$('.body .workshopcalender img').css('display','block');
/* end temporaly */

	$('a.lb').lightBox();
	formatMonthNavi();
	externalLinks();
});
