//this takes a value from a query string
var qsParm = new Array();
function qs() {
  var query = window.location.search.substring(1);
  var parms = query.split('&');
  for (var i=0; i<parms.length; i++) {
    var pos = parms[i].indexOf('=');
    if (pos > 0) {
      var key = parms[i].substring(0,pos);
      var val = parms[i].substring(pos+1);
      qsParm[key] = val;
    }
  }
} 

//this compares the value in the query string to the options in the select menus
function updateCart() {
var menus = [ 'lush', 'fresh', 'playful', 'diva', 'eclectic', 'chocolates', 'femme', 'joy', 'floralart', 'plants' ]
for (var j=0; j<menus.length; j++) {
  var stringValue = qsParm["option"];
  for (var i=0; i<(document.getElementById(menus[j])).length; i++) {
    if (document.getElementById(menus[j])[i].id == stringValue) {
      document.getElementById(menus[j])[i].selected = true;
    }
  }
}
}

function init() {
  qs(); 
  updateCart();
}