
// COMMON: Load page in a new window; use class="new_window" on <a> tags
$(document).ready(function(){
	$("a.new_window").click(function(){
		w = window.open(this.href, 'new_window');
		return false;
	});
});

// STEP 2: Non applicable
$(document).ready(function(){
	$("#non_applicable").change(function(){
		if ($("#name").attr("disabled")){
			$("#name").removeAttr("disabled");
		} else {
			$("#name").val("");
			$("#name").attr("disabled", "disabled");
			$("#name").parent().removeClass("error");
		}
	});
});

// STEP 2: Add/remove registrant
// Variable registrant_count defined in PHP
function registrant_html(num, page){
	var html = '';
	html += '<div id="registrant-'+num+'" class="yellow-box">';
	html += '<p class="close">Close</p>';
	if (page == 'delegate') html += '<h4>Additional Conference Delegate</h4>';
	else html += '<h4>Additional Conference Exhibitor</h4>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<label for="registrant_'+num+'_first_name">First Name</label><br />';
	html += '<input class="textbox" type="text" id="registrant_'+num+'_first_name" name="registrant['+num+'][first_name]" value="" />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<label for="registrant_'+num+'_last_name">Last Name</label><br />';
	html += '<input class="textbox" type="text" id="registrant_'+num+'_last_name" name="registrant['+num+'][last_name]" value="" />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w180 spacing">';
	html += '<label for="registrant_'+num+'_position">Position/Job Title</label><br />';
	html += '<input class="textbox" type="text" id="registrant_'+num+'_position" name="registrant['+num+'][position]" value="" />';
	html += '</td>';
	html += '<td class="w180 spacing">';
	html += '<label for="registrant_'+num+'_work">Work Phone</label><br />';
	html += '<input class="textbox" type="text" id="registrant_'+num+'_work" name="registrant['+num+'][work]" value="" />';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '<td class="w180">';
	html += '<label for="registrant_'+num+'_cell">Cell Phone</label><br />';
	html += '<input class="textbox" type="text" id="registrant_'+num+'_cell" name="registrant['+num+'][cell]" value="" />';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<p>';
	html += 'Is this your first time attending <span class="oc">Ontario Contact</span>?';
	html += '<input class="radio" type="radio" id="registrant_'+num+'_first-yes" name="registrant['+num+'][first]" value="yes" />';
	html += '<label for="registrant_'+num+'_first-yes">Yes</label>';
	html += '<input class="radio" type="radio" id="registrant_'+num+'_first-no" name="registrant['+num+'][first]" value="no" />';
	html += '<label for="registrant_'+num+'_first-no">No</label>';
	html += '</p>';
	html += '<p>';
	html += '<em>Note that all primary communication will be via email.</em><br />';
	html += 'Please indicate the most appropriate email address for all <span class="oc">Ontario Contact</span> notifications.';
	html += '</p>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<label for="registrant_'+num+'_email">Email</label><br />';
	html += '<input class="textbox" type="text" id="registrant_'+num+'_email" name="registrant['+num+'][email]" value="" />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<label for="registrant_'+num+'_email_confirm">Re-enter your email to confirm</label><br />';
	html += '<input class="textbox" type="text" id="registrant_'+num+'_email_confirm" name="registrant['+num+'][email_confirm]" value="" />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr><td><em>Registration Options</em></td></tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="registrant_'+num+'_option-a" name="registrant['+num+'][option]" value="a" />&nbsp;';
	html += '<label for="registrant_'+num+'_option-a"><strong>Option A</strong>: ';
	html += 'includes showcase access, 3 lunches and Saturday Celebration.</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="registrant_'+num+'_option-b" name="registrant['+num+'][option]" value="b" />&nbsp;';
	html += '<label for="registrant_'+num+'_option-b"><strong>Option B</strong>: ';
	html += 'includes showcase access and 3 lunches.</label>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table border="0" cellpadding="5" cellspacing="0">';
	html += '<tr><td><h5>Spouse</h5></td></tr>';
	html += '<tr>';
	html += '<td>Are you bringing your spouse to the conference?';
	html += '<input class="radio spouse" id="registrant_'+num+'_spouse-yes" name="registrant['+num+'][spouse]" value="yes" type="radio">';
	html += '<label for="registrant_'+num+'_spouse-yes">Yes</label>';
	html += '<input class="radio spouse" id="registrant_'+num+'_spouse-no" name="registrant['+num+'][spouse]" value="no" type="radio" checked="checked">';
	html += '<label for="registrant_'+num+'_spouse-no">No</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<label for="registrant_'+num+'_spouse_name">Your spouse\'s name:</label><br />';
	html += '<input class="textbox spouse_name" id="registrant_'+num+'_spouse_name" name="registrant['+num+'][spouse_name]" value="" type="text" disabled="disabled">';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>Select the desired registration option for your spouse.</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input class="spouse_option" id="registrant_'+num+'_spouse_option-a" name="registrant['+num+'][spouse_option]" value="a" type="radio" disabled="disabled">&nbsp;';
	html += '<label for="registrant_'+num+'_spouse_option-a"><strong>Option A</strong>: ';
	html += 'includes showcase access, 3 lunches and Saturday Celebration.</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input class="spouse_option" id="registrant_'+num+'_spouse_option-b" name="registrant['+num+'][spouse_option]" value="b" type="radio" disabled="disabled">&nbsp;';
	html += '<label for="registrant_'+num+'_spouse_option-b"><strong>Option B</strong>: ';
	html += 'includes showcase access and 3 lunches.</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input class="spouse_option" id="registrant_'+num+'_spouse_option-c" name="registrant['+num+'][spouse_option]" value="c" type="radio" disabled="disabled">&nbsp;';
	html += '<label for="registrant_'+num+'_spouse_option-c"><strong>Option C</strong>: ';
	html += 'includes Saturday Celebration only.</label>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '</div>';
	return html;
}
$(document).ready(function(){
	$("#registrant-add").click(function(){
		var html = registrant_html(registrant_count, page);
		$(this).before(html);
		registrant_count += 1;
		initCloseButton();
		initSpouses();
	});
});

