//==================================================================
// WP7 Check Box
// Timur Prokopiev 2011
//==================================================================


function setDefaultValues() {
  var values = new Array();
  
// Enable Check Box
  values.push({ name:"Enable", type:"Boolean",  value:"true" });

// Check Box States
  values.push({ name:"State", type:"ComboBox", value:"Normal,Normal,Down,Disable"});


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

}

function applyCurrentValues() {
  var values = Widget.elem.customData["currentValues"];
  var enabled = (values[0].value.toString()=="false");
  var state  = values[1].value.split(",")[0].toString();

		
		Widget.GetObjectByName("flag").visible = (!enabled);	
		
		if (state == "Normal") {
		Widget.GetObjectByName("flag").pathAttributes.fillColor = "#000000";
		Widget.GetObjectByName("bg").pathAttributes.fillColor = "#BFBFBF";
		
		}
	
		else if (state == "Down") {
		Widget.GetObjectByName("flag").pathAttributes.fillColor = "#000000";
		Widget.GetObjectByName("bg").pathAttributes.fillColor = "#FFFFFF";
	
		}
	
		else if (state == "Disable") {
		
		Widget.GetObjectByName("flag").pathAttributes.fillColor = "#3D3D3D";
		Widget.GetObjectByName("bg").pathAttributes.fillColor = "#666666";

		}
		
}

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