//==================================================================
// WP7 Slider (tick marks)
// Timur Prokopiev 2011
//==================================================================


function setDefaultValues() {
  var values = new Array();
  
// Color Theme
  values.push({ name:"Theme", type:"ComboBox", value:"Dark,Dark,Light"});

// Accent Color
  values.push({ name:"Accent Color", type:"ComboBox", value:"Orange,Magenta,Purple,Teal,Lime,Brown,Pink,Orange,Blue,Red,Green"});

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

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

}

function applyCurrentValues() {
  var values = Widget.elem.customData["currentValues"]; 
  var theme  = values[0].value.split(",")[0].toString();
  var color  = values[1].value.split(",")[0].toString();
  
  var magenta = "#FF0097";
  var purple = "#A200FF";
  var teal = "#00ABA9";
  var lime = "#8CBF26";
  var brown = "#996600";
  var pink = "#E671B8";
  var orange = "#F09609";
  var blue = "#1BA1E2";
  var red = "#E51400";
  var green = "#339933";

  Widget.GetObjectByName("label").textChars = values[2].value;


		if (theme == "Dark") {
		Widget.GetObjectByName("label").pathAttributes.fillColor = "#CBCBCB";
		Widget.GetObjectByName("bg").pathAttributes.fillColor = "#FFFFFF";
		}
	
		if (theme == "Light") {
		Widget.GetObjectByName("label").pathAttributes.fillColor = "#AAAAAA";
		Widget.GetObjectByName("bg").pathAttributes.fillColor = "#000000";
		}

		if (color == "Magenta") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = magenta;
		}

		if (color == "Purple") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = purple;
		}

		if (color == "Teal") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = teal;
		}

		if (color == "Lime") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = lime;
		}
		
		if (color == "Brown") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = brown;
		}

		if (color == "Pink") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = pink;
		}

		if (color == "Orange") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = orange;
		}

		if (color == "Blue") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = blue;
		}

		if (color == "Red") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = red;
		}


		if (color == "Green") {
		Widget.GetObjectByName("slider").pathAttributes.fillColor = green;
		}
		

}

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