<!-- hide from old browsers

/* prefill assumes the following:
   1 form is named "quantities"
   2 layer to reveal(if any) is named layer1
   3 cookie cinfo in format of "fn:eric|ln:jones"
   4 names in form are same as given in cinfo
*/
function prefill() {
  var form = document.quantities;
  if(!form) {
    return;
  }
  var cinfo = Get_Cookie('cinfo');
  // var country = "";
  if(cinfo == "") {
    return;
  }
  // document.write('https://www.urbannutritioninc.com/scripts/preorder.php?w=');
  showLayer('layer1');
  // alert(cinfo);
  var cinfo_array = cinfo.split("|");

  var temp_array; //  = New Array;
  var temp_var = "";
  // var name = "";
  var value = "";
  var elem;
  for(i=0;i<cinfo_array.length;i++) {
    temp_var = cinfo_array[i];
    // alert(temp_var);
    temp_array = temp_var.split(":");
    if(temp_array[0] != "") {
      // if(temp_array[0] == "ctry") {
      //        country = temp_array[1];
      // }
      elem = eval("form." + temp_array[0]);
      if(elem) {
        value = temp_array[1];
        // value.replace("+"," ");
        elem.value = value.replace(/\+/g," ");
      }
    }
  }
}

function showLayer(name) {
  layer = document.getElementById(name);
  if(layer) {
    layer.style.display='block';
  } else {
    // alert('layer ' + name + 'does not exist');
  }
}

function Get_Cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if the cookie exists
      offset += search.length
      end = document.cookie.indexOf(";", offset); // set the index of beginning value
      if (end == -1) // set the index of the end of cookie value
        end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
    }
  }
  return returnvalue;
}

//-->
