$(function () {
			

	// 更换新闻链接的 thumbnail
	$('.block .block.newslist li a').mouseover(function () {
		var a = $(this),
			li = a.closest('li'),
			thumbnail = li.closest('.content').find('img.thumbnail');
		if (thumbnail.length > 0 || li.attr('thumbnail')) {
			thumbnail.attr('src', li.attr('thumbnail'));
		}
	});

	// 资源链接的二级菜单
	$('.block.menu > .content > ul').each(function () {
		var ul = $(this);
		ul.find('> li > a').mouseover(function () {
			ul.find('> li > ul').hide();
			$(this).siblings('ul').show();
		});
		ul.find('> li > ul').mouseleave(function () {
			$(this).hide();
		});
	});

	// slideshow
	(function () {

		var slideshow = $('.block.hotspot .slideshow'),
			shows = slideshow.find('> .show > li'),
			sels = slideshow.find('> .selector > li');

		var current = 0;
		var timer = null;

		var active = function (i) {
			shows.hide();
			shows.eq(i).show();
			sels.removeClass('selected');
			sels.eq(i).addClass('selected');
			current = i;
		};

		var auto = function () {
			timer = window.setInterval(function () {
				current = (current + 1) % sels.length;
				active(current);
			}, 5000);
		};

		sels.mouseover(function () {
			window.clearInterval(timer);
			active(sels.index(this));
		});

		slideshow.find('> .selector').mouseleave(function () {
			auto();
		});

		active(0);
		auto();

	}) ();

//	// 公益广告播放
//	(function () {
//
//		var psa = $('.block.psa'),
//			playing = psa.find('.playing'),
//			video = playing.find('.video'),
//			links = psa.find('.list > ul > li > a');
//
//        var html =	'	<embed id="player" class="player" src="http://static.ce65.com/player/player.swf?file=#FILE#&image=#PREVIEW#&hl=en&fs=true"' +
////		var html =	'	<embed id="player" class="player" src="./pastry/demo/video/player.swf?file=#FILE#&preview=#PREVIEW#&hl=en&fs=true"' +
//								'		allowFullScreen="true"' +
//								'		allowScriptAccess="always" ' +
//								'		type="application/x-shockwave-flash">' +
//								'	</embed>';
//
//		var active = function (link) {
//			video.html(html.replace('#FILE#', link.attr('href')).replace('#PREVIEW#', link.attr('preview')));
//			playing.find('h4').html(link.siblings('h4').html());
//			playing.find('.info').html(link.siblings('.info').html());
//		};
//
//		links.click(function () {
//			try {
//				active($(this));
//			} finally {
//				return false;
//			}
//		});
//
//		active(links.eq(0));
//
//	}) ();
});