function subscribe (formid,errordiv) {
	theform = document.getElementById(formid);

	var str = String(theform.champ1.value);
	if (match = /^\s*(\S+)\s+(.+)\s*$/.exec(str)) {
		theform.first_name.value = match[1];
		theform.last_name.value = match[2];
	}

	switch (theform.champ5.value) {
		case 'France': theform.country.value = 'FR'; break;
		case 'United Kingdom': theform.country.value = 'GB'; break;
		case 'United States': theform.country.value = 'US'; break;
	}
	var errorhtml = '';
	if (!theform.champ1.value) { errorhtml += '<li>Name Required'; }
	if (!theform.champ2.value) { errorhtml += '<li>Email Address Required'; }
	if (!theform.champ3.value) { errorhtml += '<li>Password Required'; }
	if (theform.champ3.value != theform.champ4.value) { errorhtml += '<li>Password Confirmation is not correct'; }
	if (!theform.champ5.value) { errorhtml += '<li>Country Required'; }
	if (!theform.champ6.value) { errorhtml += '<li>Native Language Required'; }
	divid = document.getElementById(errordiv);
	if (errorhtml) {
		errorhtml = 'Sorry, these details aren\'t quite right:<ul>' + errorhtml + '</ul>';
		if (divid) {
			divid.innerHTML = errorhtml;
			divid.className = 'error';
		}
		return false;
	}
	if (divid) {
		divid.innerHTML = '';
		divid.className = 'hidden';
	}
	return true;
}

function subscribeTwo (formid,errordiv) {
	theform = document.getElementById(formid);

	var str = String(theform.champ1_2.value);
	if (match = /^\s*(\S+)\s+(.+)\s*$/.exec(str)) {
		theform.first_name.value = match[1];
		theform.last_name.value = match[2];
	}
	switch (theform.champ5_2.value) {
		case 'France': theform.country.value = 'FR'; break;
		case 'United Kingdom': theform.country.value = 'GB'; break;
		case 'United States': theform.country.value = 'US'; break;
	}
	var errorhtml = '';
	if (!theform.champ1_2.value) { errorhtml += '<li>Name Required'; }
	if (!theform.champ2_2.value) { errorhtml += '<li>Email Address Required'; }
	if (!theform.champ3_2.value) { errorhtml += '<li>Password Required'; }
	if (theform.champ3_2.value != theform.champ4_2.value) { errorhtml += '<li>Password Confirmation is not correct'; }
	if (!theform.champ5_2.value) { errorhtml += '<li>Country Required'; }
	if (!theform.champ6_2.value) { errorhtml += '<li>Native Language Required'; }
	divid = document.getElementById(errordiv);
	if (errorhtml) {
		errorhtml = 'Sorry, these details aren\'t quite right:<ul>' + errorhtml + '</ul>';
		if (divid) {
			divid.innerHTML = errorhtml;
			divid.className = 'error';
		}
		return false;
	}
	if (divid) {
		divid.innerHTML = '';
		divid.className = 'hidden';
	}
	return true;
}

function checkSubmit(formid) {
	var subscribeform = document.getElementById(formid);
	var radio_choice = false;

	for (counter = 0; counter < subscribeform.plan_id.length; counter++){
		if (subscribeform.plan_id[counter].checked)
			radio_choice = true; 
	}

	if (!radio_choice){
		alert('Please Select a Subscription Plan')
		return false;
	}
	return true;
}