//Handles setting the values of the estimate form.
function fieldfocus(fieldid)
{
    if (document.getElementById(fieldid).value == "0")
    {
        document.getElementById(fieldid).value = "";
    }
}

function fieldblur(fieldid)
{
    if (document.getElementById(fieldid).value == "")
    {
        document.getElementById(fieldid).value = "0";
    }
}


function selectwindow(id)
{
    var height = "estimate_height"+id;
    var width = "estimate_width"+id;
    
    if (document.getElementById(height).value == "0" || document.getElementById(width).value == "0")
    {
        window.alert("Height and Width must be set!");
    }
    else
    {
        var urlstring = "/estimater/update_window?id="+id+"&height="+document.getElementById(height).value+"&width="+document.getElementById(width).value;
        document.location = urlstring;
    }
}

function returnheight(id)
{
    var height = "estimate_height"+id;
    return document.getElementById(height).value;
}

function returnwidth(id)
{
    var width = "estimate_width"+id;
    return document.getElementById(width).value;
}

function formsubmit()
{
    document.forms[0].submit();
}