var curlight;

// preload 
pic = new Image();
pic.src = "images/diamond.gif";

function light(which) {
theImage = eval("document.nav" + which);
theImage.src = "images/diamond.gif";
curlight = which;
}





function validate(theForm) {
if (theForm.Name.value == "") {
	alert("Please fill in your name");
	theForm.Name.focus();
	return (false);
	}
if (theForm.Address.value == "") {
	alert("Please fill in your address");
	theForm.Address.focus();
	return (false);
	}
if (theForm.City.value == "") {
	alert("Please fill in your city");
	theForm.City.focus();
	return (false);
	}
if (theForm.Zipcode.value == "") {
	alert("Please fill in your zipcode");
	theForm.Zipcode.focus();
	return (false);
	}
if (theForm.Country.value == "") {
	alert("Please fill in your country");
	theForm.Country.focus();
	return (false);
	}
if (theForm.Phone.value == "") {
	alert("Please fill in your phone number");
	theForm.Phone.focus();
	return (false);
	}
if (theForm.Email.value == "") {
	alert("Please fill in your email address");
	theForm.Email.focus();
	return (false);
	}
if (theForm.Email.value.indexOf("@")<1 || theForm.Email.value.indexOf(".")<1) {
	alert("Please fill in a valid email address");
	theForm.Email.focus();
	return (false);
	}
if (theForm.Quantity.value == "") {
	alert("Please fill in quantity of books required");
	theForm.Quantity.focus();
	return (false);
	}

flag=false
for(i=0;i<3;i++) {
	if (theForm.PaymentMethod[i].checked == true) {
		flag=true
		}
	}
if (flag==false) {
	alert("Please choose a payment method");
	return (false);
	}


if (theForm.PaymentMethod[0].checked == true) {
	
	if (theForm.CreditCardType.value == "") {
	alert("Please choose your credit card type");
	theForm.CreditCardType.focus();
	return (false);
	}
	if (theForm.CardNumber.value == "") {
	alert("Please fill in your card number");
	theForm.CardNumber.focus();
	return (false);
	}
	if (theForm.ExpirationDate.value == "") {
	alert("Please fill in expiration date");
	theForm.ExpirationDate.focus();
	return (false);
	}
	if (theForm.securitycode.value == "") {
	alert("Please fill in the security code");
	theForm.securitycode.focus();
	return (false);
	}
	if (theForm.NameOnCard.value == "") {
	alert("Please fill in the name on card");
	theForm.NameOnCard.focus();
	return (false);
	}
	
	}
	
return (true);
}



function activateTbl(which) {
for(i=1;i<=3;i++) {
document.getElementById("tbl"+i).className = "grayTbl";
}
document.getElementById(which).className ="whiteTbl";
}