//==================================================================
// iPhone Wheel (Picker)
// Timur Prokopiev 2011
//==================================================================

function setDefaultValues() {
  var values = new Array();

// Active
  values.push({ name:"Active", type:"ComboBox", value:"Two,One,Two,Three,Four,Five"});

// Label One
  values.push({ name:"Label One", type:"text", value:"Label One"});

// Label Two
  values.push({ name:"Label Two", type:"text", value:"Label Two"});

// Label Three
  values.push({ name:"Label Three", type:"text", value:"Label Three"});

// Label Four
  values.push({ name:"Label Four", type:"text", value:"Label Four"});

// Label Five
  values.push({ name:"Label Five", type:"text", value:"Label Five"});

Widget.elem.customData["currentValues"] = values;

}

function applyCurrentValues() {
  var values = Widget.elem.customData["currentValues"];
  var active  = values[0].value.split(",")[0].toString();

  Widget.GetObjectByName("label2").pathAttributes.fillColor = "#000000";

  Widget.GetObjectByName("label1").textChars = values[1].value;
  Widget.GetObjectByName("label2").textChars = values[2].value;
  Widget.GetObjectByName("label3").textChars = values[3].value;
  Widget.GetObjectByName("label4").textChars = values[4].value;
  Widget.GetObjectByName("label5").textChars = values[5].value;

  Widget.GetObjectByName("check1").visible = (active == "One");
  Widget.GetObjectByName("check2").visible = (active == "Two");
  Widget.GetObjectByName("check3").visible = (active == "Three");
  Widget.GetObjectByName("check4").visible = (active == "Four");
  Widget.GetObjectByName("check5").visible = (active == "Five");

  if(active == "One"){Widget.GetObjectByName("label1").pathAttributes.fillColor = "#324D83";}
  if(active == "Two"){Widget.GetObjectByName("label2").pathAttributes.fillColor = "#324D83";}
  if(active == "Three"){Widget.GetObjectByName("label3").pathAttributes.fillColor = "#324D83";}
  if(active == "Four"){Widget.GetObjectByName("label4").pathAttributes.fillColor = "#324D83";}
  if(active == "Five"){Widget.GetObjectByName("label5").pathAttributes.fillColor = "#324D83";}
}

switch (Widget.opCode)
{
	case 1: setDefaultValues();   break;
	case 2: applyCurrentValues(); break;
}