// UTF8‼
var v_bullet_count = 0;
var t_bullet_anim = null;

$(document).ready(function(){
	// Total Number of Bullets
	v_bullet_count = $('#feature .bullets li').length;
	// Text Shadow Replacement (after counting bullets)
	if (!$('html').css('textShadow')) {
		$('<ul/>').addClass('shdw').html($('#feature .bullets ul').html()).insertBefore('#feature .bullets ul');
		$('<h2/>').addClass('shdw').html($('#feature h2').html()).insertBefore('#feature h2');
	}
	// Duplicate Bullets for continuous loop
	$('#feature .bullets ul').each(function(){
		$(this).append($(this).html());
	});
	// Start Animation (after Pause)
	t_bullet_anim = setTimeout('f_feature_anim(1)',1000);
	// Start Slideshow
	$('#feature .slideshow').cycle();
	// Link entire banner
	$('#feature').css({'cursor':'pointer'}).click(function(){
		location.href = $(this).children('h2').children('a').attr('href');
		return false;
	});
});

function f_feature_anim(v_bullet_cur){
	// Ensure
	clearTimeout(t_bullet_anim);
	// When Looping
	if (v_bullet_cur == 1) {
		// Reset Positions (inc shadow) & Reset Opacities
		$('#feature .bullets ul').stop(true,true).css({'top':'0px'}).children('li').fadeTo(0,1);
		$('#feature .bullets ul.shdw').stop(true,true).css({'top':'1px'}).children('li').fadeTo(0,1);
	}
	// Fade Out Last Bullet (Not all the way to maintain height)
	$('#feature .bullets li:nth-child(' + (v_bullet_cur) + ')').fadeTo('slow',0.1);
	// Slide Bullets Up (inc shadow)
	$('#feature .bullets ul').each(function(){
		$(this).stop(true,true).animate({'top':($(this).position().top-22) + 'px'},1000);
	});
	if (v_bullet_cur < v_bullet_count) {
		// Move To Next Bullet
		v_bullet_cur++;
	} else {
		// Reset Bullet Count
		v_bullet_cur = 1;
	}
	// Start Next Animation (after Pause)
	t_bullet_anim = setTimeout('f_feature_anim(' + v_bullet_cur + ')',2000);
};
