		var flag=false;
		var sCharges= new Array();
		sCharges[1]="6.00";
		sCharges[2]="8.50";
		sCharges[3]="11.00";
		sCharges[4]="13.50";
		sCharges[5]="16.00";
		sCharges[6]="18.50";
		function addtoCart(obj)
		{
			if(obj=='1')
			if(!validate("Basketball Jersey",document.orderform.qt1,document.orderform.size1,document.orderform.color1,document.orderform.scr1))
			return;
			if(obj=='2')
			if(!validate("Baseball Jersey",document.orderform.qt2,document.orderform.size2,document.orderform.color2,document.orderform.scr2))
			return;
			if(obj=='3')
			if(!validate("Football Jersey",document.orderform.qt3,document.orderform.size3,document.orderform.color3,document.orderform.scr3))
			return;
			if(obj=='4')
			if(!validate("Sweatshirt",document.orderform.qt4,document.orderform.size4,document.orderform.color4,document.orderform.scr4))
			return;
			if(obj=='5')
			if(!validate("Sweatshirt with Hood",document.orderform.qt5,document.orderform.size5,document.orderform.color5,document.orderform.scr5))
			return;
			if(obj=='6')
			if(!validate("Polo Golf Shirts (Men)",document.orderform.qt6,document.orderform.size6,document.orderform.color6,document.orderform.scr6))
			return;
			if(obj=='7')
			if(!validate("Polo Golf Shirts (Women)",document.orderform.qt7,document.orderform.size7,document.orderform.color7,document.orderform.scr7))
			return;
			if(obj=='8')
			if(!validate("Polo with Single Stripe Trim (Men)",document.orderform.qt8,document.orderform.size8,document.orderform.color8,document.orderform.scr8))
			return;
			if(obj=='9')
			if(!validate("Polo with Single Stripe Trim (Women)",document.orderform.qt9,document.orderform.size9,document.orderform.color9,document.orderform.scr9))
			return;
			if(obj=='10')
			if(!validate("T-Shirts (White)",document.orderform.qt10,document.orderform.size10,document.orderform.color10,document.orderform.scr10))
			return;
			if(obj=='11')
			if(!validate("T-Shirts (Colored)",document.orderform.qt11,document.orderform.size11,document.orderform.color11,document.orderform.scr11))
			return;
			if(obj=='12')
			if(!validate("Baseball Caps",document.orderform.qt12,document.orderform.size12,document.orderform.color12,document.orderform.scr12))
			return;
			if(obj=='13')
			if(!validate("Beanie Caps",document.orderform.qt13,document.orderform.size13,document.orderform.color13,document.orderform.scr13))
			return;
			document.orderform.func.value="add";
			document.orderform.action="orderform.asp";
			document.orderform.submit();
		}

		function checkField(item,qt,sz,col,scr)
		{
			if(!isInteger(qt))
			return false;
			//if(qt.value!="")
			if(sz.value=="")
			{
				alert("Size should be selected")
				sz.focus();
				return false;
			}
			if(sz.value!="")
			if(qt.value=="")
			{
				alert("Quantity should be filled")
				qt.focus();
				return false;
			}
			if(sz.value!="")
			if(qt.value!="")
			if(col.value=="")
			{
				alert("Color should be Selected")
				col.focus();
				return false;
			}
			if(sz.value!="")
			if(qt.value!="")
			if(scr.value=="" && (item=='Basketball' || item=='Baseball' || item=='Football'))
			{
				alert("Scripture should be Selected")
				scr.focus();
				return false;
			}
			return true;
		}
		function validate(item,qt,sz,col,scr)
		{
			if(!checkField(item,qt,sz,col,scr))
			return false;
			document.orderform.item.value=item
			document.orderform.qty.value=qt.value
			document.orderform.sz.value=sz.options[sz.selectedIndex].text;
			document.orderform.szVal.value=sz.value;
			document.orderform.col.value=col.options[col.selectedIndex].text;
			document.orderform.scr.value=scr.options[scr.selectedIndex].text;
			//alert(document.orderform.szVal.value);
			return true;
		}

		function isInteger(qt)
		{
			val=qt.value;
			if (isNaN(val))
			{
				alert("Digits only allowed")
				qt.focus();
				return false;
			}
			else
			{
				flag=true;
			}
			if(val.indexOf('.') > 0)
			{
				alert("Decimals not allowed")
				qt.focus();
				return false;
			}
			return true;
		}

		function deleteCart()
		{
			var len=document.orderform.cb.length;
			if(!validateDelete('orderform','cb','Item',len))
			return;
			document.orderform.func.value="delete";
			document.orderform.action="orderform.asp";
			document.orderform.submit();

		}
		function emptyCart()
		{
			document.orderform.func.value="emptyCart";
			document.orderform.action="orderform.asp";
			document.orderform.submit();
		}
		function validateDelete(formName, objfieldIdname,msgName,length)
		{
			check=0;
			len=eval('document.'+formName+'.elements.length');
			for (var x = 0; x < len; x++)
			{
				field = eval('document.'+formName+'.elements[x]');
				fieldName=field.name;
				if(fieldName=="cb")
				{
					if (field.checked== true)
					{
						check=1;
					}
				}
			 }
			 if(check==0)
			 {
			  alert("Atleast one item to be selected")
				return false;
			 }
			 return true;
		}

		function checkout()
		{
			document.orderform.func.value="checkout";
			document.orderform.action="checkout.asp";
			document.orderform.submit();

		}
		function editorder()
		{

			document.ordersubmit.action="orderform.asp";
			document.ordersubmit.submit();
		}

	function validateEmail(emailObj)
	{
	   var emailVal        = emailObj.value;
		if(emailVal=="")
		 return true;
		var emailExp = new RegExp("^[\\w\\-\\.]+\\@[\\w\\-]+\\.[\\w\\-]+");
		//var emailExp = new RegExp("^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
		//regEx.Pattern = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$";

		if (emailExp.test(emailVal))
		{
			return true;
		}
		else
		{
		   alert("Not a valid email")
		   emailObj.focus();
			return false;
		}
	}

	function checkEmpty(fieldval)
	{
		flag = 0;
		cmp = " ";
		for ( var i=0; i < fieldval.length; i++ )
		{
			test = fieldval.substring(i,i+1)
				if ( cmp.indexOf(test) == 0 )
				flag++;
		}
		if (  (flag == fieldval.length ) || ( fieldval == "" ) )
			return false;
		else
			return true;
	}

	function validateMandatoryField(formName,fieldName)
	{

		fieldval=eval('document.'+formName+'.'+fieldName+'.value');
	   if ( checkEmpty(fieldval) == false )
		{
			alert("The following field should not be empty")
			eval('document.'+formName+'.'+fieldName+'.focus()');
			return false;
		}
		return true;
	}

	function fillshiptoFields()
	{
		if(document.ordersubmit.make.checked)
		{
			document.ordersubmit.x_ship_to_first_name.value=document.ordersubmit.x_first_name.value;
			document.ordersubmit.x_ship_to_last_name.value=document.ordersubmit.x_last_name.value;
			document.ordersubmit.x_ship_to_company.value=document.ordersubmit.x_company.value;
			document.ordersubmit.x_ship_to_address.value=document.ordersubmit.x_address.value;
			document.ordersubmit.x_ship_to_city.value=document.ordersubmit.x_city.value;
			var k=document.ordersubmit.x_state.selectedIndex;
			document.ordersubmit.x_ship_to_state.options[k].selected=true;
			document.ordersubmit.x_ship_to_zip.value=document.ordersubmit.x_zip.value;
			document.ordersubmit.x_ship_to_country.value=document.ordersubmit.x_country.value;
		}else{
			document.ordersubmit.x_ship_to_first_name.value='';
			document.ordersubmit.x_ship_to_last_name.value='';
			document.ordersubmit.x_ship_to_company.value='';
			document.ordersubmit.x_ship_to_address.value='';
			document.ordersubmit.x_ship_to_city.value='';
			var k=0;
			document.ordersubmit.x_ship_to_state.options[k].selected=true;
			document.ordersubmit.x_ship_to_zip.value='';
			document.ordersubmit.x_ship_to_country.value='';
        }
	}


	function submitForm()
	{
		if(!validateMandatoryField('ordersubmit','x_first_name'))
		return;
		if(!validateMandatoryField('ordersubmit','x_last_name'))
		return;
		if(!validateMandatoryField('ordersubmit','x_address'))
		return;
		if(!validateMandatoryField('ordersubmit','x_city'))
		return;
		if(!validateMandatoryField('ordersubmit','x_state'))
		return;
		if(!validateMandatoryField('ordersubmit','x_zip'))
		return;
		if(!validateMandatoryField('ordersubmit','x_phone'))
		return;
		if(!isInteger(document.ordersubmit.x_zip))
		return;
		if(!validateEmail(document.ordersubmit.x_email))
		return;

		if(!validateMandatoryField('ordersubmit','x_ship_to_first_name'))
		return;
		if(!validateMandatoryField('ordersubmit','x_ship_to_last_name'))
		return;
		if(!validateMandatoryField('ordersubmit','x_ship_to_address'))
		return;
		if(!validateMandatoryField('ordersubmit','x_ship_to_city'))
		return;
		if(!validateMandatoryField('ordersubmit','x_ship_to_state'))
		return;
		if(!validateMandatoryField('ordersubmit','x_ship_to_zip'))
		return;
		if(!isInteger(document.ordersubmit.x_zip))
		return;

                var state=document.ordersubmit.x_ship_to_state.selectedIndex;
		        stateval=document.ordersubmit.x_ship_to_state.options[state].value;
                if(stateval=='GA'){
                  var county=document.ordersubmit.x_ship_county.selectedIndex;
		          countyval=document.ordersubmit.x_ship_county.options[county].value;
		          document.ordersubmit.x_ship_countyText.value=countyval;
                  if(countyval=='Other' || countyval==''){
                    alert('Ship to County needs to be selected');
                    return;
                  }

                }
	    //document.ordersubmit.action="https://secure.authorize.net/gateway/transact.dll"
		document.ordersubmit.action="sendMail.asp";
		document.ordersubmit.submit();
	}
	function prmCode()
	{

		document.ordersubmit.x_stateText.value=document.ordersubmit.x_state.options[document.ordersubmit.x_state.selectedIndex].text;
		document.ordersubmit.x_ship_to_stateText.value=document.ordersubmit.x_ship_to_state.options[document.ordersubmit.x_ship_to_state.selectedIndex].text;
		//document.ordersubmit.x_countyText.value=document.ordersubmit.x_county.options[document.ordersubmit.x_county.selectedIndex].text;
		document.ordersubmit.x_ship_countyText.value=document.ordersubmit.x_ship_county.options[document.ordersubmit.x_ship_county.selectedIndex].text;
		document.ordersubmit.action="checkout.asp"
		document.ordersubmit.submit();
	}

	function calcTax()
	{
		if(document.ordersubmit.x_ship_to_state.value=="GA")
		{
			if(document.ordersubmit.x_ship_county.value=="")
			{
				alert("County should be selected")
				document.ordersubmit.x_ship_county.focus();
				return;
			}
			if(document.ordersubmit.x_ship_county.value=="Other")
			{
				alert("County should be selected")
				document.ordersubmit.x_ship_county.focus();
				return;
			}
			document.ordersubmit.x_tax.value=document.ordersubmit.x_ship_county.value;
			document.ordersubmit.x_stateText.value=document.ordersubmit.x_state.options[document.ordersubmit.x_state.selectedIndex].text;
			document.ordersubmit.x_ship_to_stateText.value=document.ordersubmit.x_ship_to_state.options[document.ordersubmit.x_ship_to_state.selectedIndex].text;
			//document.ordersubmit.x_countyText.value=document.ordersubmit.x_county.options[document.ordersubmit.x_county.selectedIndex].text;
			document.ordersubmit.x_ship_countyText.value=document.ordersubmit.x_ship_county.options[document.ordersubmit.x_ship_county.selectedIndex].text;
			document.ordersubmit.action="checkout.asp"
			document.ordersubmit.submit();


		}
	}