
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
var Designdb = new Object()
Designdb["hersheys_kisses"] = [{id:"3", text:"abstract_tree_4216003"},
					                    {id:"14", text:"country_quilt_4216014"},
					                    {id:"9", text:"green_tree_4216009"},
            				          {id:"13", text:"hanging_ball_ornaments_4216013"},
                              {id:"1", text:"hanging_stars_4216001"},
					                    {id:"11", text:"light_string_4216011"},
            			            {id:"16", text:"mittens_4216017"},
                    				  {id:"10", text:"red_ball_4216010"},
                              {id:"7", text:"red_present_4216007"},
                              {id:"4", text:"red_ribbon_4216004"},
                      				{id:"6", text:"retro_squares_4216006"},
                      				{id:"12", text:"single_snowflake_4216012"},
                              {id:"2", text:"snow_cascading_4216002"},
	                      		  {id:"17", text:"stripes_gray_cross_4216042"},
                              {id:"5", text:"three_holiday_cocktail_glasses_4216005"},
                              {id:"8", text:"three_red_balls_4216008"},
                              {id:"15", text:"two_pine_cones_4216016"}];
Designdb["hersheys_miniatures"] = [{id:"23", text:"abstract_tree_4186003"},
                              {id:"34", text:"country_quilt_4186014"},
                              {id:"29", text:"green_tree_4186009"},
                              {id:"33", text:"hanging_ball_ornaments_4186013"},
                              {id:"21", text:"hanging_stars_4186001"},
                              {id:"31", text:"light_string_4186011"},
                              {id:"36", text:"mittens_4186017"},
                              {id:"30", text:"red_ball_4186010"},
                              {id:"27", text:"red_present_4186007"},
                              {id:"24", text:"red_ribbon_4186004"},
                              {id:"26", text:"retro_squares_4186006"},
                              {id:"38", text:"shooting_stars_4186040"},
                              {id:"32", text:"single_snowflake_4186012"},
                              {id:"22", text:"snow_cascading_4186002"},
                              {id:"37", text:"stripes_gray_cross_4186042"},                      
                              {id:"25", text:"three_holiday_cocktail_glasses_4186005"},					  
                              {id:"28", text:"three_red_balls_4186008"},
                              {id:"35", text:"two_pine_cones_4186016"},
                              {id:"39", text:"winter_wonderland_trees_4186015"}];
Designdb["reg_chocolate_bar"] = [{id:"43", text:"abstract_tree_4166003"},
                              {id:"54", text:"country_quilt_4166014"},
                              {id:"49", text:"green_tree_4166009"},
                              {id:"53", text:"hanging_ball_ornaments_4166013"},
                              {id:"41", text:"hanging_stars_4166001"},
                              {id:"51", text:"light_string_4166011"},
                              {id:"56", text:"mittens_4166017"},
                              {id:"50", text:"red_ball_4166010"},
                              {id:"47", text:"red_present_4166007"},
                              {id:"44", text:"red_ribbon_4166004"},
                              {id:"46", text:"retro_squares_4166006"},
                              {id:"58", text:"shooting_stars_4166040"},
                              {id:"52", text:"single_snowflake_4166012"},
                              {id:"42", text:"snow_cascading_4166002"},
                              {id:"57", text:"stripes_gray_cross_4166042"},
                              {id:"45", text:"three_holiday_cocktail_glasses_4166005"},
                              {id:"48", text:"three_red_balls_4166008"},
                              {id:"55", text:"two_pine_cones_4166016"},
                              {id:"59", text:"winter_wonderland_trees_4166015"}];
Designdb["5oz_chocolate_bar"] = [{id:"63", text:"abstract_tree_4236003"},
                              {id:"74", text:"country_quilt_4236014"},
                              {id:"69", text:"green_tree_4236009"},
                              {id:"73", text:"hanging_ball_ornaments_4236013"},
                              {id:"61", text:"hanging_stars_4236001"},
                              {id:"71", text:"light_string_4236011"},
                              {id:"76", text:"mittens_4236017"},
                              {id:"70", text:"red_ball_4236010"},
                              {id:"67", text:"red_present_4236007"},
                              {id:"64", text:"red_ribbon_4236004"},
                              {id:"66", text:"retro_squares_4236006"},
                              {id:"78", text:"shooting_stars_4236040"},
                              {id:"72", text:"single_snowflake_4236012"},
                              {id:"62", text:"snow_cascading_4236002"},
                              {id:"77", text:"stripes_gray_cross_4236042"},
                              {id:"65", text:"three_holiday_cocktail_glasses_4236005"},
                              {id:"68", text:"three_red_balls_4236008"},
                              {id:"75", text:"two_pine_cones_4236016"},
                              {id:"79", text:"winter_wonderland_trees_4236015"},];

function setCities(chooser) {
	var quant = chooser.options[chooser.selectedIndex].id;
if (quant == "hersheys_kisses"){

document.chocolateform.Quantity.value = 250;

}
if (quant == "hersheys_miniatures"){

document.chocolateform.Quantity.value = 100;

}
if (quant == "reg_chocolate_bar"){

document.chocolateform.Quantity.value = 30;

}
if (quant == "5oz_chocolate_bar"){

document.chocolateform.Quantity.value = 24;

}

    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var AttributeValueChooser = document.getElementById('design');
    while (AttributeValueChooser.options.length) {
        AttributeValueChooser.remove(0);
    }
    var choice = chooser.options[chooser.selectedIndex].id;
    var db = Designdb[choice];
    newElem = document.createElement("option");
    newElem.text = "choose a design";
    newElem.id = "0";
    newElem.value = 0;
    AttributeValueChooser.add(newElem, where);
    if (choice != "") {
        for (var i = 0; i < db.length; i++) {
            newElem = document.createElement("option");
            newElem.text = db[i].text;
            newElem.id = db[i].id;
            AttributeValueChooser.add(newElem, where);
        }
    }
}

/**********
  DOM LEVEL 0 ALTERNATE
 **********
function setCities(chooser) {
    var AttributeValueChooser = chooser.form.elements["AttributeValue"];
    // empty previous settings
    AttributeValueChooser.options.length = 0;
    // get chosen id to act as index to Designdb hash table
    var choice = chooser.options[chooser.selectedIndex].id;
    var db = Designdb[choice];
    // insert default first item
    AttributeValueChooser.options[0] = new Option("Choose a AttributeValue:", "", true, false);
    if (choice != "") {
        // loop through array of the hash table entry, and populate options
        for (var i = 0; i < db.length; i++) {
            AttributeValueChooser.options[i + 1] = new Option(db[i].text, db[i].id);
        }
    }
}
**********/

