function openwindow(url) {
mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=550,height=500');
}

function ValidateBeforeSubmit(){
if ((window.document.forms[0].method_of_payment[0] && document.forms[0].method_of_payment[0].checked)
		|| (window.document.forms[0].method_of_payment && !window.document.forms[0].method_of_payment[0])){	
	if ( ( document.forms[0].Cardtype.options[document.forms[0].Cardtype.options.selectedIndex].value == "VISA" ) && 
			(!isVisa(document.forms[0].ccnumbersubmit.value)) ){
		alert("The Visa card number you provided doesn't appear to be valid. \n Please try again");
		return false;
	} else if ((document.forms[0].Cardtype.options[document.forms[0].Cardtype.options.selectedIndex].value == "MC") && (!isMasterCard(document.forms[0].ccnumbersubmit.value))){
		alert("The Master Card number that you provided doesn't appear to be valid. \n Please try again");
		return false;
	} else if ((document.forms[0].Cardtype.options[document.forms[0].Cardtype.options.selectedIndex].value == "Amex") && (!isAmericanExpress(document.forms[0].ccnumbersubmit.value))){
		alert("The American Express number that you provided doesn't appear to be valid. \n Please try again");
		return false;
	} else if ((document.forms[0].Cardtype.options[document.forms[0].Cardtype.options.selectedIndex].value == "Discover") && (!isDiscover(document.forms[0].ccnumbersubmit.value))){
		alert("The Discover Card number that you provided doesn't appear to be valid. \n Please try again");
		return false;
	} else if (document.getElementById('payment_bzip') && document.getElementById('payment_bzip').value == '') {
		alert("Please enter your Billing Zip Code");
		return false;
	} else { // If credit card is o.k., change submit button to read 'processing' (more for netscape users), and disable the button (only works for IE) 
	   // to prevent double charges.
	   // swest 05.14.01
	   document.forms[0].submitbutton.onclick = null;
	   document.forms[0].submitbutton.onsubmit = null;
	   document.forms[0].submitbutton.value = "Processing ...";
	   document.forms[0].submitbutton.disabled = true;
	}
return true;
}
}

function OrderstoConfirmOneClick(){
	   document.ordform.orderssubmitbutton.onclick = null;
	   document.ordform.orderssubmitbutton.onsubmit = null;
	   document.ordform.orderssubmitbutton.value = "Processing ...";
	   document.ordform.orderssubmitbutton.disabled = true;
return true;
}

