function AddZeroes (num)
{
    num = num.toString();

    if ((num.indexOf(".") == -1) &&
        (num != "not available"))
    {
        return num + ".00";
    }
    return num;
}


function GetPrice()
{
    var size = document.forms.options.os0.options[document.forms.options.os0.selectedIndex].text;

    switch(size)
    {
        case "Small":
            return document.getElementById("price1").innerHTML;
            break;

        case "Medium":
            return document.getElementById("price2").innerHTML;
            break;

        case "Large":
            return document.getElementById("price3").innerHTML;
            break;

        case "Maxi":
            return document.getElementById("price4").innerHTML;
            break;
    }
}


function ChangePrice(price)
{
    var total = document.getElementById("total");
    var addbutton = document.getElementById("addbutton");
    var product = document.getElementById("productname");

    if (price == "not available")
    {
        total.innerHTML = "Not available in this combination";
        addbutton.src = "../images/blank.gif";
        addbutton.disabled = true;
    }
    else
    {
        document.forms.payment.amount.value = price;
        document.forms.payment.description.value = product.innerHTML +
            " (Size: " +
            document.forms.options.os0.options[document.forms.options.os0.selectedIndex].text +
            ", Wood: " +
            document.forms.options.os1.options[document.forms.options.os1.selectedIndex].text +
            ")";
        total.innerHTML = "<strong>Total:</strong> &pound;" + AddZeroes(price);
        addbutton.src = "../images/buy-one-button.gif";
        addbutton.disabled = false;
    }
}


function ShowWood()
{
    var wood = document.forms.options.os1.options[document.forms.options.os1.selectedIndex].text;
    var image;
    var width;
    var height;

    
    switch (wood)
    {
        case "Bloodwood":
            image = "../images/bloodwood-large.jpg";
            width = 446;
            height = 446;
            break;
            
        case "Cocobolo":
            image = "../images/cocobolo-large.jpg";
            width = 508;
            height = 508;
            break;
            
        case "Lemonwood":
            image = "../images/lemonwood-large.jpg";
            width = 520;
            height = 520;
            break;
            
        case "Lignum Vitae":
            image = "../images/lignum-vitae-large.jpg";
            width = 272;
            height = 272;
            break;
            
        case "Olive Wood":
            image = "../images/olive-wood-large.jpg";
            width = 398;
            height = 398;
            break;
            
        case "Pau Amarello":
            image = "../images/pau-amarello-large.jpg";
            width = 520;
            height = 520;
            break;
            
        case "Purpleheart":
            image = "../images/purpleheart-large.jpg";
            width = 520;
            height = 520;
            break;
            
        case "Snakewood":
            image = "../images/snakewood-large.jpg";
            width = 520;
            height = 520;
            break;
            
        case "Tulip Wood":
            image = "../images/tulip-wood-large.jpg";
            width = 520;
            height = 520;
            break;
            
        case "Zebrano":
            image = "../images/zebrano-large.jpg";
            width = 456;
            height = 456;
            break;
            
        case "Ziracote":
            image = "../images/ziracote-large.jpg";
            width = 520;
            height = 520;
            break;
    }
    window.open(image, "", "width=" + width + ", height=" + height +
                ", scrollbars = no, resizable = no, toolbar = no" +
                ", directories = no, location = no, menubar = no" +
                ", status = no, left = 0, top = 0");

}