// STEP 2: Add/remove one day only
// Variable day_count defined in PHP
function day_html(num){
	var html = '';
	html += '<div id="day-'+num+'" class="yellow-box">';
	html += '<p class="close">Close</p>';
	html += '<h4>One Day Only Delegate</h4>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<label for="day_'+num+'_first_name">First Name</label><br />';
	html += '<input class="textbox" type="text" id="day_'+num+'_first_name" name="day['+num+'][first_name]" value="" />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<label for="day_'+num+'_last_name">Last Name</label><br />';
	html += '<input class="textbox" type="text" id="day_'+num+'_last_name" name="day['+num+'][last_name]" value="" />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w180 spacing">';
	html += '<label for="day_'+num+'_position">Position/Job Title</label><br />';
	html += '<input class="textbox" type="text" id="day_'+num+'_position" name="day['+num+'][position]" value="" />';
	html += '</td>';
	html += '<td class="w180 spacing">';
	html += '<label for="day_'+num+'_work">Work Phone</label><br />';
	html += '<input class="textbox" type="text" id="day_'+num+'_work" name="day['+num+'][work]" value="" />';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '<td class="w180">';
	html += '<label for="day_'+num+'_cell">Cell Phone</label><br />';
	html += '<input class="textbox" type="text" id="day_'+num+'_cell" name="day['+num+'][cell]" value="" />';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<p>';
	html += 'Is this your first time attending <span class="oc">Ontario Contact</span>?';
	html += '<input class="radio" type="radio" id="day_'+num+'_first-yes" name="day['+num+'][first]" value="yes" />';
	html += '<label for="day_'+num+'_first-yes">Yes</label>';
	html += '<input class="radio" type="radio" id="day_'+num+'_first-no" name="day['+num+'][first]" value="no" />';
	html += '<label for="day_'+num+'_first-no">No</label>';
	html += '</p>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td colspan="2">Select the desired date of attendance:</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<input class="radio" type="radio" id="day_'+num+'_date-27" name="day['+num+'][date]" value="27" />';
	html += '<label for="day_'+num+'_date-27">October 27<sup>th</sup>, 2011</label><br />';
	html += '<input class="radio" type="radio" id="day_'+num+'_date-28" name="day['+num+'][date]" value="28" />';
	html += '<label for="day_'+num+'_date-28">October 28<sup>th</sup>, 2011</label><br />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<input class="radio" type="radio" id="day_'+num+'_date-29" name="day['+num+'][date]" value="29" />';
	html += '<label for="day_'+num+'_date-29">October 29<sup>th</sup>, 2011</label><br />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<p>';
	html += '<em>Note that all primary communication will be via email.</em><br />';
	html += 'Please indicate the most appropriate email address for all <span class="oc">Ontario Contact</span> notifications.';
	html += '</p>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<label for="day_'+num+'_email">Email</label><br />';
	html += '<input class="textbox" type="text" id="day_'+num+'_email" name="day['+num+'][email]" value="" />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<label for="day_'+num+'_email_confirm">Re-enter your email to confirm</label><br />';
	html += '<input class="textbox" type="text" id="day_'+num+'_email_confirm" name="day['+num+'][email_confirm]" value="" />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr><td><em>Registration Options</em></td></tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="day_'+num+'_option-a" name="day['+num+'][option]" value="a" />&nbsp;';
	html += '<label for="day_'+num+'_option-a"><strong>Option A</strong>: ';
	html += 'includes showcase access, lunch and Saturday Celebration (only October 29<sup>th</sup>).</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="day_'+num+'_option-b" name="day['+num+'][option]" value="b" />&nbsp;';
	html += '<label for="day_'+num+'_option-b"><strong>Option B</strong>: ';
	html += 'includes showcase access and lunch.</label>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '</div>';
	return html;
}
$(document).ready(function(){
	$("#day-add").click(function(){
		var html = day_html(day_count);
		$(this).before(html);
		day_count += 1;
		initCloseButton();
	});
});

