// JavaScript Document
function handleOnChange(dd1)
{
	
  enabler();
	
  var idx = dd1.selectedIndex;
  var val = dd1[idx].value;
  var par = document.forms["frmSelect"];
  var parelmts = par.elements;
  var prezsel = parelmts["flav"];
  var product = val;
  if (product != "Select Product")
  {
   var directory = ""+document.location;
   directory = directory.substr(0, directory.lastIndexOf('/'));

   Http.get({
		url: "./flavdropdown.php?p=" +  product,
		callback: fillPrez,
		cache: Http.Cache.Get
	}, [prezsel]);
  }
}

function fillPrez(xmlreply, prezelmt)
{
  if (xmlreply.status == Http.Status.OK)
  {
   var prezresponse = xmlreply.responseText;
   var prezar = prezresponse.split("|");
   prezelmt.length = 1;
   prezelmt.length = prezar.length;
   for (o=1; o < prezar.length; o++)
   {
     prezelmt[o].text = prezar[o];
   }
  }
  else
  {
   alert("Cannot handle Ajax call.");
  }
}


function enabler() {
	
	//document.getElementById("div_id").style.CSS_property_to_change = "new_CSS_value_in_quotes";

	document.forms["frmSelect"].flav.disabled = "";
	document.forms["frmSelect"].servings.disabled = "";
	document.forms["frmSelect"].flav.style.background = "#ffffff";
	document.forms["frmSelect"].servings.style.background = "#ffffff";
	document.forms["frmSelect"].product.style.color = "#ff8223";
	document.forms["frmSelect"].flav.style.color = "#88705B";
	document.forms["frmSelect"].servings.style.color = "#88705B";
	
}

function a_chosen() {
	document.forms["frmSelect"].flav.style.background = "#ffffff";
	document.forms["frmSelect"].flav.style.color = "#ff8223";
}

function b_chosen () {
	document.forms["frmSelect"].servings.style.background = "#ffffff";
	document.forms["frmSelect"].servings.style.color = "#ff8223";
	document.getElementById("add_button").style.background = "#65C1D8";
	document.getElementById("add_button").onclick = function() { document.frmSelect.submit() };
	
}
