//==================================================================
// WP7 Keyboard
// Timur Prokopiev 2011
//==================================================================


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

// Keyboard Type
  values.push({ name:"Type", type:"ComboBox", value:"Symbols,Symbols,Numbers"});

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

// Suggestions Text
  values.push({ name:"Text", type:"text", value:"  satisfied      satiated      satiated" });

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

}

function applyCurrentValues() {
  var values = Widget.elem.customData["currentValues"];
  var theme  = values[0].value.split(",")[0].toString();
  var type  = values[1].value.split(",")[0].toString();
  var suggestions = (values[2].value.toString()=="false");
  var light = "#000000";
  var dark = "#FFFFFF";

  		Widget.GetObjectByName("suggestions_text").textChars = values[3].value;
 		Widget.GetObjectByName("suggestions_text").visible = (!suggestions);	
		Widget.GetObjectByName("suggestions_bg").visible = (!suggestions);	
	
		if (theme == "Dark") {
		Widget.GetObjectByName("keyboard_bg").pathAttributes.fillColor = "#1F1F1F";
		Widget.GetObjectByName("suggestions_bg").pathAttributes.fillColor = "#1F1F1F";
		Widget.GetObjectByName("symbols_bg").pathAttributes.fillColor = "#383838";
		Widget.GetObjectByName("numbers_bg").pathAttributes.fillColor = "#383838";
		Widget.GetObjectByName("suggestions_text").pathAttributes.fillColor = "#FFFFFF";

		// System Keyboard
		Widget.GetObjectByName(".").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("enter").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("shift").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("backspace").pathAttributes.fillColor = dark;
		Widget.GetObjectByName(",").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("&123").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("space").pathAttributes.fillColor = dark;

		// Symbols Keyboard
		Widget.GetObjectByName("m").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("n").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("b").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("v").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("c").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("x").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("z").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("l").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("k").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("j").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("h").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("g").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("f").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("d").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("s").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("a").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("p").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("o").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("i").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("u").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("y").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("t").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("r").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("e").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("w").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("q").pathAttributes.fillColor = dark;

		// Numbers Keyboard
		Widget.GetObjectByName("backslash").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("bullet").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("minus").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("back bracket").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("bracket").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("and").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("rate").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("dollar").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("grid").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("dog").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("slash").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("question").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("quotes").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("apostrophe").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("colon").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("semicolon").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("exclamation").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("0").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("9").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("8").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("7").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("6").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("5").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("4").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("3").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("2").pathAttributes.fillColor = dark;
		Widget.GetObjectByName("1").pathAttributes.fillColor = dark;

		}
	
		if (theme == "Light") {
		Widget.GetObjectByName("keyboard_bg").pathAttributes.fillColor = "#DEDEDE";
		Widget.GetObjectByName("suggestions_bg").pathAttributes.fillColor = "#DEDEDE";
		Widget.GetObjectByName("symbols_bg").pathAttributes.fillColor = "#FFFFFF";
		Widget.GetObjectByName("numbers_bg").pathAttributes.fillColor = "#FFFFFF";
		Widget.GetObjectByName("suggestions_text").pathAttributes.fillColor = "#000000";

		// System Keyboard
		Widget.GetObjectByName(".").pathAttributes.fillColor = light;
		Widget.GetObjectByName("enter").pathAttributes.fillColor = light;
		Widget.GetObjectByName("shift").pathAttributes.fillColor = light;
		Widget.GetObjectByName("backspace").pathAttributes.fillColor = light;
		Widget.GetObjectByName(",").pathAttributes.fillColor = light;
		Widget.GetObjectByName("&123").pathAttributes.fillColor = light;
		Widget.GetObjectByName("space").pathAttributes.fillColor = light;

		// Symbols Keyboard
		Widget.GetObjectByName("m").pathAttributes.fillColor = light;
		Widget.GetObjectByName("n").pathAttributes.fillColor = light;
		Widget.GetObjectByName("b").pathAttributes.fillColor = light;
		Widget.GetObjectByName("v").pathAttributes.fillColor = light;
		Widget.GetObjectByName("c").pathAttributes.fillColor = light;
		Widget.GetObjectByName("x").pathAttributes.fillColor = light;
		Widget.GetObjectByName("z").pathAttributes.fillColor = light;
		Widget.GetObjectByName("l").pathAttributes.fillColor = light;
		Widget.GetObjectByName("k").pathAttributes.fillColor = light;
		Widget.GetObjectByName("j").pathAttributes.fillColor = light;
		Widget.GetObjectByName("h").pathAttributes.fillColor = light;
		Widget.GetObjectByName("g").pathAttributes.fillColor = light;
		Widget.GetObjectByName("f").pathAttributes.fillColor = light;
		Widget.GetObjectByName("d").pathAttributes.fillColor = light;
		Widget.GetObjectByName("s").pathAttributes.fillColor = light;
		Widget.GetObjectByName("a").pathAttributes.fillColor = light;
		Widget.GetObjectByName("p").pathAttributes.fillColor = light;
		Widget.GetObjectByName("o").pathAttributes.fillColor = light;
		Widget.GetObjectByName("i").pathAttributes.fillColor = light;
		Widget.GetObjectByName("u").pathAttributes.fillColor = light;
		Widget.GetObjectByName("y").pathAttributes.fillColor = light;
		Widget.GetObjectByName("t").pathAttributes.fillColor = light;
		Widget.GetObjectByName("r").pathAttributes.fillColor = light;
		Widget.GetObjectByName("e").pathAttributes.fillColor = light;
		Widget.GetObjectByName("w").pathAttributes.fillColor = light;
		Widget.GetObjectByName("q").pathAttributes.fillColor = light;

		// Numbers Keyboard
		Widget.GetObjectByName("backslash").pathAttributes.fillColor = light;
		Widget.GetObjectByName("bullet").pathAttributes.fillColor = light;
		Widget.GetObjectByName("minus").pathAttributes.fillColor = light;
		Widget.GetObjectByName("back bracket").pathAttributes.fillColor = light;
		Widget.GetObjectByName("bracket").pathAttributes.fillColor = light;
		Widget.GetObjectByName("and").pathAttributes.fillColor = light;
		Widget.GetObjectByName("rate").pathAttributes.fillColor = light;
		Widget.GetObjectByName("dollar").pathAttributes.fillColor = light;
		Widget.GetObjectByName("grid").pathAttributes.fillColor = light;
		Widget.GetObjectByName("dog").pathAttributes.fillColor = light;
		Widget.GetObjectByName("slash").pathAttributes.fillColor = light;
		Widget.GetObjectByName("question").pathAttributes.fillColor = light;
		Widget.GetObjectByName("quotes").pathAttributes.fillColor = light;
		Widget.GetObjectByName("apostrophe").pathAttributes.fillColor = light;
		Widget.GetObjectByName("colon").pathAttributes.fillColor = light;
		Widget.GetObjectByName("semicolon").pathAttributes.fillColor = light;
		Widget.GetObjectByName("exclamation").pathAttributes.fillColor = light;
		Widget.GetObjectByName("0").pathAttributes.fillColor = light;
		Widget.GetObjectByName("9").pathAttributes.fillColor = light;
		Widget.GetObjectByName("8").pathAttributes.fillColor = light;
		Widget.GetObjectByName("7").pathAttributes.fillColor = light;
		Widget.GetObjectByName("6").pathAttributes.fillColor = light;
		Widget.GetObjectByName("5").pathAttributes.fillColor = light;
		Widget.GetObjectByName("4").pathAttributes.fillColor = light;
		Widget.GetObjectByName("3").pathAttributes.fillColor = light;
		Widget.GetObjectByName("2").pathAttributes.fillColor = light;
		Widget.GetObjectByName("1").pathAttributes.fillColor = light;

		}

		if (type == "Symbols") {
		Widget.GetObjectByName("symbols_bg").visible = true;

		// System Keyboard
		Widget.GetObjectByName(".").visible = true;
		Widget.GetObjectByName("enter").visible = true;
		Widget.GetObjectByName("shift").visible = true;
		Widget.GetObjectByName("backspace").visible = true;
		Widget.GetObjectByName(",").visible = true;
		Widget.GetObjectByName("&123").visible = true;
		Widget.GetObjectByName("space").visible = true;

		// Symbols Keyboard
		Widget.GetObjectByName("m").visible = true;
		Widget.GetObjectByName("n").visible = true;
		Widget.GetObjectByName("b").visible = true;
		Widget.GetObjectByName("v").visible = true;
		Widget.GetObjectByName("c").visible = true;
		Widget.GetObjectByName("x").visible = true;
		Widget.GetObjectByName("z").visible = true;
		Widget.GetObjectByName("l").visible = true;
		Widget.GetObjectByName("k").visible = true;
		Widget.GetObjectByName("j").visible = true;
		Widget.GetObjectByName("h").visible = true;
		Widget.GetObjectByName("g").visible = true;
		Widget.GetObjectByName("f").visible = true;
		Widget.GetObjectByName("d").visible = true;
		Widget.GetObjectByName("s").visible = true;
		Widget.GetObjectByName("a").visible = true;
		Widget.GetObjectByName("p").visible = true;
		Widget.GetObjectByName("o").visible = true;
		Widget.GetObjectByName("i").visible = true;
		Widget.GetObjectByName("u").visible = true;
		Widget.GetObjectByName("y").visible = true;
		Widget.GetObjectByName("t").visible = true;
		Widget.GetObjectByName("r").visible = true;
		Widget.GetObjectByName("e").visible = true;
		Widget.GetObjectByName("w").visible = true;
		Widget.GetObjectByName("q").visible = true;

		}
	
		if (type == "Numbers") {
		Widget.GetObjectByName("numbers_bg").visible = true;

		// System Keyboard
		Widget.GetObjectByName(".").visible = true;
		Widget.GetObjectByName("enter").visible = true;
		Widget.GetObjectByName("shift").visible = true;
		Widget.GetObjectByName("backspace").visible = true;
		Widget.GetObjectByName(",").visible = true;
		Widget.GetObjectByName("&123").visible = true;
		Widget.GetObjectByName("space").visible = true;

		// Numbers Keyboard
		Widget.GetObjectByName("backslash").visible = true;
		Widget.GetObjectByName("bullet").visible = true;
		Widget.GetObjectByName("minus").visible = true;
		Widget.GetObjectByName("back bracket").visible = true;
		Widget.GetObjectByName("bracket").visible = true;
		Widget.GetObjectByName("and").visible = true;
		Widget.GetObjectByName("rate").visible = true;
		Widget.GetObjectByName("dollar").visible = true;
		Widget.GetObjectByName("grid").visible = true;
		Widget.GetObjectByName("dog").visible = true;
		Widget.GetObjectByName("slash").visible = true;
		Widget.GetObjectByName("question").visible = true;
		Widget.GetObjectByName("quotes").visible = true;
		Widget.GetObjectByName("apostrophe").visible = true;
		Widget.GetObjectByName("colon").visible = true;
		Widget.GetObjectByName("semicolon").visible = true;
		Widget.GetObjectByName("exclamation").visible = true;
		Widget.GetObjectByName("0").visible = true;
		Widget.GetObjectByName("9").visible = true;
		Widget.GetObjectByName("8").visible = true;
		Widget.GetObjectByName("7").visible = true;
		Widget.GetObjectByName("6").visible = true;
		Widget.GetObjectByName("5").visible = true;
		Widget.GetObjectByName("4").visible = true;
		Widget.GetObjectByName("3").visible = true;
		Widget.GetObjectByName("2").visible = true;
		Widget.GetObjectByName("1").visible = true;

		}

}

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