<!--
/*
* Tadas Juozapaitis ( kasp3rito@gmail.com )
*/

(function($){
$.fn.vTicker = function(options) {
	var defaults = {
		speed: 700,
		pause: 6000,
		showItems: 1
	};

	var options = $.extend(defaults, options);

	moveUp = function(obj, height){
		first = obj.children('ul').children('li:first').clone(true);
		obj.children('ul')
		.animate({top: '-=' + height + 'px'}, options.speed, function() {
			$(this).children('li:first').remove();
			$(this).css('top', '0px');
		});

		first.appendTo(obj.children('ul'));
	};
	
	return this.each(function() {
		obj = $(this);
		maxHeight = 0;

		obj.css({overflow: 'hidden', position: 'relative'})
			.children('ul').css({position: 'absolute', margin: 0, padding: 0})
			.children('li').css({margin: 0, padding: 0});

		obj.children('ul').children('li').each(function(){
			if($(this).height() > maxHeight)
			{
				maxHeight = $(this).height();
			}
		});

		obj.children('ul').children('li').each(function(){
			$(this).height(maxHeight);
		});

		obj.height(maxHeight * options.showItems);
		
    	interval = setInterval('moveUp(obj, maxHeight)', options.pause);
	});
};
})(jQuery);


$(document).ready(function(){
	// スポンサー
	$('#sponsorBnr p:last-child').css('margin-bottom','0');

	// リンクリスト
	$('#linkList li:last-child').css('margin-bottom','0');

	// ヘッドラインテロップ
	$('#ticker').vTicker();

	// NEWを表示
	var currentDate = new Date();
	for(var i = 0; i < $('#information dl').length; i++){
		$('#information dl').each(function(){
			var pass = '168';// passage time
			var content = '　<strong class="new">NEW</strong>' // display content

			var newmarkAttr = $(this).children('dt').html();
			var time = newmarkAttr.split("/");
			var entryDate = new Date(time[0], time[1]-1, time[2], 00, 00, 00);
			var now = (currentDate.getTime() - entryDate.getTime())/(60*60*1000);
			now = Math.ceil(now);
			if(now <= pass){
				$(this).eq(i).children('dd').append(content);
			}
		});
	}

	// ギャラリー
	$('#photos').css('margin', '0').css('visibility','hidden').css('text-align','left');
	$('#photos ul').galleryView({
		panel_width: 580,
		panel_height: 235,
		frame_width: 140,
		frame_height: 57,
		transition_interval: 7000,
		nav_theme: 'dark',
		show_captions: false
	});
});
//-->