
var partPick    = "";
var surfacePick = "";
var formatPick  = "";
var sizePick    = "";

var Data            = new Array();
var description     = "";
var descriptionOrg  = "";
var cost            = "";
var costOrg         = "";

var screenAddon = "";
var quietMotor  = '<input type="checkbox" name="quietMotor" value="yes" onClick="addonSelected()">Quiet Motor';
var lowVoltage  = '<input type="checkbox" name="lowVoltage" value="yes" onClick="addonSelected()">Low Voltage Control Built-In';

var quietMotorPrice = 155.99;
var lowVoltagePrice = 199.99;

function setOptions(chosen) {
var selbox = document.myform.opttwo;
selbox.options.length = 0;
if (chosen == " ") {
selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' ');
}

if (chosen == "999") {
selbox.options[selbox.options.length] = new Option('Screen Format',' ');
setOptionsTwo("99");
}
if (chosen == "Glass Beaded") {
selbox.options[selbox.options.length] = new Option('Screen Format','99');
selbox.options[selbox.options.length] = new Option('AV','AV');
}

if (chosen == "Matt White") {
selbox.options[selbox.options.length] = new Option('Screen Format','99');
selbox.options[selbox.options.length] = new Option('AV','AV');
}

if (chosen == "High Contrast Grey") {
selbox.options[selbox.options.length] = new Option('Screen Format','99');
selbox.options[selbox.options.length] = new Option('AV','AV');
}

surfacePick = chosen;
}

function setOptionsTwo(chosen) {
var selbox = document.myform.optthree;
selbox.options.length = 0;

if (chosen == " ") {
selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' ');
}
if (chosen == "99") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
}
if (chosen == "AV" && surfacePick == "Glass Beaded") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('10 ft x 10 ft','10 ft x 10 ft');
selbox.options[selbox.options.length] = new Option('12 ft x 12 ft','12 ft x 12 ft');
selbox.options[selbox.options.length] = new Option('50 inch x 50 inch','50 inch x 50 inch');
selbox.options[selbox.options.length] = new Option('60 inch x 60 inch','60 inch x 60 inch');
selbox.options[selbox.options.length] = new Option('7 ft x 9 ft','7 ft x 9 ft');
selbox.options[selbox.options.length] = new Option('70 inch x 70 inch','70 inch x 70 inch');
selbox.options[selbox.options.length] = new Option('72 inch x 96 inch','72 inch x 96 inch');
selbox.options[selbox.options.length] = new Option('8 ft x 10 ft','8 ft x 10 ft');
selbox.options[selbox.options.length] = new Option('84 inch x 84 inch','84 inch x 84 inch');
selbox.options[selbox.options.length] = new Option('9 ft x 12 ft','9 ft x 12 ft');
selbox.options[selbox.options.length] = new Option('9 ft x 9 ft','9 ft x 9 ft');
selbox.options[selbox.options.length] = new Option('96 inch x 96 inch','96 inch x 96 inch');
}


if (chosen == "AV" && surfacePick == "Matt White") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('10 ft x 10 ft','10 ft x 10 ft');
selbox.options[selbox.options.length] = new Option('12 ft x 12 ft','12 ft x 12 ft');
selbox.options[selbox.options.length] = new Option('50 inch x 50 inch','50 inch x 50 inch');
selbox.options[selbox.options.length] = new Option('60 inch x 60 inch','60 inch x 60 inch');
selbox.options[selbox.options.length] = new Option('7 ft x 9 ft','7 ft x 9 ft');
selbox.options[selbox.options.length] = new Option('70 inch x 70 inch','70 inch x 70 inch');
selbox.options[selbox.options.length] = new Option('72 inch x 96 inch','72 inch x 96 inch');
selbox.options[selbox.options.length] = new Option('8 ft x 10 ft','8 ft x 10 ft');
selbox.options[selbox.options.length] = new Option('84 inch x 84 inch','84 inch x 84 inch');
selbox.options[selbox.options.length] = new Option('9 ft x 12 ft','9 ft x 12 ft');
selbox.options[selbox.options.length] = new Option('9 ft x 9 ft','9 ft x 9 ft');
selbox.options[selbox.options.length] = new Option('96 inch x 96 inch','96 inch x 96 inch');
}


if (chosen == "AV" && surfacePick == "High Contrast Grey") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('50 inch x 50 inch','50 inch x 50 inch');
selbox.options[selbox.options.length] = new Option('60 inch x 60 inch','60 inch x 60 inch');
selbox.options[selbox.options.length] = new Option('7 ft x 9 ft','7 ft x 9 ft');
selbox.options[selbox.options.length] = new Option('70 inch x 70 inch','70 inch x 70 inch');
selbox.options[selbox.options.length] = new Option('72 inch x 96 inch','72 inch x 96 inch');
selbox.options[selbox.options.length] = new Option('8 ft x 10 ft','8 ft x 10 ft');
selbox.options[selbox.options.length] = new Option('84 inch x 84 inch','84 inch x 84 inch');
selbox.options[selbox.options.length] = new Option('96 inch x 96 inch','96 inch x 96 inch');
}


 formatPick = chosen; 
}
function storeSize(chosen) {
sizePick= chosen;
}

