//==================================================================
// WP7 Background
// Timur Prokopiev 2011
//==================================================================


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

// Big Title
  values.push({ name:"Big Title", type:"text", value:"big title" });

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

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

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

// Colour Theme
  values.push({ name:"Theme", type:"ComboBox", value:"Dark,Dark,Light"});


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

}

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

		
		Widget.GetObjectByName("time").visible = (!time);
		Widget.GetObjectByName("small title").visible = (!smalltitle);
		Widget.GetObjectByName("big title").visible = (!bigtitle);	
		Widget.GetObjectByName("small title").textChars = values[0].value;
		Widget.GetObjectByName("big title").textChars = values[1].value;

		if (theme == "Dark") {
		Widget.GetObjectByName("bg").pathAttributes.fillColor = "#000000";
		Widget.GetObjectByName("time").pathAttributes.fillColor = "#FFFFFF";
		Widget.GetObjectByName("small title").pathAttributes.fillColor = "#FFFFFF";
		Widget.GetObjectByName("big title").pathAttributes.fillColor = "#FFFFFF";


		}
	
		else if (theme == "Light") {
		Widget.GetObjectByName("bg").pathAttributes.fillColor = "#FFFFFF";
		Widget.GetObjectByName("time").pathAttributes.fillColor = "#000000";
		Widget.GetObjectByName("small title").pathAttributes.fillColor = "#000000";
		Widget.GetObjectByName("big title").pathAttributes.fillColor = "#000000";
		}
		
}

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