// Main code for Student Application
// Warner Data Solutions, LLC
// www.WarnerData.com
// guy@warner.com
// 801.808.3236

// Make a global variable for total price
var totalPrice = 510;
var tution = 0;




function checkDate()
{
	today = new Date();
	//today = new Date(2009,4,1);
	deadline = new Date(2009,1,28);
	var one_day=1000*60*60*24;
	var daysLeft = Math.ceil((deadline.getTime()-today.getTime())/(one_day));
	if(daysLeft >= 0)
		setRadioValue(document.drop_list.RegFee,'0');

	else if(daysLeft >= -60)
		setRadioValue(document.drop_list.RegFee,'15');
	else
		setRadioValue(document.drop_list.RegFee,'100');
	
}
function setRadioValue(theObj,theObjValue) 
{

	for (var i=0; i<theObj.length; i++) 
	{
		if (theObj[i].value==theObjValue) 
		{ 
			theObj[i].checked = true;
			theObj[i].disabled = false;
		}
	}
	// take value and add to totalPrice
	getTotalPrice(theObjValue);
}
function getTotalPrice(amount)
{
	// make sure it's a number and not a string
	amount = amount *1;
	// add new amount
	totalPrice = totalPrice + amount;
	//print amount
	showPrice = totalPrice + tution;
	// update the page
	document.getElementById("totalPrice").innerHTML='$'+showPrice+'.00';

}
function newInst(inst)
{
var sOpts  = "";



	sOpts  = '<br><select name="Level" size="1" id="Level" onChange="newBook(this.value,'+inst+')">';

	if(inst == 3)
		sOpts  = sOpts  + '<option value="Overview">Overview Book 1 - 3</option><option value="Book 4">Book 4</option>';
	if(inst == 2)
		sOpts  = sOpts  + '<option value="Book 2">Book 2</option>';
	if(inst == 1)
		sOpts  = sOpts  + '<option value="Book 2">Book 2</option><option value="Book 4">Book 4</option>';
	
	sOpts  = sOpts  + "</select>";

	if(inst == 0)
	{

		bookLevel.innerHTML = "<br><B>Select Instrument...</B>";
	}
	else
	{
	//document.getElementById('bookLevel').innerHTML = bookLevel;
	bookLevel.innerHTML = sOpts;
	}
}