function saveValues() {
document.Prod.PartNo.value = partPick;
document.Prod.Item.value = description;
document.Prod.Price.value = cost;
}

function displayValues() {
document.getElementById('unitInfo').innerHTML = surfacePick + " " + formatPick + " " + sizePick
document.getElementById('cost').innerHTML = "Our Price $" + cost +" Including Free Shipping<br><br>"

document.getElementById('button').innerHTML = '<input type="submit" value="ADD TO CART" class="btn">';
}

function displayAddons() {
  document.getElementById('access').innerHTML = screenAddon;
}

function ChooseProd() {

Data[0] = new Array("113022","Glass Beaded","AV","10 ft x 10 ft","","","","Ambassador, 10 ft x 10 ft, AV, Glass Beaded, 110 V","1633");
Data[1] = new Array("113010","Matt White","AV","10 ft x 10 ft","","","","Ambassador, 10 ft x 10 ft, AV, Matt White, 110 V","1633");
Data[2] = new Array("113024","Glass Beaded","AV","12 ft x 12 ft","","","","Ambassador, 12 ft x 12 ft, AV, Glass Beaded, 110 V","1885");
Data[3] = new Array("113012","Matt White","AV","12 ft x 12 ft","","","","Ambassador, 12 ft x 12 ft, AV, Matt White, 110 V","1885");
Data[4] = new Array("113013","Glass Beaded","AV","50 inch x 50 inch","","","","Ambassador, 50 inch x 50 inch, AV, Glass Beaded, 110 V","1342");
Data[5] = new Array("113028","High Contrast Grey","AV","50 inch x 50 inch","","","","Ambassador, 50 inch x 50 inch, AV, High Contrast Grey, 110 V","1342");
Data[6] = new Array("113001","Matt White","AV","50 inch x 50 inch","","","","Ambassador, 50 inch x 50 inch, AV, Matt White, 110 V","1342");
Data[7] = new Array("113014","Glass Beaded","AV","60 inch x 60 inch","","","","Ambassador, 60 inch x 60 inch, AV, Glass Beaded, 110 V","1352");
Data[8] = new Array("113029","High Contrast Grey","AV","60 inch x 60 inch","","","","Ambassador, 60 inch x 60 inch, AV, High Contrast Grey, 110 V","1352");
Data[9] = new Array("113002","Matt White","AV","60 inch x 60 inch","","","","Ambassador, 60 inch x 60 inch, AV, Matt White, 110 V","1352");
Data[10] = new Array("113019","Glass Beaded","AV","7 ft x 9 ft","","","","Ambassador, 7 ft x 9 ft, AV, Glass Beaded, 110 V","1542");
Data[11] = new Array("113034","High Contrast Grey","AV","7 ft x 9 ft","","","","Ambassador, 7 ft x 9 ft, AV, High Contrast Grey, 110 V","1542");
Data[12] = new Array("113007","Matt White","AV","7 ft x 9 ft","","","","Ambassador, 7 ft x 9 ft, AV, Matt White, 110 V","1542");
Data[13] = new Array("113015","Glass Beaded","AV","70 inch x 70 inch","","","","Ambassador, 70 inch x 70 inch, AV, Glass Beaded, 110 V","1369");
Data[14] = new Array("113030","High Contrast Grey","AV","70 inch x 70 inch","","","","Ambassador, 70 inch x 70 inch, AV, High Contrast Grey, 110 V","1369");
Data[15] = new Array("113003","Matt White","AV","70 inch x 70 inch","","","","Ambassador, 70 inch x 70 inch, AV, Matt White, 110 V","1369");
Data[16] = new Array("113017","Glass Beaded","AV","72 inch x 96 inch","","","","Ambassador, 72 inch x 96 inch, AV, Glass Beaded, 110 V","1442");
Data[17] = new Array("113032","High Contrast Grey","AV","72 inch x 96 inch","","","","Ambassador, 72 inch x 96 inch, AV, High Contrast Grey, 110 V","1442");
Data[18] = new Array("113005","Matt White","AV","72 inch x 96 inch","","","","Ambassador, 72 inch x 96 inch, AV, Matt White, 110 V","1442");
Data[19] = new Array("113021","Glass Beaded","AV","8 ft x 10 ft","","","","Ambassador, 8 ft x 10 ft, AV, Glass Beaded, 110 V","1600");
Data[20] = new Array("113035","High Contrast Grey","AV","8 ft x 10 ft","","","","Ambassador, 8 ft x 10 ft, AV, High Contrast Grey, 110 V","1600");
Data[21] = new Array("113009","Matt White","AV","8 ft x 10 ft","","","","Ambassador, 8 ft x 10 ft, AV, Matt White, 110 V","1600");
Data[22] = new Array("113016","Glass Beaded","AV","84 inch x 84 inch","","","","Ambassador, 84 inch x 84 inch, AV, Glass Beaded, 110 V","1422");
Data[23] = new Array("113031","High Contrast Grey","AV","84 inch x 84 inch","","","","Ambassador, 84 inch x 84 inch, AV, High Contrast Grey, 110 V","1422");
Data[24] = new Array("113004","Matt White","AV","84 inch x 84 inch","","","","Ambassador, 84 inch x 84 inch, AV, Matt White, 110 V","1422");
Data[25] = new Array("113023","Glass Beaded","AV","9 ft x 12 ft","","","","Ambassador, 9 ft x 12 ft, AV, Glass Beaded, 110 V","1647");
Data[26] = new Array("113011","Matt White","AV","9 ft x 12 ft","","","","Ambassador, 9 ft x 12 ft, AV, Matt White, 110 V","1647");
Data[27] = new Array("113020","Glass Beaded","AV","9 ft x 9 ft","","","","Ambassador, 9 ft x 9 ft, AV, Glass Beaded, 110 V","1564");
Data[28] = new Array("113008","Matt White","AV","9 ft x 9 ft","","","","Ambassador, 9 ft x 9 ft, AV, Matt White, 110 V","1564");
Data[29] = new Array("113018","Glass Beaded","AV","96 inch x 96 inch","","","","Ambassador, 96 inch x 96 inch, AV, Glass Beaded, 110 V","1490");
Data[30] = new Array("113033","High Contrast Grey","AV","96 inch x 96 inch","","","","Ambassador, 96 inch x 96 inch, AV, High Contrast Grey, 110 V","1490");
Data[31] = new Array("113006","Matt White","AV","96 inch x 96 inch","","","","Ambassador, 96 inch x 96 inch, AV, Matt White, 110 V","1490");


   for (i = 0; i < Data.length; i++) {
        if (surfacePick == Data[i][1] && formatPick == Data[i][2] && sizePick == Data[i][3])
        partPick = Data[i][0];
   }

    for (i = 0; i < Data.length; i++) {
        if (partPick == Data[i][0]) {
            if (Data[i][5] == "ql")     screenAddon = quietMotor + "<br>" + lowVoltage;
        else if (Data[i][4] == "q" ) {
            screenAddon = quietMotor;
            if (Data[i][6] == "l")  screenAddon = quietMotor + "<br>" + lowVoltage;
        }
        else if (Data[i][6] == "l") screenAddon = lowVoltage;
        else screenAddon = "";

            description = Data[i][7];
            descriptionOrg = description;
            cost = parseFloat(Data[i][8]);
            costOrg = cost;
        }
   }

   saveValues();
    displayValues();
}



