//==================================================================
// iPhone List (Thin)
// Timur Prokopiev 2011
//==================================================================


function setDefaultValues() {
  var values = new Array();
  
// Label
  values.push({ name:"Label", type:"text", value:"Label"});

// Enable Counter
  values.push({ name:"Counter", type:"Boolean",  value:"true" });

// Counter
  values.push({ name:"Number", type:"text", value:"12"});

// Enable Arrow
  values.push({ name:"Arrow", type:"Boolean",  value:"true" });

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

}

function applyCurrentValues() {
  var values = Widget.elem.customData["currentValues"];
  var enableCounter = (values[1].value.toString()=="false");
  var enableArrow = (values[3].value.toString()=="false");
  
  Widget.GetObjectByName("label_text").textChars = values[0].value;

  var width = Widget.GetObjectByName("label_text").rawWidth;

// Generate Spaces
  a = ['']; 
  a.length += Math.round(width/9)+1; 
  spaces = a.join(' ');

  Widget.GetObjectByName("label_count").textChars = spaces + "(" + values[2].value +")";

  Widget.GetObjectByName("arrow").visible = (!enableArrow);
  Widget.GetObjectByName("label_count").visible = (!enableCounter);


}

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