<!--
function validate(frm)
{
	if(frm.name.value == ""){
		alert("Please enter your Name");
		frm.name.focus();
		return false;
	}
	if(frm.address.value == ""){
		alert("Please enter your Address");
		frm.address.focus();
		return false;
	}
	if(frm.city.value == ""){
		alert("Please enter your City");
		frm.city.focus();
		return false;
	}
	if(frm.state.value == ""){
		alert("Please enter your State");
		frm.state.focus();
		return false;
	}
	if(frm.zipcode.value == ""){
		alert("Please enter your Zipcode");
		frm.zipcode.focus();
		return false;
	}
	if (!(frm.zipcode.value.match(/^[0-9]+$/)))
	{
	   alert("String not allowed");
	   frm.zipcode.focus();
	   frm.zipcode.select();
	   return false;
	}
	if(frm.country.value == "select"){
		alert("Please select your Country");
		frm.country.focus();
		return false;
	}
	if(frm.phone1.value==""){
		alert("Please enter your Country Code");
		frm.phone1.focus();
		return false;
	}
	if (!(frm.phone1.value.match(/^[0-9]+$/)))
	{
	   alert("String not allowed");
	   frm.phone1.focus();
	   frm.phone1.select();
	   return false;
	}

	if(frm.phone2.value==""){
		alert("Please enter your Area Code");
		frm.phone2.focus();
		return false;
	}
	if (!(frm.phone2.value.match(/^[0-9]+$/)))
	{
	   alert("String not allowed");
	   frm.phone2.focus();
	   frm.phone2.select();
	   return false;
	}

	if(frm.phone3.value==""){
		alert("Please enter your Phone Number");
		frm.phone3.focus();
		return false;
	}
	if (!(frm.phone3.value.match(/^[0-9]+$/)))
	{
	   alert("String not allowed");
	   frm.phone3.focus();
	   frm.phone3.select();
	   return false;
	}

	if(frm.email.value == "")
	{
		alert("Please enter your Email");
		frm.email.focus();
		return false;
	}
	if(frm.email.value != "")
	{
		if(!isEmail(frm.email))
		{
			alert("Please enter valid Email");
			frm.email.focus();
			return false;
		}
	}

	if (!checkCopy())
	{
		return false;
	}

	totalcost = calculate();
	if (totalcost == 0)
	{
		alert("Please enter atleast one");
		return false;
	}

}

function isEmail(obj)
{	
	str = obj.value;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (!filter.test(str))
	{
		return false;
	}
	return true;
}

function checkCopy()
{
	num = 0;
	first_elem = null;
	for(var i=0;i<document.order_form.elements.length;i++)
	{
		var e = document.order_form.elements[i];
		if (e.name == 'copies')
		{
			if(first_elem == null)
			{
				first_elem = e;
			}
			copy = e.value;

			if(copy!="")
			{
				if(!validateNumeric(copy))
				{
					alert("String not allowed");
					e.focus();
					e.select();
					return false;
				}
				else
				{
					num++;
				}
			}
		}
	}

	if(num == 0)
	{
		alert("Please enter atleast one");
		first_elem.focus();
		return false;
	}
	
	return true;
}

function calculate()
{
	var cost = new Array();

	cost[0]  = "2.00";
	cost[1]  = "2.00";
	cost[2]  = "2.00";
	cost[3]  = "2.00";
	cost[4]  = "2.00";
	cost[5]  = "2.00";
	cost[6]  = "2.00";
	cost[7]  = "2.00";
	cost[8]  = "10.00";
	cost[9]  = "7.00";
	cost[10] = "8.50";
	cost[11] = "10.00";
	//cost[12] = "16.99";
	cost[12] = "3.95";

	var total = 0;
	var currtotal = 0;

	for(var i=0;i<13;i++)
	{
		copy = document.order_form.elements['copies'][i];

		if (copy.value != "")
		{
			if (validateNumeric(copy.value))
			{
				currtotal = parseFloat(copy.value) * cost[i];
				total = total + currtotal;
			}
		}
	}	var sal = total * 0.07;
	
	document.order_form.salestax.value = sal.toFixed(2);
	total=total + (total * 0.07);
	total=total + 5.00;
	total=total.toFixed(2);
	document.order_form.totalamout.value = total;
	return total;
}

function validateNumeric(strValue)
{
	var objRegExp  =  /^[0-9]+$/;
	return objRegExp.test(strValue);
}
//-->
