function validate_approve(form) 
{
	var e = form.elements, m = "";
	if(!e['approved'].checked) 
	{
		m += 'You need to approve that all information is correct before we can process order.  \n\n';
	}
	if(m) 
	{
		alert("Please fill in the following field(s)\n\n" + m ); 
		return false;
	}
		return true;
}

function validate_form_share(form)
{
	var e = form.elements, m = "";
	if(!e['sender_email'].value) 
	{
		m += 'Sender Email.  \n\n';
	}
	if(!e['sender_first_name'].value) 
	{
		m += 'Sender First Name.  \n\n';
	}
	if(!e['recipient_email'].value) 
	{
		m += 'Recipient Email.  \n\n';
	}
	if(!e['recipient_first_name'].value) 
	{
		m += 'Recipient First Name.  \n\n';
	}
	if(!e['s_image'].value) 
	{
		m += 'Security Code.  \n\n';
	}
	if(m) 
	{
		alert("Please fill in the following field(s)\n\n" + m ); 
		return false;
	}
		return true;
}

function validate_product_category(form) 
{
	var e = form.elements, m = "";
	if(!e['product_category_name'].value) 
	{
	m += 'Product Category name  \n\n';
	} 
	if(m) {
	alert("Please fill in the following field(s)\n\n" + m ); 
	return false;
	}
	return true;
}

function validate_product(form) 
{
	var e = form.elements, m = "";
	if(!e['product_name'].value) 
	{
		m += 'Product name  \n\n';
	} 
	if(!e['product_price'].value) 
	{
		m += 'Product Price  \n\n';
	} 
	if(!e['product_taxable'].value) 
	{
		m += 'Product Taxable  \n\n';
	} 
	if(!e['product_category_num'].value) 
	{
		m += 'Product Category  \n\n';
	}
	
	if(m) 
	{
		alert("Please fill in the following field(s)\n\n" + m ); 
		return false;
	}
	return true;
}
function validate_add_to_cart(form) 
{
		var reqerror = 0;				
		jQuery.each($('form.product .not_null'),function() { 
			if($(this).val() == "")
			{
				reqerror = reqerror+1;
			}
			
		});
		if(reqerror > 0)
		{
			alert("Please fill ensure all of the fields are filled in correctly.");
			return false;
		}
		else
		{
			return true;
		}
}
$required = $(".required");
function validate_checkout(form) 
{
	var e = form.elements, m = ""; 
	if(!e['first_name'].value) 
	{
		m += 'First name  \n\n';
	}
	if(!e['last_name'].value) 
	{
		m += 'Last name  \n\n';
	}
	if(!e['phone'].value) 
	{
		m += 'Phone number  \n\n';
	}
	if(!e['email'].value) 
	{
		m += 'E-Mail address  \n\n';
	}
	if(e['email'].value) 
	{
		var str = e['email'].value;
		var reg = new RegExp("([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})");
		if(!reg.test(str))
		{
			m += 'E-Mail address is not valid.  \n\n';
		}
	}
	if(!e['shipping_first_name'].value) 
	{
		m += 'Shipping first name  \n\n';
	}
	if(!e['shipping_last_name'].value) 
	{
		m += 'Shipping last name  \n\n';
	}
	if(!e['shipping_address_1'].value) 
	{
		m += 'Shipping address  \n\n';
	}
	if(!e['shipping_city'].value) 
	{
		m += 'Shipping City  \n\n';
	}
	if(!e['shipping_state'].value) 
	{
		m += 'Shipping State  \n\n';
	}
	if(!e['shipping_zip'].value) 
	{
		m += 'Shipping Zip code  \n\n';
	} 
	if(!e['billing_first_name'].value) 
	{
		m += 'Billing first name  \n\n';
	}
	if(!e['billing_last_name'].value) 
	{
		m += 'Billing last name  \n\n';
	}
	if(!e['billing_address_1'].value) 
	{
		m += 'Billing last name  \n\n';
	} 
	if(!e['billing_city'].value) 
	{
		m += 'Billing City  \n\n';
	}
	if(!e['billing_state'].value) 
	{
		m += 'Billing State  \n\n';
	}
	if(!e['billing_zip'].value) 
	{
		m += 'Billing Zip code  \n\n';
	}
	if(!e['cc_type'].value) {
		m += 'Credit card type  \n\n';
	}
	if(!e['cc_name'].value) {
		m += 'Credit card name  \n\n';
	}
	if(!e['cc_number'].value) {
		m += 'Credit card number  \n\n';
	}
	if(e['cc_number'].value) 
	{
		var str = e['cc_number'].value;
		var reg = new RegExp("([0-9])");
		if(!reg.test(str))
		{
			m += 'Credit Card is not all numbers.  \n\n';
		}
	}
	if(!e['cc_month'].value) {
		m += 'Credit card expiration month  \n\n';
	}
	if(!e['cc_year'].value) {
		m += 'Credit card expiration year  \n\n';
	}	
	if(!e['cc_verify_code'].value) {
		m += 'Credit card verify code  \n\n';
	} 
	if(m) 
	{
		alert("Please fill in the following field(s)\n\n" + m ); 
		return false;
	}
	return true;
} 
