var rotationTimerId;
var rotationSpeed = 6000;
var rotationNum = 1;

function doSubscribe() {
	var regEmail = /^[A-Za-z0-9\-_]+(\.[A-Za-z0-9\-_]+)*@([A-Za-z0-9\-_\.]+\.)+[A-Za-z]{2,8}$/i;
	
    if (document.getElementById('mailing').FirmEmail.value < 1) {
			alert("Please enter e-mail address!");
            document.getElementById('mailing').FirmEmail.focus();
            return false;
    } else {
        if (document.getElementById('mailing').FirmEmail.value.search(regEmail) == -1) {
            alert("Please enter valid e-mail address!");
            document.getElementById('mailing').FirmEmail.focus();
            return false;
        }
    }
}

function addQuote(id) {
	var comment = document.getElementById('comment');

	comment.innerHTML = '[quote:'+id+']\n';
	comment.focus();
}

$(document).ready( function() {
	if($('.rotation').size() > 0) {
		totalFeatureNum = $(".rotation").size();

		rotationTimerId = setTimeout("showImage($('.rotation:eq("+rotationNum+")'))", rotationSpeed);
	
/* 		$('.rotation').hover( function() {
			clearTimeout(rotationTimerId);
		}, function() {
			rotationTimerId = setTimeout("showImage($('.rotation:eq("+rotationNum+")'))", rotationSpeed);
		}); */
	}
});

function showImage(src) {
	$('.rotation').fadeOut(2000);
	$(src).fadeIn(2000, function() {

		if(rotationNum < totalFeatureNum - 1) {
			rotationNum++;
		} else {
			rotationNum = 0;
		}
		rotationTimerId = setTimeout("showImage($('.rotation:eq("+rotationNum+")'))", rotationSpeed);
	});
}
