function checkOrderForm()
{
	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var projectname = document.getElementById('projectname').value;
	var pages = document.getElementById('pages').value;
	var digits = /^([0-9])+$/;
	var emailformat = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if (name.length == 0)
	{
		alert('Please enter your name!');
		return false;
	}
	if (!emailformat.test(email))
	{
		alert('Enter a valid email address!');
		return false;
	}
	if (projectname.length == 0)
	{
		alert('Please enter project name!');
		return false;
	}
	if (!digits.test(pages))
	{
		alert('Enter a valid number of pages!');
		return false;
	}
	else if (pages < 1 || pages > 99)
	{
		alert('Enter a valid number of pages!');
		return false;
	}
	
	if (captchacode.length == 0)
	{
		alert('Please enter picture code!');
		return false;
	}

	return true;
}

function calcOrderForm()
{
	var turnaround1 = document.getElementById('turnaround1');
	var turnaround2 = document.getElementById('turnaround2');
	var turnaround3 = document.getElementById('turnaround3');
	var option1 = document.getElementById('option1');
	var option2 = document.getElementById('option2');
	var option3 = document.getElementById('option3');
	var option4 = document.getElementById('option4');
	var option5 = document.getElementById('option5');
	var option6 = document.getElementById('option6');
	var option7 = document.getElementById('option7');
	var option8 = document.getElementById('option8');
	var option9 = document.getElementById('option9');
	var option10 = document.getElementById('option10');
	var option11 = document.getElementById('option11');
	var option12 = document.getElementById('option12');
	var pages = document.getElementById("pages").value;
	var cost;
	var days;
	var turnaround_text;

	if (pages > 0)
	{
		if (turnaround1.checked)
		{
			cost = 120 + (pages-1)*120/2;
			if (pages == 1) turnaround_text = "24 hours or less";
			else turnaround_text = pages + " days or less";
		}
		else
		{
			cost = 80 + (pages-1)*80/2;
			if (pages == 1) turnaround_text = "24 hours or less";
			else turnaround_text = pages + " days or less";
		}

		if (option1.checked) cost = cost + 20*pages;
		if (option2.checked) cost = cost + 10;
		if (option3.checked) cost = cost + 10*pages;
		if (option4.checked) cost = cost + 10;
		if (option5.checked) cost = cost + 10;
		if (option6.checked) cost = cost + 25;
		
		if (option7.checked) cost = cost + 30;
		if (option8.checked) cost = cost + 30;
		if (option9.checked) cost = cost + 25;
		if (option10.checked) cost = cost + 20;
		if (option11.checked) cost = cost + 30;
		if (option12.checked) cost = cost + 60;
		document.getElementById("pricebox").innerHTML = "<p><span class='left1'>PROJECT COST::</span> <span class='blue'>$"+cost+"</span> </p><p><span class='left2'>TURNAROUND:</span> <span class='grey'>"+turnaround_text+"</span></p>";
		document.getElementById("totalprice").value = cost;
		document.getElementById("totalturnaround").value = turnaround_text;
    }
}
