/*============================================================================*/
/*                   Copyright (c) 2007 Adobe Systems Inc.                    */
/*                            All rights reserved.                            */
/*============================================================================*/

function setDefaultValues()
{
	Widget.elem.customData["flexClassName"] = "Panel";

	var currValues = new Array();

	currValues.push({ name:"Show Close",    type:"Boolean",  value:"false"           });
	currValues.push({ name:"State",         type:"ComboBox", value:"Up,Up,Over,Down" });
	currValues.push({ name:"color",         type:"Color",    value:"#0B333C"         });
	currValues.push({ name:"disabledColor", type:"Color",    value:"#AAB3B3"         });
	currValues.push({ name:"enabled",       type:"Boolean",  value:"true"            });
	currValues.push({ name:"title",         type:"Text",     value:"Title"           });

	currValues.push({ name:"MXML", type:"MXML", value:"<mx:Panel color='$2' disabledColor='$3' enabled='$4' title='$5'></mx:Panel>" });

	Widget.elem.customData["currentValues"] = currValues;
}

function applyCurrentValues()
{
	var vals    = Widget.elem.customData["currentValues"];
	var showX   = vals[0].value;
	var state   = vals[1].value.split(",")[0];
	var enabled = vals[4].value;
	var obj;

	Widget.GetObjectByName("cross").visible       = showX;
	Widget.GetObjectByName("up_fill").visible     = (showX && ((state=="Up") || (state=="Over") || (!enabled)));
	Widget.GetObjectByName("up_border").visible   = (showX && ((state=="Up") || (!enabled)));
	Widget.GetObjectByName("over_border").visible = (showX && (((state=="Over") || (state=="Down")) && enabled));
	Widget.GetObjectByName("down_fill").visible   = (showX && ((state=="Down") && enabled));

	obj = Widget.GetObjectByName("title");
	if (enabled)
	{
		switch (state)
		{
			case "Up"  :
			case "Over":
			case "Down": obj.pathAttributes.fillColor = vals[2].value; break;
		}
	}
	else
	{
		obj.pathAttributes.fillColor = vals[3].value;
	}
	obj.textChars = vals[5].value;
}

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

/*============================================================================*/
/*                   Copyright (c) 2007 Adobe Systems Inc.                    */
/*                            All rights reserved.                            */
/*============================================================================*/