// STEP 2: Add/remove colleague
// Variable colleague_count defined in PHP
function colleague_html(num){
	var html = '';
	html += '<div id="colleague-'+num+'" class="yellow-box">';
	html += '<p class="close">Close</p>';
	html += '<h4>Colleague</h4>';
	html += '<table border="0" cellpadding="5" cellspacing="0">';
	html += '<tr>';
	html += '<td>';
	html += '<label for="colleague_'+num+'_type">Colleague Type</label><br />';
	html += '<select class="select" id="colleague_'+num+'_type" name="colleague['+num+'][type]">';
	html += '<option value="">— Please Select —</option>';
	html += '<option>Agent</option>';
	html += '<option>Artist</option>';
	html += '<option>Presenter</option>';
	html += '<option>Programmer</option>';
	html += '<option>Industry Business Consultant</option>';
	html += '<option>Government</option>';
	html += '<option>Arts Service Organization</option>';
	html += '<option>Special Guest</option>';
	html += '</select>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table border="0" cellpadding="5" cellspacing="0">';
	html += '<tr>';
	html += '<td>';
	html += '<label for="colleague_'+num+'_name">Organization Name</label><br />';
	html += '<input class="textbox" id="colleague_'+num+'_name" name="colleague['+num+'][name]" value="" type="text">';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table border="0" cellpadding="5" cellspacing="0">';
	html += '<tr>';
	html += '<td>';
	html += '<label for="colleague_'+num+'_address">Work/Organization Address</label><br />';
	html += '<input class="textbox" id="colleague_'+num+'_address" name="colleague['+num+'][address]" value="" type="text">';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table border="0" cellpadding="5" cellspacing="0">';
	html += '<tr>';
	html += '<td>';
	html += '<label for="colleague_'+num+'_city">City</label><br />';
	html += '<input class="textbox" id="colleague_'+num+'_city" name="colleague['+num+'][city]" value="" type="text">';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table border="0" cellpadding="5" cellspacing="0">';
	html += '<tr>';
	html += '<td class="w180 spacing">';
	html += '<label for="colleague_'+num+'_province">Province/State</label><br />';
	html += '<input class="textbox" id="colleague_'+num+'_province" name="colleague['+num+'][province]" value="" type="text">';
	html += '</td>';
	html += '<td class="w180 spacing">';
	html += '<label for="colleague_'+num+'_country">Country</label><br />';
	html += '<input class="textbox" id="colleague_'+num+'_country" name="colleague['+num+'][country]" value="" type="text">';
	html += '</td>';
	html += '<td class="w180">';
	html += '<label for="colleague_'+num+'_postal">Postal/Zip Code</label><br />';
	html += '<input class="textbox" id="colleague_'+num+'_postal" name="colleague['+num+'][postal]" value="" type="text">';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table border="0" cellpadding="5" cellspacing="0">';
	html += '<tr>';
	html += '<td class="w180 spacing">';
	html += '<label for="colleague_'+num+'_fax">Fax</label><br />';
	html += '<input class="textbox" id="colleague_'+num+'_fax" name="colleague['+num+'][fax]" value="" type="text">';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '<td class="w380">';
	html += '<label for="colleague_'+num+'_website">Website</label><br />';
	html += '<input class="textbox" id="colleague_'+num+'_website" name="colleague['+num+'][website]" value="" type="text">';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<label for="colleague_'+num+'_first_name">First Name</label><br />';
	html += '<input class="textbox" type="text" id="colleague_'+num+'_first_name" name="colleague['+num+'][first_name]" value="" />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<label for="colleague_'+num+'_last_name">Last Name</label><br />';
	html += '<input class="textbox" type="text" id="colleague_'+num+'_last_name" name="colleague['+num+'][last_name]" value="" />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w180 spacing">';
	html += '<label for="colleague_'+num+'_position">Position/Job Title</label><br />';
	html += '<input class="textbox" type="text" id="colleague_'+num+'_position" name="colleague['+num+'][position]" value="" />';
	html += '</td>';
	html += '<td class="w180 spacing">';
	html += '<label for="colleague_'+num+'_work">Work Phone</label><br />';
	html += '<input class="textbox" type="text" id="colleague_'+num+'_work" name="colleague['+num+'][work]" value="" />';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '<td class="w180">';
	html += '<label for="colleague_'+num+'_cell">Cell Phone</label><br />';
	html += '<input class="textbox" type="text" id="colleague_'+num+'_cell" name="colleague['+num+'][cell]" value="" />';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<p>';
	html += 'Is this your first time attending <span class="oc">Ontario Contact</span>?';
	html += '<input class="radio" type="radio" id="colleague_'+num+'_first-yes" name="colleague['+num+'][first]" value="yes" />';
	html += '<label for="colleague_'+num+'_first-yes">Yes</label>';
	html += '<input class="radio" type="radio" id="colleague_'+num+'_first-no" name="colleague['+num+'][first]" value="no" />';
	html += '<label for="colleague_'+num+'_first-no">No</label>';
	html += '</p>';
	html += '<p>';
	html += '<em>Note that all primary communication will be via email.</em><br />';
	html += 'Please indicate the most appropriate email address for all <span class="oc">Ontario Contact</span> notifications.';
	html += '</p>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<label for="colleague_'+num+'_email">Email</label><br />';
	html += '<input class="textbox" type="text" id="colleague_'+num+'_email" name="colleague['+num+'][email]" value="" />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<label for="colleague_'+num+'_email_confirm">Re-enter your email to confirm</label><br />';
	html += '<input class="textbox" type="text" id="colleague_'+num+'_email_confirm" name="colleague['+num+'][email_confirm]" value="" />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr><td><em>Registration Options</em></td></tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="colleague_'+num+'_option-a" name="colleague['+num+'][option]" value="a" />&nbsp;';
	html += '<label for="colleague_'+num+'_option-a"><strong>Option A</strong>: ';
	html += 'includes showcase access, 3 lunches and Saturday Celebration.</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="colleague_'+num+'_option-b" name="colleague['+num+'][option]" value="b" />&nbsp;';
	html += '<label for="colleague_'+num+'_option-b"><strong>Option B</strong>: ';
	html += 'includes showcase access and 3 lunches.</label>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table border="0" cellpadding="5" cellspacing="0">';
	html += '<tr><td><h5>Spouse</h5></td></tr>';
	html += '<tr>';
	html += '<td>Are you bringing your spouse to the conference?';
	html += '<input class="radio spouse" id="colleague_'+num+'_spouse-yes" name="colleague['+num+'][spouse]" value="yes" type="radio">';
	html += '<label for="colleague_'+num+'_spouse-yes">Yes</label>';
	html += '<input class="radio spouse" id="colleague_'+num+'_spouse-no" name="colleague['+num+'][spouse]" value="no" type="radio" checked="checked">';
	html += '<label for="colleague_'+num+'_spouse-no">No</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<label for="colleague_'+num+'_spouse_name">Your spouse\'s name:</label><br />';
	html += '<input class="textbox spouse_name" id="colleague_'+num+'_spouse_name" name="colleague['+num+'][spouse_name]" value="" type="text" disabled="disabled">';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>Select the desired registration option for your spouse.</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input class="spouse_option" id="colleague_'+num+'_spouse_option-a" name="colleague['+num+'][spouse_option]" value="a" type="radio" disabled="disabled">&nbsp;';
	html += '<label for="colleague_'+num+'_spouse_option-a"><strong>Option A</strong>: ';
	html += 'includes showcase access, 3 lunches and Saturday Celebration.</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input class="spouse_option" id="colleague_'+num+'_spouse_option-b" name="colleague['+num+'][spouse_option]" value="b" type="radio" disabled="disabled">&nbsp;';
	html += '<label for="colleague_'+num+'_spouse_option-b"><strong>Option B</strong>: ';
	html += 'includes showcase access and 3 lunches.</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input class="spouse_option" id="colleague_'+num+'_spouse_option-c" name="colleague['+num+'][spouse_option]" value="c" type="radio" disabled="disabled">&nbsp;';
	html += '<label for="colleague_'+num+'_spouse_option-c"><strong>Option C</strong>: ';
	html += 'includes Saturday Celebration only.</label>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '</div>';
	return html;
}
$(document).ready(function(){
	$("#colleague-add").click(function(){
		var html = colleague_html(colleague_count);
		$(this).before(html);
		colleague_count += 1;
		initCloseButton();
		initSpouses();
	});
});