function CheckBox() {
partPick = partPick.substring(0,6);
cost = costOrg;
description = descriptionOrg;

if (document.Prod.quietMotor) {
    if (document.Prod.quietMotor.checked) {
        document.Prod.quietMotor.setAttribute("checked","checked");
        partPick = partPick + "Q";
        cost = cost + quietMotorPrice;
        description = description + ", With Quiet Motor";

    } else {
        document.Prod.quietMotor.removeAttribute("checked");
        partPick = partPick.replace("Q","");

    }

}

    if (document.Prod.lowVoltage) {
        if (document.Prod.lowVoltage.checked) {
        document.Prod.lowVoltage.setAttribute("checked","checked");
        partPick = partPick + "L";
        cost = cost + lowVoltagePrice;
        description = description + ", With Low Voltage Controller";

    } else {
        document.Prod.lowVoltage.removeAttribute("checked");
        partPick = partPick.replace("L","");

    }

}
   if (document.Prod.quietMotor && document.Prod.lowVoltage) {
        if (document.Prod.quietMotor.checked && document.Prod.lowVoltage.checked) {
            partPick = partPick.substring(0,6) + "QL";
            cost = costOrg + quietMotorPrice + lowVoltagePrice;
            description = descriptionOrg + ", With Quiet Motor & Low Voltage Controller";
    }
}

cost = cost.toFixed(2);
}

function addonSelected() {
     CheckBox();
     saveValues();
     displayValues();
}

function resetCost() {
     if (sizePick != 9999 && formatPick != 99)
         displayAddons()
     else {
          document.getElementById('access').innerHTML = "";
          document.getElementById('unitInfo').innerHTML = "";
          document.getElementById('cost').innerHTML = "Select a Material, Format and Screen Size below<br><br>";
          document.getElementById('button').innerHTML = '<input disabled type="submit"value="ADD TO CART" class="btn">';
     }
}

