width=261;
height=312.5;
style="purse";
dye="green";
stitch="blue";
pattern="01";
flower="5petal";
function updateCustom(){
    if(style=="tote"){
        dojo.byId("item_name_2").value="Tote";
        dojo.byId("item_price_2").value="165"
    }else{
        if(style=="purse"){
            dojo.byId("item_name_2").value="Bell";
            dojo.byId("item_price_2").value="135"
        }
    }
    dojo.byId("item_name_2").value="Custom "+dye+" "+dojo.byId("item_name_2").value+" w/ "+stitch+" stitch"
}
function changeStyleTo(A){
    if(A!=style){
        pattern="01";
        flower="5petal";
        document.border.src="custom/"+A+"/borders/01.gif";
        document.pattern.src="custom/"+A+"/patterns/"+pattern+".gif";
        document.flower.src="custom/"+A+"/patterns/"+pattern+"/"+flower+".gif";
        document.stitch.src="custom/"+A+"/stitch/"+stitch+".gif"
    }
    style=A;
    document.dye.src="custom/"+style+"/template.gif";
    adjustImageDims(style);
    updateCustom()
}
function adjustImageDims(A){
    if(A=="purse"){
        width=261;
        height=312.5
    }
    if(A=="tote"){
        width=257;
        height=339.5
    }
    w2=2*width;
    h2=2*height;
    document.stitch.width=document.pattern.width=document.flower.width=document.dye.width=document.border.width=w2;
    document.stitch.height=document.pattern.height=document.flower.height=document.dye.height=document.border.height=h2;
    updateCustom()
}
function changeOnClick(A){
    stitch=A;
    document.stitch.src="custom/"+style+"/stitch/"+stitch+".gif";
    updateCustom()
}
function changeDyeOnClick(A){
    dye=A;
    document.dye.style.background="url(custom/dyes/"+dye+".jpg)";
    updateCustom()
}
function changePatternOnClick(A){
    pattern=A;
    if(pattern=="00"){
        flower="";
        document.pattern.src="custom/stamps/"+pattern+".gif";
        document.flower.src="custom/stamps/"+pattern+".gif";
        dojo.byId("flowerbutton").disabled=true;
        document.getElementById("largeflowers").style.display="none";
        document.getElementById("smallflowers").style.display="none"
    }else{
        if(flower==""){
            flower="5petal"
        }
        dojo.byId("flowerbutton").disabled=false;
        document.getElementById("largeflowers").style.display="block";
        document.getElementById("smallflowers").style.display="block";
        document.pattern.src="custom/"+style+"/patterns/"+pattern+".gif";
        document.flower.src="custom/"+style+"/patterns/"+pattern+"/"+flower+".gif"
    }
    if(style=="tote"&&pattern=="03"||pattern=="00"){
        flower="5petal"
    }else{}
    updateCustom()
}
function changeFlowerOnClick(A){
    flower=A;
    document.flower.src="custom/"+style+"/patterns/"+pattern+"/"+A+".gif";
    updateCustom()
};
