var regexEmail = /^([\w-\+]+(?:\.[\w-\+]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

function initRotatingList() {
    $("#statements ol li:gt(0)").hide();
    
    rotate();
}

function rotate() {
    $("#statements ol li").fadeOut(500);
    $("#statements ol li:last").prependTo("#statements ol");
    $("#statements ol li:first").fadeIn(1000);
    
    var timer = window.setTimeout('rotate()', 4500);
};

$(document).ready(function(){
    initRotatingList();
    
	$("form:has(input.email)").submit(function() {
		var error = false;
		
		$(this).find("input.email").each(function(){
			var email = $(this).val();
			
			if (email != '') {
				if (!regexEmail.test(email)) {
					alert('Please enter a valid email address');
					$(this).focus();
					
					error = true;
				}
			}
		});
		
		if (error == true) {
			return false;
		}
	});
	
	/*$('h3').flash(
		{
			src: '/sFIR/cachet.swf', 
			flashvars: { 
				css: [
					'* { color: #666666; }',
					'a { color: #0099CC; text-decoration: none; }',
					'a:hover { text-decoration: underline; }'
				].join(' ')
			}
		},
		{ version: 7 },
		function(htmlOptions) {
			htmlOptions.flashvars.txt = this.innerHTML;
			this.innerHTML = '<div>'+this.innerHTML+'</div>';
			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
			.addClass('flash-replaced')
			.prepend($.fn.flash.transform(htmlOptions));						
		}
	);*/
});

