//==================================================================
// WP7 Panorama featured2
// Timur Prokopiev 2011
//==================================================================

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

// Text2
  values.push({ name:"Text2", type:"text", value:"SUB TITLE" });
  
// Theme
  values.push({ name:"Theme", type:"ComboBox", value:"Dark,Dark,Light" });

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

// Title Color
  values.push({ name:"Color", type:"color", value:"#0000FF" });

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

}

function applyCurrentValues() {
  var values = Widget.elem.customData["currentValues"];
  var theme  = values[2].value.split(",")[0].toString();
  var enabled = (values[3].value.toString()=="false");
  var color  = values[4].value.split(",")[0].toString();


  		Widget.GetObjectByName("text1").textChars = values[0].value;
  		Widget.GetObjectByName("text2").textChars = values[1].value;


		if (values[3].value.toString() == "true") {
		Widget.GetObjectByName("text1").pathAttributes.fillColor = values[4].value;
		Widget.GetObjectByName("text2").pathAttributes.fillColor = values[4].value;

	} else {
		if (theme == "Dark") {
		Widget.GetObjectByName("text1").pathAttributes.fillColor = "#FFFFFF";
		Widget.GetObjectByName("text2").pathAttributes.fillColor = "#FFFFFF";
		}
	
		if (theme == "Light") {
		Widget.GetObjectByName("text1").pathAttributes.fillColor = "#000000";
		Widget.GetObjectByName("text2").pathAttributes.fillColor = "#000000";
		}
	}
 		
}

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