Cufon.replace("h1, h2, h3, .employee strong, .employer strong, .twitter strong");

var animateNow = true;
var animateDirection = "right";
var animateMouse;
var addCounter = 1;
function animate() {

		leftPos = parseInt($("#visual > #holder").css("left"));

		if(animateNow && $("#visual > #holder > img:first").width() > 0) {

		if(animateDirection == "right")
			leftPos-=2;
		else
			leftPos+=2;

		} else {
		change = Math.round((animateMouse - $("#visual").offset().left - $("#visual").width()/2) / ($("#visual").width() / 18));
		leftPos -= change;

		if(change > 0)
			animateDirection = "right";
		else
			animateDirection = "left";
		}

		if(leftPos > -1) {
			if(addCounter == 2) {
				leftPos -= $("#visual > #holder > img:first").width();
			}
			else {
				leftPos -= $("#visual > #holder > img:first").width();
				$("#visual > #holder > img:first").clone().prependTo("#visual > #holder");
	            $("#visual > #holder > img:last").css("float", "none");
	            addCounter++;
			}
		}
		if(leftPos < $("#visual").width() - $("#visual > #holder > img:first").width() * addCounter) {
			if(addCounter == 2) {
				  leftPos += $("#visual > #holder > img:first").width();
			}
			else {
				$("#visual > #holder > img:first").clone().prependTo("#visual > #holder");
	            $("#visual > #holder > img:last").css("float", "none");
	            addCounter++;
			}
		}

		$("#visual > #holder").css("left", leftPos + "px");
	
}

$(function() {

	$("#visual").each(function() {

		width = $(this).width();
		$(this).mousemove(function(e) {

			animateMouse = e.pageX;

		}).hover(function() {

			animateNow = false;

		}, function() {

			animateNow = true;

		});

	});

	setInterval("animate();", 35);

});
