function clickHandler(event) {
    var element = event.element();
	var atag = element.up('a')
    if (atag){
		$$('a.active').invoke('removeClassName','active');
        atag.addClassName('active');
    }
}

document.observe('dom:loaded', function() {
    $$(".more-views a").each(function(item){
        item.observe("click", clickHandler);
      });
});


function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
	thisfield.value = "";
	}
}
function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
	thisfield.value = defaulttext;
	}
}

function cleartext(thisfield, defaulttext) {
	if (thisfield.innerHTML == defaulttext) {
	thisfield.innerHTML = "";
	}
}

function clearrecall(thisfield, defaulttext) {
	if (thisfield.innerHTML == "") {
	thisfield.innerHTML = defaulttext;
	}
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// 20101026 +
/* News&Topics Teaser */

jQuery(document).ready(function($){
  if ($('.node-body-value')) {
    $('.node-body-value').hide();
    $('body').append('<div id="node-body-popup-wrapper">&nbsp;</div>');
    $('body').append('<div id="node-body-popup" class="node-body-popup">&nbsp;</div>');
    $('.node-body-more').click(function () {
      $('#node-body-popup-wrapper').show();
      /* 20101130031600 - 	 $('#node-body-popup').css('top', parseInt($('html, body').scrollTop()) + 100 + 'px'); */
      $('#node-body-popup').show();
      $('#node-body-popup').html($(this).parent().parent().parent().parent().parent().find('.node-body-value').html());
      /* 20101130024700 -    $('#node-body-popup').animate({height: '400px', opacity: 0.9}, 'slow');
         20101130024700 + */ var displayHeight = 500;
                             if ($.browser.mozilla) {
                               $(window).scrollTop(0);
                             }
                             $('#node-body-popup').animate({height: displayHeight + 'px', opacity: 0.9}, 1);
                             $('#node-body-popup .body').jScrollPane({showArrows:true});
                             $('#node-body-popup .jScrollPaneTrack').css('width', '13px');
                             $('#node-body-popup .jScrollPaneTrack').css('background-color', '#bbbbbb');
                             $('#node-body-popup .jScrollPaneDrag' ).css('width', '11px');
                             $('#node-body-popup .jScrollPaneTrack').css('border', '1px solid gray');
                             var width  = $(window).width();
                             var height = $(window).height();
                             var left = Math.floor((width - $('#node-body-popup').width()) / 2) + 20;
                             var top  = Math.floor((height - displayHeight) / 2) + $(window).scrollTop();
                             if (height < displayHeight) {
                               top = $(window).scrollTop();
                             }
                             $('#node-body-popup').css('top', top);
                             $('#node-body-popup').css('left', left);
                             /* Firefox:ここを生かすと 中央にポップアップできない。*/ $('html').css('overflow', 'hidden');
      $('#node-body-popup .close').click(function () {
        $(this).parent().hide();
        $('#node-body-popup-wrapper').hide();
        /* Firefox:ここを生かすと 中央にポップアップできない。*/ $('html').css('overflow', 'visible'); // 201011302570 +
        return false;
      });
      return false;
    });
  }
});

