
var partPick    = "";
var surfacePick = "";
var formatPick  = "";
var sizePick    = "";

var Data            = new Array();
var description     = "";
var descriptionOrg  = "";
var cost            = "";
var costOrg         = "";
var weight          = "";
var weightOrg       = "";

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 == "High PowerŪ") {
selbox.options[selbox.options.length] = new Option('Screen Format','99');
selbox.options[selbox.options.length] = new Option('HDTV','HDTV');
selbox.options[selbox.options.length] = new Option('NTSC','NTSC');
}

if (chosen == "Matte White") {
selbox.options[selbox.options.length] = new Option('Screen Format','99');
selbox.options[selbox.options.length] = new Option('HDTV','HDTV');
selbox.options[selbox.options.length] = new Option('NTSC','NTSC');
}

if (chosen == "Video Spectra 1.5") {
selbox.options[selbox.options.length] = new Option('Screen Format','99');
selbox.options[selbox.options.length] = new Option('HDTV','HDTV');
selbox.options[selbox.options.length] = new Option('NTSC','NTSC');
}

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 == "NTSC" && surfacePick == "High PowerŪ") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('105 inch x 140 inch','105 inch x 140 inch');
selbox.options[selbox.options.length] = new Option('60 inch x 80 inch','60 inch x 80 inch');
selbox.options[selbox.options.length] = new Option('69 inch x 92 inch','69 inch x 92 inch');
selbox.options[selbox.options.length] = new Option('87 inch x 116 inch','87 inch x 116 inch');
}


if (chosen == "NTSC" && surfacePick == "Matte White") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('105 inch x 140 inch','105 inch x 140 inch');
selbox.options[selbox.options.length] = new Option('120 inch x 160 inch','120 inch x 160 inch');
selbox.options[selbox.options.length] = new Option('60 inch x 80 inch','60 inch x 80 inch');
selbox.options[selbox.options.length] = new Option('69 inch x 92 inch','69 inch x 92 inch');
selbox.options[selbox.options.length] = new Option('87 inch x 116 inch','87 inch x 116 inch');
}


if (chosen == "NTSC" && surfacePick == "Video Spectra 1.5") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('60 inch x 80 inch','60 inch x 80 inch');
selbox.options[selbox.options.length] = new Option('69 inch x 92 inch','69 inch x 92 inch');
}


if (chosen == "HDTV" && surfacePick == "High PowerŪ") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('52 inch x 92 inch','52 inch x 92 inch');
selbox.options[selbox.options.length] = new Option('58 inch x 104 inch','58 inch x 104 inch');
selbox.options[selbox.options.length] = new Option('65 inch x 116 inch','65 inch x 116 inch');
selbox.options[selbox.options.length] = new Option('78 inch x 139 inch','78 inch x 139 inch');
}


if (chosen == "HDTV" && surfacePick == "Matte White") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('52 inch x 92 inch','52 inch x 92 inch');
selbox.options[selbox.options.length] = new Option('58 inch x 104 inch','58 inch x 104 inch');
selbox.options[selbox.options.length] = new Option('65 inch x 116 inch','65 inch x 116 inch');
selbox.options[selbox.options.length] = new Option('78 inch x 139 inch','78 inch x 139 inch');
}


