// Form Checker
// Created for CSI Sports
// webmaster@fightsports360.com

// This part is for Cancelation Page

function cancelform()
{
    var tform = document.getElementById("cform");
    var abox = 0;
    var atext = "";

    if (tform.Firstname.value == "") {
	abox += 1;
	atext += "First Name\n";
    }
    if (tform.Lastname.value == "") {
	abox += 1;
	atext += "Last Name\n";
    }
    if (tform.email.value == "") {
	abox += 1;
	atext += "E-mail address\n";
    }
    if (tform.ordernumber.value == "") {
	abox += 1;
	atext += "Order Number\n";
    }
    if (tform.phonenumber.value == "") {
	abox += 1;
	atext += "Phone Number\n";
    }

    if (tform.QualityOfProduct.selectedIndex == 0) {
	abox += 1;
	atext += "Quality of Product\n";
    }
    //    atext +=  tform.QualityOfProduct.selectedIndex + "<+QoPL\n";

    if (tform.PricingOfProduct.selectedIndex == 0) {
	abox += 1;
	atext += "Pricing of Product\n";
    }
    if (tform.TelephoneOperator.selectedIndex == 0) {
	abox += 1;
	atext += "Telephone Operator\n";
    }
    if (tform.Website.selectedIndex == 0) {
	abox += 1;
	atext += "Website\n";
    }
    if (tform.CustomerService.selectedIndex == 0) {
	abox += 1;
	atext += "Customer Service\n";
    }
    if (tform.ShippingMethod.selectedIndex == 0) {
	abox += 1;
	atext += "Shipping Method\n";
    }
    if (tform.CostOfAdditianlEpisode.selectedIndex == 0) {
	abox += 1;
	atext += "Cost of Additional Episodes\n";
    }
    if (tform.ReasonForCanceling.selectedIndex == 0) {
	abox += 1;
	atext += "Reason for Canceling\n";
    }
    if (tform.email2.value != tform.email.value) {
	abox += 1;
	atext += "Your E-mail mismatch\n";
    }
    if (tform.Last4Digit.value == "") {
	abox += 1;
	atext += "Last 4 Digit of your Credit Card used\n";
    }
    if (tform.BillingAddress.value == "") {
	abox += 1;
	atext += "Billing Address\n";
    }
    if (tform.BillingCity.value == "") {
	abox += 1;
	atext += "City\n";
    }
    if (tform.BillingZip.value == "") {
	abox += 1;
	atext += "Zip\n";
    }

    //    alert (abox);
    if (abox > 1) {
	alert ("Few Required fields you've missed are:\n"+atext);
	return false;
    } else if (abox == 1) {
	alert ("A Required field you've missed is:\n"+atext);
	return false;
    }
    
    // Congratulation, you pass all the required fields.
    return true;
}

function WithoutSelectionValue(ss) {
    for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
	    if(ss[i].value.length) { return false; }
	}
    }
    return true;
}