// STEP 2: Add/remove contact room rep
// Variable crr_count defined in PHP
function crr_html(num){
	var html = '';
	html += '<div id="crr-'+num+'" class="yellow-box">';
	html += '<p class="close">Close</p>';
	html += '<h4>Contact Room Representative</h4>';
	html += '<p>Contact Room Representatives have access to the Contact Room only, they do not participate in other Contact events including showcases.</p>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<label for="crr_'+num+'_first_name">First Name</label><br />';
	html += '<input class="textbox" type="text" id="crr_'+num+'_first_name" name="crr['+num+'][first_name]" value="" />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<label for="crr_'+num+'_last_name">Last Name</label><br />';
	html += '<input class="textbox" type="text" id="crr_'+num+'_last_name" name="crr['+num+'][last_name]" value="" />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w180 spacing">';
	html += '<label for="crr_'+num+'_position">Position/Job Title</label><br />';
	html += '<input class="textbox" type="text" id="crr_'+num+'_position" name="crr['+num+'][position]" value="" />';
	html += '</td>';
	html += '<td class="w180 spacing">';
	html += '<label for="crr_'+num+'_work">Work Phone</label><br />';
	html += '<input class="textbox" type="text" id="crr_'+num+'_work" name="crr['+num+'][work]" value="" />';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '<td class="w180">';
	html += '<label for="crr_'+num+'_cell">Cell Phone</label><br />';
	html += '<input class="textbox" type="text" id="crr_'+num+'_cell" name="crr['+num+'][cell]" value="" />';
	html += '<br />(e.g. 416-xxx-xxxx)';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<p>';
	html += '<em>Note that all primary communication will be via email.</em><br />';
	html += 'Please indicate the most appropriate email address for all <span class="oc">Ontario Contact</span> notifications.';
	html += '</p>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr>';
	html += '<td class="w280 spacing">';
	html += '<label for="crr_'+num+'_email">Email</label><br />';
	html += '<input class="textbox" type="text" id="crr_'+num+'_email" name="crr['+num+'][email]" value="" />';
	html += '</td>';
	html += '<td class="w280">';
	html += '<label for="crr_'+num+'_email_confirm">Re-enter your email to confirm</label><br />';
	html += '<input class="textbox" type="text" id="crr_'+num+'_email_confirm" name="crr['+num+'][email_confirm]" value="" />';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '<table cellpadding="5" cellspacing="0" border="0">';
	html += '<tr><td><em>Registration Options</em></td></tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="crr_'+num+'_option-a" name="crr['+num+'][option]" value="a" />&nbsp;';
	html += '<label for="crr_'+num+'_option-a"><strong>Option A</strong>: ';
	html += 'includes showcase access, 3 lunches and Saturday Celebration.</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="crr_'+num+'_option-b" name="crr['+num+'][option]" value="b" />&nbsp;';
	html += '<label for="crr_'+num+'_option-b"><strong>Option B</strong>: ';
	html += 'includes showcase access and 3 lunches.</label>';
	html += '</td>';
	html += '</tr>';
	html += '<tr>';
	html += '<td>';
	html += '<input type="radio" id="crr_'+num+'_option-c" name="crr['+num+'][option]" value="c" />&nbsp;';
	html += '<label for="crr_'+num+'_option-c"><strong>Option C</strong>: ';
	html += 'includes showcase access, but no meals.</label>';
	html += '</td>';
	html += '</tr>';
	html += '</table>';
	html += '</div>';
	return html;
}
$(document).ready(function(){
	$("#crr-add").click(function(){
		var html = crr_html(crr_count);
		$(this).before(html);
		crr_count += 1;
		initCloseButton();
	});
});

