function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


var nacho=false;
var burrito=false;

var cardtype="";
var ccnum="";
var ccexp="";

function runVerification(formName) {
        // first make sure they even entered all the shtuff
//	formName.cardtype.selectedIndex++;
 //       if (formName.cardtype.selectedIndex == "null" || formName.cardtype.selectedIndex == 0) {
//		alert("You didn't select a cardtype method.");
//                return false;
//                }

		if (document.FeedbackForm.cardtype.value == "") {
		alert("You didn't enter a credit card type.");
				document.FeedbackForm.cardtype.focus();
                return false;
                }


        if (document.FeedbackForm.ccnum.value == "") {
		alert("You didn't enter a credit card number.");
				document.FeedbackForm.ccnum.focus();
                return false;
                }

        // nacho returns a true if the cc format is good
        // burrito return a true if the cc expiration date is good (and not
        //      already past)
        nacho=ccformatValidate(formName);
        if (nacho) {
				 return valid(this);  

   
		}
	else {
                alert("Please enter a valid number for your Credit card type!");
				document.FeedbackForm.ccnum.focus();
                return false;
		}
	}

function ccformatValidate(formName) {
	if (formName.cardtype.selectedIndex == 1) cardtype="visa";
	if (formName.cardtype.selectedIndex == 2) cardtype="mastercard";
	if (formName.cardtype.selectedIndex == 3) cardtype="Laser";

        // get the "clean" version of the cc number, only numbers
    var ccnum=GimmeNumbers(formName.ccnum.value);

	// check for correct card number length
	if (ccnum.length<13) {
  alert("This credit card number is not a valid length!");
				document.FeedbackForm.ccnum.focus();
                return false;
		return false;
}

        if (ccnum.length!=16 && cardtype=="mastercard") {
  alert("This credit card number is not a valid length!");
				document.FeedbackForm.ccnum.focus();
                return false;
}
        if (ccnum.length!=16 && cardtype=="Laser") {
   alert("This credit card number is not a valid length!");
				document.FeedbackForm.ccnum.focus();
                return false;
}
if (ccnum.length!=15 && cardtype=="AmericanExpress") {
   alert("This credit card number is not a valid length!");
				document.FeedbackForm.ccnum.focus();
                return false;
}
        if (ccnum.length!=13 && ccnum.length!=16 && cardtype=="visa") {
   alert("This credit card number is not a valid length!");
				document.FeedbackForm.ccnum.focus();
                return false;
}

        // check first number to verify card type
        cctype=ccnum.substring(0,1);
        if (cardtype=="Laser") return true;
		if (cardtype=="AmericanExpress") return true;
        if (cardtype=="visa" && cctype!="4") return false;
        if (cardtype=="mastercard" && cctype!="5") return false;

        // make an array and fill it with the individual digits of the cc number
        ccnumchk=new Array;
	   for (splits=0; splits<ccnum.length; splits++) {
                ccnumchk[splits]=ccnum.substring(splits, splits+1);
		}

        // 		perform the weird mathematical method (some base 10 stuff) to
        //      convert the number to a two digit number
        //      for those of you who aren't as familiar with the js operators
        //      i'll comment some of the math lines...well, really just one
        var skemp=0;
	for (splits=0; splits<ccnum.length; splits++) {
                if (splits%2==0) {      // if splits is an even number./      more specifically, if splits
                                        //      divided by two has no
                                        //      remainder (ya' know, remainder
                                        //      one of those math things :),
                                        //      then perform this block
			ccnumchk[splits]=ccnumchk[splits]*2;
			if (ccnumchk[splits]>=10) ccnumchk[splits]=ccnumchk[splits]-9;
			}
                // play a js trick to switch ccnumchk[splits] to a number
                //      variable instead of a string
		ccnumchk[splits]++; ccnumchk[splits]--;
		skemp=skemp + ccnumchk[splits].valueOf();
		}

        if (skemp%10!=0) {return false;} // if the resulting number isn't base
                                         //     10, they're lying to ya./     or they mistyped...same thing
	else {
		formName.ccnum.value=ccnum;
		return true;
		}
	}
    function GimmeNumbers(loadedText) {     // this function removes everything but numbers
                var cleanText="";

                // make sure input is a string
                loadedText+="";

                for (skimp=0; skimp<loadedText.length; skimp++) {
                        if (loadedText.substring(skimp,skimp+1)>="0" && loadedText.substring(skimp, skimp+1)<="9") cleanText+=loadedText.substring(skimp, skimp+1);
                        }
                return cleanText;
                }

//price calculator was here

function valid(formName) {
	
			 
	

	if (document.FeedbackForm.FirstName.value==""){ 
		alert("Please enter your first name!");
		document.FeedbackForm.FirstName.focus();
                    return false; 
         }
		 
	if (document.FeedbackForm.LastName.value==""){ 
		alert("Please enter your surname!");
		document.FeedbackForm.LastName.focus();
                    return false; 
         }
		 
	if (document.FeedbackForm.Address1.value==""){ 
		alert("Please enter the First Line of your Address!");
		document.FeedbackForm.Address1.focus();
                    return false; 
         }
		 
	if (document.FeedbackForm.Address4.value==""){ 
		alert("Please enter the County where you live!");
		document.FeedbackForm.Address4.focus();
                    return false; 
         }
		 
	if (document.FeedbackForm.Address5.value==""){ 
		alert("Please enter the Country you reside in!");
		document.FeedbackForm.Address5.focus();
                    return false; 
         }	 
	if (document.FeedbackForm.Email.value==""){ 
		alert("Please enter the Email address!");
		document.FeedbackForm.Email.focus();
                    return false; 
         }	
		 
		
		
	if (document.FeedbackForm.BillingBy.value==""){ 
		alert("Please enter your preferred Billing Method!");
		document.FeedbackForm.BillingBy.focus();
                    return false; 
         }	

	if (document.FeedbackForm.cardtype.value==""){ 
		alert("Please enter your Credit Card Type!");
		document.FeedbackForm.cardtype.focus();
                    return false; 
         }	
		 
	

//Credit card details all madatory

	if (document.FeedbackForm.CCSecurityNumber.value == "") {
       window.alert("Please enter the last 3 digits on the reverse of your credit card")
	   document.FeedbackForm.CCSecurityNumber.focus();
       return false;
	}
	if (document.FeedbackForm.CCExpiryDate.value == "") {
       window.alert("Please enter your credit card expiry date")
	   document.FeedbackForm.CCExpiryDate.focus();
       return false;
	}
	if (document.FeedbackForm.CCHolderName.value == "") {
       window.alert("Please enter the name as it appears on your credit card")
	   document.FeedbackForm.CCHolderName.focus();
       return false;
	}
	
	if (document.FeedbackForm.check1.checked==""){ 
		alert("You must accept the terms and conditions to continue!");
		document.FeedbackForm.check1.focus();
                    return false; 
         }
		 

return true;      


}