// create a shed object

function shed(typeOfShed) 
{
    this.Shed_type = typeOfShed; // for db queries?
    this.Shed_width = 1; // this and the next can probably be deleted once we upgrade
    this.Shed_depth = 1;
    this.Shed_height = 7; // set to a sane default height
    this.Siding_type = "wood";
    this.Vinyl_price = 0;
    this.Siding_color = "";
    this.Shingle_color = "";
    this.Trim_color = "";
    this.Floor_type = "Standard floor";
    this.Shutter_color;  // no switch for shutters, b/c the shutterColor implies that we have shutters
    this.Potting_shed;
    this.Shipping_price = 0;
    this.Shelf_number;
    this.Shelf_length;
	this.size = "";
    
    
    // sets the shed size properties
    this.setSize = function(front)
    {
            sel = document.getElementById('size').selectedIndex;
            // if statement is here to deal with people selecting a siding without selecting a size first or if they change the size back to "Choose a size"
            if (document.getElementById('size').options[sel].innerHTML == "Choose a size") {
                    this.Shed_depth = 1;
                    this.Shed_width = 1;
					this.Size = "";
                    }
            else {
					this.size = document.getElementById('size').options[sel].innerHTML;
                    sizeArray = document.getElementById('size').options[sel].innerHTML.split("x");
                    if (front == "short") {
                            this.Shed_depth = sizeArray[1];
                            this.Shed_width = sizeArray[0];
                            }
                            else {
                            this.Shed_depth = sizeArray[0];
                            this.Shed_width = sizeArray[1];
                            }
                    if (sizeArray.length == 3) {
                            this.Shed_height = sizeArray[2];
                            }	
                    }
    }
    
    this.setSiding = function()
    {
            sel = document.getElementById('siding').selectedIndex;
            sidingArray = document.getElementById('siding').options[sel].innerHTML.split(" - ");
            this.Siding_color = sidingArray[1];
            this.Siding_type = document.getElementById('siding').options[sel].value;
			this.siding = document.getElementById('siding').options[sel].innerHTML;
    }
	
    this.setPottingShed = function()
    {
            if (document.getElementById('potting').checked == true) {
                    this.Potting_shed = "Add potting shed option";
                    Wall3.Number_of_windows = 0;
                    Wall3.Window_size = "large";
                    }
            else {
                    this.Potting_shed = null;
                    Wall3.Number_of_windows = 0;
                    Wall3.Window_size = null;
                    }
    }
    
    this.setFloorType = function(id, labelid)
    {
            this.Floor_type = document.getElementById(labelid).innerHTML;
    }
	
}

function wall(side) 
{
    this.Size = null;
    this.Wall_side = side;
    this.Number_of_windows = 0;
    this.Window_size = null;
    this.Door_type = "No door";
    this.Ramp = 0;
    this.Door_width = 0;
    
    this.setWindows = function(num,size)
    {
        this.Number_of_windows = num;
        if (size) {
            this.Window_size = size;
        }
    }
}