if (chosen == "HDTV" && surfacePick == "Video Spectra 1.5") {
selbox.options[selbox.options.length] = new Option('Screen Size','9999');
selbox.options[selbox.options.length] = new Option('52 inch x 92 inch','52 inch x 92 inch');
selbox.options[selbox.options.length] = new Option('58 inch x 104 inch','58 inch x 104 inch');
selbox.options[selbox.options.length] = new Option('65 inch x 116 inch','65 inch x 116 inch');
selbox.options[selbox.options.length] = new Option('78 inch x 139 inch','78 inch x 139 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;
document.Prod.Weight.value = weight;
}

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("84761","High PowerŪ","NTSC","105 inch x 140 inch","","","","Ascender Electrol, 105 inch x 140 inch, NTSC, High PowerŪ","7580.25","654");
Data[1] = new Array("84759","Matte White","NTSC","105 inch x 140 inch","","","","Ascender Electrol, 105 inch x 140 inch, NTSC, Matte White","7438.5","654");
Data[2] = new Array("84762","Matte White","NTSC","120 inch x 160 inch","","","","Ascender Electrol, 120 inch x 160 inch, NTSC, Matte White","8179.65","660");
Data[3] = new Array("84767","High PowerŪ","HDTV","52 inch x 92 inch","","","","Ascender Electrol, 52 inch x 92 inch, HDTV, High PowerŪ","5360.85","480");
Data[4] = new Array("84764","Matte White","HDTV","52 inch x 92 inch","","","","Ascender Electrol, 52 inch x 92 inch, HDTV, Matte White","5219.1","480");
Data[5] = new Array("84766","Video Spectra 1.5","HDTV","52 inch x 92 inch","","","","Ascender Electrol, 52 inch x 92 inch, HDTV, Video Spectra 1.5","5219.1","480");
Data[6] = new Array("84771","High PowerŪ","HDTV","58 inch x 104 inch","","","","Ascender Electrol, 58 inch x 104 inch, HDTV, High PowerŪ","5842.8","485");
Data[7] = new Array("84768","Matte White","HDTV","58 inch x 104 inch","","","","Ascender Electrol, 58 inch x 104 inch, HDTV, Matte White","5701.05","485");
Data[8] = new Array("84770","Video Spectra 1.5","HDTV","58 inch x 104 inch","","","","Ascender Electrol, 58 inch x 104 inch, HDTV, Video Spectra 1.5","5701.05","485");
Data[9] = new Array("84751","High PowerŪ","NTSC","60 inch x 80 inch","","","","Ascender Electrol, 60 inch x 80 inch, NTSC, High PowerŪ","5024.7","485");
Data[10] = new Array("84748","Matte White","NTSC","60 inch x 80 inch","","","","Ascender Electrol, 60 inch x 80 inch, NTSC, Matte White","4882.95","485");
Data[11] = new Array("84750","Video Spectra 1.5","NTSC","60 inch x 80 inch","","","","Ascender Electrol, 60 inch x 80 inch, NTSC, Video Spectra 1.5","4882.95","485");
Data[12] = new Array("84775","High PowerŪ","HDTV","65 inch x 116 inch","","","","Ascender Electrol, 65 inch x 116 inch, HDTV, High PowerŪ","6138.45","500");
Data[13] = new Array("84772","Matte White","HDTV","65 inch x 116 inch","","","","Ascender Electrol, 65 inch x 116 inch, HDTV, Matte White","5996.7","500");
Data[14] = new Array("84774","Video Spectra 1.5","HDTV","65 inch x 116 inch","","","","Ascender Electrol, 65 inch x 116 inch, HDTV, Video Spectra 1.5","5996.7","500");
Data[15] = new Array("84755","High PowerŪ","NTSC","69 inch x 92 inch","","","","Ascender Electrol, 69 inch x 92 inch, NTSC, High PowerŪ","5320.35","490");
Data[16] = new Array("84752","Matte White","NTSC","69 inch x 92 inch","","","","Ascender Electrol, 69 inch x 92 inch, NTSC, Matte White","5178.6","490");
Data[17] = new Array("84754","Video Spectra 1.5","NTSC","69 inch x 92 inch","","","","Ascender Electrol, 69 inch x 92 inch, NTSC, Video Spectra 1.5","5178.6","490");
Data[18] = new Array("84779","High PowerŪ","HDTV","78 inch x 139 inch","","","","Ascender Electrol, 78 inch x 139 inch, HDTV, High PowerŪ","7619.4","600");
Data[19] = new Array("84776","Matte White","HDTV","78 inch x 139 inch","","","","Ascender Electrol, 78 inch x 139 inch, HDTV, Matte White","7477.65","600");
Data[20] = new Array("84778","Video Spectra 1.5","HDTV","78 inch x 139 inch","","","","Ascender Electrol, 78 inch x 139 inch, HDTV, Video Spectra 1.5","7477.65","600");
Data[21] = new Array("84758","High PowerŪ","NTSC","87 inch x 116 inch","","","","Ascender Electrol, 87 inch x 116 inch, NTSC, High PowerŪ","6061.5","585");
Data[22] = new Array("84756","Matte White","NTSC","87 inch x 116 inch","","","","Ascender Electrol, 87 inch x 116 inch, NTSC, Matte White","5919.75","585");


   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;
            weight = Data[i][9];
            weightOrg = weight;
        }
   }

   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">';
     }
}

