$(document).ready(function () {
	$('a.external').click(function(){
		window.open(this.href);
		return false;
	});
	
	$('#register-name').blur(function(){
		playerName = $(this).val();
		$('#name-field').val(playerName)
	});
	
	$('#mce-EMAIL, #email-field').focus(function(){
		if($(this).val() == "Enter Your Email...")
			$(this).val("");
	});
	
	$('#mce-EMAIL, #email-field').blur(function(){
		if($(this).val() == "")
			$(this).val("Enter Your Email...");
	});
	
	var dataSource = new ctRotatorBridgeLi($('#news-ticker')).getDataSource();
		
	$('#news-ticker').ctRotator(dataSource, {
		showCount: 1,
		speed: 5000,
		fadeOutSpeed: 1000,
		fadeInSpeed: 1000,
	
		itemRenderer: function(item){   
			return '<li class="rotator-item">' +
						'<span class="time">' + item.time + ' - </span>' +
						'<h3><a href="' + item.url + '">' + item.title + '</a></h3>' +
					'</li>';
		}
	});

	$('a#terms-link').colorbox({
		href: "http://sportpartnersusa.com/index.php/events/terms",
		initialHeight: 180,
		initialWidth: 200,
		height: 300,
		width: 657
	}, function(){
		sIFR.replace(avenir, {
			selector: 'h1',
			css: '.sIFR-root {color: #540819;}',
			wmode: 'transparent'
		});
	});
	
	$('#photo-list a').colorbox({
		maxHeight: 700
	});
	
	$('#home #launch-video').colorbox({
		open: true,
		iframe: true,
		href: "http://sportpartnersusa.com/video-promo/home",
		width: 512,
		height: 360,
		scrolling: false
	});
	
	$('#screenshot a').colorbox({
		iframe: true,
		href: "http://sportpartnersusa.com/video-promo/products",
		width: 512,
		height: 360,
		scrolling: false
	});
	
	$('#flash-banner ul').after('<ol></ol>').cycle({
		fx: 'fade',
		speed: 1000,
		timeout: 5000,
		pager: '#flash-banner ol',
		pagerAnchorBuilder: function(idx, img){
			return '<li><a href="#">' + (+idx+1) + '</a></li>';
		}
	});
});