currFact = 0

function showNewRandomFact()
{
	numFacts = 27
	
	newFact = -1
	
	do {
		newFact = Math.floor(Math.random() * numFacts) + 1;
	} while(newFact == currFact)
	
	if(currFact > 0)
	{
		$("#fact_" + currFact).hide("fast");
		$("#fact_" + newFact).show("slow");
	}
	else
	{
		$("#fact_" + newFact).show();
	}
	currFact = newFact;

	setTimeout("showNewRandomFact()", 10000);

}

function showErrorsDiv(errorsHTML)
{
	$("#form_validation_errors").hide();
	$("#form_validation_errors").html(errorsHTML);
	$("#form_validation_errors").show("fast");
	setTimeout("fadeOutErrorsDiv()", 6000);
}

function fadeOutErrorsDiv()
{
	$("#form_validation_errors").hide("slow");
}

function showFootprints()
{
	setTimeout("showLeftFootprintsVertical()", (Math.floor(Math.random() * 15) + 1) * 1000);
	setTimeout("showRightFootprintsHorizontal()", (Math.floor(Math.random() * 15) + 20) * 1000);
	setTimeout("showLeftFootprintsHorizontal()", (Math.floor(Math.random() * 15) + 40) * 1000);
}

function showLeftFootprintsHorizontal()
{
	if((document.body.clientWidth / 2) - 406 - 104 > 0) 
	{
		$("#leftFootPrintsHorizontal").css("top", 400);
		$("#leftFootPrintsHorizontal").html("");
		$("#leftFootPrintsHorizontal").append("<img src='images/feetStraight.gif?" + Math.floor(Math.random() * 10000) + 1 + "'>");
		$("#leftFootPrintsHorizontal").show("fast");
	}
	setTimeout("hideLeftFootprintsHorizontal()", 5000);
}

function hideLeftFootprintsHorizontal()
{
	$("#leftFootPrintsHorizontal").fadeOut(2000);	
	setTimeout("showLeftFootprintsHorizontal()", 60000);
}

function showRightFootprintsHorizontal()
{
	if((document.body.clientWidth / 2) - 406 - 104 > 0) 
	{
		$("#rightFootPrintsHorizontal").css("top", 150);
		$("#rightFootPrintsHorizontal").css("left", document.body.clientWidth - 104);
		
		$("#rightFootPrintsHorizontal").html("");
		$("#rightFootPrintsHorizontal").append("<img src='images/feetStraight.gif?" + Math.floor(Math.random() * 10000) + 1 + "'>");
		$("#rightFootPrintsHorizontal").show("fast");
	}
	setTimeout("hideRightFootprintsHorizontal()", 5000);
}

function hideRightFootprintsHorizontal()
{
	$("#rightFootPrintsHorizontal").fadeOut(2000);	
	setTimeout("showRightFootprintsHorizontal()", 60000);
}


function showLeftFootprintsVertical()
{
	if((document.body.clientWidth / 2) - 406 - 41 > 0) 
	{
		$("#leftFootPrintsVertical").css("top", 200);
		$("#leftFootPrintsVertical").html("");
		$("#leftFootPrintsVertical").append("<img src='images/feetVertical.gif?" + Math.floor(Math.random() * 10000) + 1 + "'>");
		$("#leftFootPrintsVertical").show("fast");
	}
	setTimeout("hideLeftFootprintsVertical()", 5000);
}

function hideLeftFootprintsVertical()
{
	$("#leftFootPrintsVertical").fadeOut(2000);	
	setTimeout("showLeftFootprintsVertical()", 60000);
}


