// Create Content Page

function checkTextField($f,$t,$n)
{
	var $m = ''
	if($f[$t].value==""){
		$m = $n+" is required.\n";
	}
	return $m;
}

function sendAlert($m)
{
	if($m) {
		alert($m);
		return false;
	} else {
		return true;	
	}
}

function validateCreate($f)
{
	// Check fields
	var $msg = "";
	$msg += checkTextField($f,'first_name','First Name');
	$msg += checkTextField($f,'last_name','Last Name');
	$msg += checkTextField($f,'address1','Street');
	$msg += checkTextField($f,'city','City');
	$msg += checkTextField($f,'state','State');
	$msg += checkTextField($f,'zip','Zip');
	
	// Send alert
	$decision = sendAlert($msg);
	if($decision){ document.getElementById('loading').style.display='block'; };
	return $decision;
}

function checkType($this)
{
	if($this.value!="Article") {
		document.product.main_category.style.display="none";
		document.product.sub_category.style.display="none";
	} else {
		document.product.main_category.style.display="inline";
		document.product.sub_category.style.display="inline";
	}
}

function switchPlans($this)
{
	switch($this)
	{
	case 'Free':
		document.getElementById('signup').action = 'http://www.successandwealthbuilder.com/thankyou.php';
		break;
	case 'Platinum':
		document.getElementById('item_name').value = 'Success &amp; Wealth Builder Membership - Platinum';
		document.getElementById('a3').value = '0.02';
		break;    
	default:
		document.getElementById('item_name').value = 'Success &amp; Wealth Builder Membership - Gold';
		document.getElementById('a3').value = '0.01';
	}
}