
var submitcount=0; 


function copyover() {

document.form.shipping.value = document.form.phone.value;
document.form.saddress_one.value = document.form.address_one.value;
document.form.saddress_two.value = document.form.address_two.value;
document.form.ssuburb.value = document.form.suburb.value;
document.form.sstate.value = document.form.state.value;
document.form.spostcode.value = document.form.postcode.value;

document.form.recipient_name.value = document.form.title.value + ' ' + document.form.name.value + ' ' + document.form.surname.value;



}




function validate_checkout() {

document.form.title.style.backgroundColor='ffffff';
document.form.name.style.backgroundColor='ffffff';
document.form.surname.style.backgroundColor='ffffff';
document.form.email.style.backgroundColor='ffffff';
document.form.phone.style.backgroundColor='ffffff';
document.form.address_one.style.backgroundColor='ffffff';
document.form.suburb.style.backgroundColor='ffffff';
document.form.postcode.style.backgroundColor='ffffff';
document.form.state.style.backgroundColor='ffffff';
document.form.recipient_name.style.backgroundColor='ffffff';
document.form.saddress_one.style.backgroundColor='ffffff';
document.form.ssuburb.style.backgroundColor='ffffff';
document.form.spostcode.style.backgroundColor='ffffff';
document.form.sstate.style.backgroundColor='ffffff';


Fname=form.email_login.value;
if (Fname=='') {

Fname=form.title.value;
if (Fname=='') {
document.form.title.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.shipping.value;
if (Fname=='') {
document.form.shipping.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.name.value;
if (Fname=='') {
document.form.name.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.surname.value;
if (Fname=='') {
document.form.surname.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.email.value;
if (Fname=='') {
document.form.email.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.phone.value;
if (Fname=='') {
document.form.phone.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.address_one.value;
if (Fname=='') {
document.form.address_one.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.suburb.value;
if (Fname=='') {
document.form.suburb.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.postcode.value;
if (Fname=='') {
document.form.postcode.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}


Fname=form.state.value;
if (Fname=='') {
document.form.state.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}






Fname=form.recipient_name.value;
if (Fname=='') {
document.form.recipient_name.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.saddress_one.value;
if (Fname=='') {
document.form.saddress_one.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.ssuburb.value;
if (Fname=='') {
document.form.ssuburb.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.spostcode.value;
if (Fname=='') {
document.form.spostcode.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.sstate.value;
if (Fname=='') {
document.form.sstate.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

}



if (Alert =='yes') {
alert('You must complete all required entries.');
event.returnValue=false;
}

}



function validate_payment() {

document.form.type.style.backgroundColor='ffffff';
document.form.card_name.style.backgroundColor='ffffff';
document.form.card_number.style.backgroundColor='ffffff';
document.form.card_exp_year.style.backgroundColor='ffffff';
document.form.card_exp_month.style.backgroundColor='ffffff';


Fname=form.type.value;
if (Fname=='') {
document.form.type.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}
Fname=form.card_name.value;
if (Fname=='') {
document.form.card_name.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}
Fname=form.card_number.value;
if (Fname=='') {
document.form.card_number.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}
Fname=form.cvn.value;
if (Fname=='') {
document.form.cvn.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.card_exp_month.value;
if (Fname=='') {
document.form.card_exp_month.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

Fname=form.card_exp_year.value;
if (Fname=='') {
document.form.card_exp_year.style.backgroundColor='FEE2F5';
var Alert = 'yes';
}

if (Alert =='yes') {
alert('You must complete all required entries.');
event.returnValue=false;
}
else {
if (submitcount == 0) 
{ submitcount++; return true; } 
else 
{ alert('Please wait processing your payment.' ); return false; } 
}

}

