﻿var currentPanel = "length"

function showFormPanel(panelToShow){
	document.getElementById(currentPanel).style.display = "none";
	document.getElementById("subnav_"+currentPanel).className = "";
	document.getElementById(panelToShow).style.display = "block";
	document.getElementById("subnav_"+panelToShow).className = "on";
	currentPanel = panelToShow;
	document.location.href="#options"
	calculateRunningTotal()
}

function calculateRunningTotal(){
    var runningTotal = Prices.basic_price
    wlForm = document.forms[0]
    
    var stiffness_overall_index = wlForm.stiffness_overall.selectedIndex;
    if(stiffness_overall_index > 0){
        runningTotal += Prices.stiffness_overall_prices[stiffness_overall_index -1];
    }
    
        
    if(get_radio_value(wlForm.split_board) == "split_board_yes"){
        runningTotal +=Prices.split_board_price;
    }
    
    var core_index = wlForm.core.selectedIndex;
    if(core_index > 0){
        runningTotal += Prices.core_prices[core_index];
    }
    
    if(get_radio_value(wlForm.damping) == "damping_yes"){
        runningTotal +=Prices.damping_price;
    }
    
    var top_sheet_colour_index = wlForm.top_sheet_colour.selectedIndex;
    if(top_sheet_colour_index > 10 && top_sheet_colour_index < 18 ){
        runningTotal += Prices.top_sheet_texalium_price
    }
    
    if(top_sheet_colour_index > 19 ){
        runningTotal += Prices.top_sheet_wood_price
    }

    if(get_radio_value(wlForm.your_name) == "your_name_yes"){
        runningTotal +=Prices.your_name_price;
    }
    
    if(get_radio_value(wlForm.your_logo) == "your_logo_yes"){
        runningTotal +=Prices.your_logo_price;
    }
    
    if(get_radio_value(wlForm.top_sheet) == "top_sheet_yes"){
        runningTotal +=Prices.top_sheet_price;
    }
    //alert(runningTotal)
    document.getElementById("total1").innerHTML = runningTotal
    document.getElementById("total2").innerHTML = runningTotal
    document.getElementById("total3").innerHTML = runningTotal
    document.getElementById("total4").innerHTML = runningTotal
    document.getElementById("total5").innerHTML = runningTotal
    document.getElementById("total6").innerHTML = runningTotal
}