// STEP 2: Initialize close button for yellow boxes
function initCloseButton(){
	$("p.close").unbind('click').click(function(){
		$(this).parent().remove();
	});
}
$(document).ready(function(){
	initCloseButton();
});

// STEP 2: Initialialize behaviours for Spouses
function initSpouses(){
	$("input:radio.spouse").unbind('change').change(function(){
		var container = $(this).parents('table');
		if ($("input:radio:checked", container).val() == 'yes') {
			$(".spouse_name", container).removeAttr("disabled");
			$(".spouse_option", container).removeAttr("disabled");
		} else {
			$(".spouse_name", container).val("");
			$(".spouse_name", container).attr("disabled", "disabled");
			$(".spouse_name", container).parent().removeClass("error");
			$(".spouse_option", container).removeAttr("checked");
			$(".spouse_option", container).attr("disabled", "disabled");
			$(".spouse_option", container).next().removeClass("error");
		}
	});
}
$(document).ready(function(){
	initSpouses();
});

// STEP 3: OAC Travel Subsidy
$(document).ready(function(){
	$("#oac").change(function(){
		if ($("#community").attr("disabled")){
			$("#community").removeAttr("disabled");
		} else {
			$("#community").val("");
			$("#community").attr("disabled", "disabled");
			$("#community").parent().removeClass("error");
		}
	});
});

