function doCalc () {
	$("#result").load('cyclewheel_includes/api.php', $("#calcform").serializeArray());
	return false;
}

function checkForm (thisform) {
	whiteoutform(thisform);

	var date = document.getElementById('date');

	if (date.value == '') { 
		alert('Please enter a date'); 
		date.focus();	
		changeBackground (date);
		return false; 
	}
	
	return doCalc (); 

}

function whiteoutform(myform) {
	for (var i=0; i< myform.elements.length;i++) {
		myform.elements[i].style.backgroundColor="#EBEBEB";
	}
}

function changeBackground(passField) {
	passFieldname = passField.id;
	blinkme(passFieldname, 0); // can only pass string, not objects
}

function blinkme(thispassField, count) {
 	if (count%2==0) {
		document.getElementById(thispassField).style.backgroundColor = '#ffffff';
	} else {
		document.getElementById(thispassField).style.backgroundColor = '#FFFF00';
	}
	count++;
	if (count<14) {
		setTimeout("blinkme('"+thispassField+"', '"+count+"')", 50); 
	}
}


