function setPaymentInfo()
{
	//with (window.document.frmCheckout) {
	theForm = window.document.frmCheckout;
		
			theForm.txtPaymentFirstName.value  = theForm.txtShippingFirstName.value;
			theForm.txtPaymentLastName.value   = theForm.txtShippingLastName.value;
			theForm.txtPaymentAddress1.value   = theForm.txtShippingAddress1.value;
			theForm.txtPaymentAddress2.value   = theForm.txtShippingAddress2.value;
			theForm.txtPaymentCity.value       = theForm.txtShippingCity.value;
			theForm.txtPaymentCounty.value     = theForm.txtShippingCounty.value;
			theForm.txtPaymentCountry.value     = theForm.txtShippingCountry.value;
			theForm.txtPaymentPostalCode.value     = theForm.txtShippingPostalCode.value;
			
//	}
}
function checkoutDetails()
{
	theForm = window.document.frmCheckout;
	if (isEmpty(theForm.txtShippingFirstName, 'Please Enter First Name') || isEmpty(theForm.txtShippingLastName, 'Please Enter Last Name') || isEmpty(theForm.txtShippingAddress1, 'Please Enter Address') || isEmpty(theForm.txtShippingCity, 'Please Enter Town/City') ||isEmpty(theForm.txtShippingPostalCode, 'Please Enter PostCode') ||isEmpty(theForm.txtShippingCountry, 'Please Enter Country') || isEmpty(theForm.txtShippingEmail, 'Please Enter Email Address') || isEmpty(theForm.txtFind, 'Please Choose how you found us') || isEmpty(theForm.txtShippingPassword, 'Please Enter a Password') || isEmpty(theForm.txtPaymentFirstName, 'Please Enter Payment First Name') || isEmpty(theForm.txtPaymentLastName, 'Please Enter Payment Last Name') || isEmpty(theForm.txtPaymentAddress1, 'Please  Enter Payment Address') || isEmpty(theForm.txtPaymentCity, 'Please Enter Payment Town/City') || isEmpty(theForm.txtPaymentPostalCode, 'Please Enter Payment PostCode') || isEmpty(theForm.txtPaymentCountry, 'Please Enter Payment Country')) {
			return;
		} else {
		
			if (theForm.txtShippingPassword.value == theForm.txtShippingPasswordConfirm.value){
				//theForm.submit();
				var x = theForm.txtShippingEmail.value;
				var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
				if (!(filter.test(x))){
					alert('Incorrect email address');

				} else {
					if (theForm.txtShippingEmail.value == theForm.txtShippingEmail2.value){
						if (theForm.txtFind.value == "Other"){
						if (!(isEmpty(theForm.txtFindOther, 'Please tells where you found us'))){
							theForm.submit();
						}
					} else {
						theForm.submit();
					}
					} else {
						alert("The two e-mail addresses entered do not match - Please reenter them both.");
					}
				}
			 }else{
				alert("Passwords Do Not Match");
			}
		}
	
	
}

function checkoutDetails1()
{
	theForm = window.document.frmCheckout;
	if (isEmpty(theForm.txtShippingFirstName, 'Please Enter First Name') || isEmpty(theForm.txtShippingLastName, 'Please Enter Last Name') || isEmpty(theForm.txtShippingAddress1, 'Please Enter Address') || isEmpty(theForm.txtShippingCity, 'Please Enter Town/City') ||isEmpty(theForm.txtShippingPostalCode, 'Please Enter PostCode') || isEmpty(theForm.txtShippingEmail, 'Please Enter Email Address') || isEmpty(theForm.txtPaymentFirstName, 'Please Enter Payment First Name') || isEmpty(theForm.txtPaymentLastName, 'Please Enter Payment Last Name') || isEmpty(theForm.txtPaymentAddress1, 'Please  Enter Payment Address') || isEmpty(theForm.txtPaymentCity, 'Please Enter Payment Town/City') || isEmpty(theForm.txtPaymentPostalCode, 'Please Enter Payment PostCode')) {
			return;
		} else {
		
			
				var x = theForm.txtShippingEmail.value;
				var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
				if (!(filter.test(x))){
					alert('Incorrect email address');

				} else {
					var today = new Date();
					var tday = today.getDate();
					var tmonth = today.getMonth();
					var tyear = today.getFullYear();
					today = new Date(tyear,tmonth,tday);
					
					var date_array = theForm.orderdate.value.split('-');
					var day = date_array[2];

				  // Attention! Javascript consider months in the range 0 - 11
				  var month = date_array[1] - 1;
				  var year = date_array[0];
					myDate = new Date(year,month,day);
					//myDate = new Date(2007,02,01);

					if (myDate >= today){
						todayDay = today.getDate();
						myDateDay = myDate.getDate();
						todayMonth = today.getMonth();
						myDateMonth = myDate.getMonth();
						if ((todayDay == myDateDay) && (todayMonth == myDateMonth)){
							var today = new Date();
							var time = today.getTime();
							var deadlineDate = new Date (today.getFullYear(), today.getMonth(), today.getDate(), 13, 00);
							var deadline = deadlineDate.getTime();
							
							if (time > deadline){
								alert('Same day delivery deadline past. Please choose another delivery date');	
							}else{
								theForm.submit();
							}
						}else {
							theForm.submit();
						}
					}else{
						alert('Date cannot be in the past. Please choose another delivery date');
						
					}
					
				}
			
		}
	
	
}
