// JavaScript Document

function progchange(x) {
	document.getElementById('weekdays').innerHTML = pweekdays[x];
	document.getElementById('progtype').innerHTML = ptype[x];
	
	if (pprorated[x] > 0) {
		document.getElementById('paymentamount').innerHTML = "<span class='sold_out'>$"+pcost[x]+".00</span> <span style='color:#006600' title='Special Rate'>$"+pprorated[x]+".00</span>"
		document.formreg.paymenttot.value = pcost[x];
		document.formreg.proratedtot.value = pprorated[x];
	} else {
		document.getElementById('paymentamount').innerHTML = "$"+pcost[x]+".00";	
		document.formreg.paymenttot.value = pcost[x];
		document.formreg.proratedtot.value = '';
	}
	
	document.getElementById('weekdayslots').innerHTML = "";
	if (pweekdayhours[x].length	> 0) {
		document.getElementById('weekdayslots').innerHTML = "<strong>Weekdays</strong> <span class=\"required\">*</span> <br />";
	}
	for (i=0; i<pweekdayhours[x].length; ++i) {
		document.getElementById('weekdayslots').innerHTML = document.getElementById('weekdayslots').innerHTML + pweekdayhours[x][i];
	}

	document.getElementById('weekendslots').innerHTML = "";
	if (pweekendhours[x].length	> 0) {
		document.getElementById('weekendslots').innerHTML = "<br /><strong>Saturday</strong> <span class=\"required\">*</span> <br />";
	}
	for (i=0; i<pweekendhours[x].length; ++i) {
		document.getElementById('weekendslots').innerHTML = document.getElementById('weekendslots').innerHTML + pweekendhours[x][i];
	}
}

function mentorshipchange(x) {
	document.getElementById('paymentamount').innerHTML = "$"+pcost[x]+".00";	
	document.formreg.paymenttot.value = pcost[x];
	
	document.getElementById('sessionstart').innerHTML = daystart[x];
	document.getElementById('sessionend').innerHTML = dayend[x];	
}

function seminarchange(x) {
	document.getElementById('paymentamount').innerHTML = "$"+pcost[x]+".00";	
	document.formreg.paymenttot.value = pcost[x];
}

function groupchange() {
	var sel = document.formreg.g_option.value;
	var quan = document.formreg.g_quantity.value;
	var cost = 0;
	var sessions = 0;
	
	if (sel > 40) {
		document.formreg.g_quantity.value = 1;
		quan = 1;
	}
	
	if (sel == 40 && quan > 0) {
		cost = parseInt(quan)*40;
		sessions = quan;
		document.formreg.g_cost.value = cost;
		document.formreg.g_sessions.value = sessions;
		document.getElementById('totcost').innerHTML = '<span class="cost">$'+cost+'</span>';
		document.getElementById('sessions').innerHTML = sessions;
		document.formreg.g_plan.options[0] = new Option("SELECT", 0);
		document.formreg.g_plan.options[1] = new Option("Single Payment of $"+cost, 1);
		document.formreg.g_plan.options[1].selected = "selected";
	} else if (sel == 897 && quan > 0) {
		cost = parseInt(quan)*parseInt(sel);
		sessions = parseInt(quan)*24;
		document.formreg.g_cost.value = cost;
		document.formreg.g_sessions.value = sessions;
		document.getElementById('totcost').innerHTML = '<span class="cost">$'+cost+'</span>';
		document.getElementById('sessions').innerHTML = sessions;
		document.formreg.g_plan.options[0] = new Option("SELECT", 0);
		document.formreg.g_plan.options[1] = new Option("Single Payment of $"+cost, 1);
		document.formreg.g_plan.options[2] = new Option("3 Payments of $"+(cost/3), 3);
		document.formreg.g_plan.options[2].selected = "selected";
	} else if (sel == 1734 && quan > 0) {
		cost = parseInt(quan)*parseInt(sel);
		sessions = parseInt(quan)*48;
		document.formreg.g_cost.value = cost;
		document.formreg.g_sessions.value = sessions;
		document.getElementById('totcost').innerHTML = '<span class="cost">$'+cost+'</span>';
		document.getElementById('sessions').innerHTML = sessions;
		document.formreg.g_plan.options[0] = new Option("SELECT", 0);
		document.formreg.g_plan.options[1] = new Option("Single Payment of $"+cost, 1);
		document.formreg.g_plan.options[2] = new Option("3 Payments of $"+(cost/3), 3);
		document.formreg.g_plan.options[3] = new Option("6 Payments of $"+(cost/6), 6);
		document.formreg.g_plan.options[3].selected = "selected";
	} else {
		document.formreg.g_cost.value = '0';
		document.formreg.g_sessions.value = '0';
		document.getElementById('totcost').innerHTML = 'Select an option and quantity above';
		document.getElementById('sessions').innerHTML = 'Select an option and quantity above';
		document.formreg.g_plan.options[0] = new Option("SELECT", 0);
		document.formreg.g_plan.options[1] = new Option("Single Payment of $"+cost, 1);
		document.formreg.g_plan.options[0].selected = "selected";
	}
}

