/**
 *
 */


function 
lavalamp_init() 
{
      $("#lavalamp .lavalamp li").each( function() {
		  var o = $(this);
		  o.addClass("lava");
	  } );

      $("#lavalamp .lavalamp ol li").each( function() {
		  var o = $(this);
		  o.removeClass("lava");
	  } );

      $("#lavalamp .lavalamp li.lava").each( function() {
		  var o = $(this);
		  o.hover( function () {
			  var html;
			  if( $( 'ol', o ).length ) {
				  html = $( 'ol', o ).html();
			  } else {
				  html = null;
			  }
			  if( html == null || html == '' )  {
				  html = '';
			  } else {
				  html = "<div class=inner><ul>" + html + "</ul></div>";
			  }

			  var d = $('#lavapopup');
			  d.hide();
			  d.html( html );
			  d.css( 'top' , o.offset().top  + o.height() );
			  d.css( 'left', o.offset().left );

			  if( html != null && html != "" ) {
				  d.slideDown( "normal" );
				  $( 'li', d ).hover( function() {
					  $(this).css( 'background', "#eee" );
				  } , function() {
					  $(this).css( 'background', "none" );
				  } );
				  d.hover( function() {
					  // nothing
				  } , function () {
					  if( d.html() != '' ) {
						  d.hide();
						  d.html( '' );
						  if( lavaLamp_delay_hide ) {
							  lavaLamp_delay_hide();
						  }
					  }
				  } );
			  } else {
				  d.show();
			  }
		  }, function () {
			  // nothing;
		  } );
	  } );

      $("#lavalamp .lavalamp").lavaLamp({
          fx: "backout",
          speed: 700,
          click: function(event, menuItem) {
              return true;
          }
	  });
}

$(window).load( function() {
	  $('#zoukei').click( function () {
		  window.open( "jump/jump_zoukei.html", "_blank" );
	  } ).css( 'cursor', 'pointer' ).hover(
		  function () {
			  //
		  },
		  function () {
			  //
		  }
	  );

	  $('A').each( function () {
		   var o;
		   var href;
		   o = $(this);
		   href = o.attr( 'href' );
		   if( href && href.match( /^#/ ) ) {
			   o.click( function () {
				   var o = $(this);
				   href = o.attr( 'href' );
				   href = href.replace( /^#/, "" );
				   href = 'a[name=' + href + ']';
				   $.scrollTo( href, 1000 );
				   return false;
			   } );
		   }
	   } );

	   $('.vadj_flag').each( function () {
		   var o;
		   o = $(this);
		   var box_l;
		   var box_r;

		   box_l = $('.c_left .box_inner', o );
		   box_r = $('.c_right .box_inner', o );

		   var h_l;
		   var h_r;

		   h_l = box_l.height();
		   h_r = box_r.height();

		   var t;
		   var m;
		   var b;

		   if( h_r < 90 ) {
			   h_r = 90;
		   }

		   if( h_r > h_l ) {
			   t = $('.last', box_l);
			   t.css( 'margin-top', 0 );
			   t.css( 'margin-bottom', 0 );
			   h_l = box_l.height();
			   b = (h_r - h_l);
			   b -= 4;
			   m = Math.floor( b / 2);
			   t.css( 'padding-top',  m );
			   t.css( 'padding-bottom', b - m );
		   }
	   } );
} );

$( function() {
	   lavalamp_init();
} );
/**
 *
 */

