// JavaScript Document

function useShipping(vForm){
	try {
		var i;
		var status = vForm.useOtherShipping.checked;
		for (i = 0; i < vForm.elements.length; i++){
			thisItem = vForm.elements[i];
			// Fix no.1, 2007-10-29: to deal with fieldsets
			if (thisItem.type && thisItem.name.substring(0, 8) == "shipping")
			{
				thisItem.disabled = !status;
			}
		}
	}
	catch(e){ alert(vForm.elements.length);}
}


function validateForm(vForm){
	var returnValue = true;
	var message = "Please fill all required fields.";
	var i;

	try {
		for (i = 0; i < vForm.elements.length; i++){
			thisItem = vForm.elements[i];
			if (thisItem.required && thisItem.value.replace(/ /g, "").length == 0  && !thisItem.disabled){
				message += "\n" + thisItem.message;
				returnValue = false;
			}
		}
	
		if (!returnValue){
			alert(message);
		}
	}
	catch(e){}
	
	return returnValue;
}
