-- FirstStage generated output file
require( "scripts/style.lua" );

SetDefaultStyle( DefaultStyle );

DebugOut( "target name there : "..gDialogTable.target);

local ok="ok" ;	
local okname="OK";
local name="okbox";
	
if (gDialogTable.oklabel) then
	ok = gDialogTable.oklabel ;
end

if (gDialogTable.name) then
	name = gDialogTable.name;
end

if (gDialogTable.okname) then
	okname = gDialogTable.okname;
end

local okcommand = gDialogTable.okcommand;

-- have to do this because the command is interpreted only when we click on the button, so the gDialogTable is deleted
local target = gDialogTable.target;

d = MediumDialog

MakeDialog
{
	Bitmap
	{
			image = "backgrounds/background_dialbox",
			x = kCenter,
			y = kCenter,

      Dialog
      {
        x = 0,
        y = 0,
        w = kMax,
        h = kMax,
  			SetStyle( OptionsValidationButtonStyle ),
			Button
			{
  				flags = 5,
  				label= "target",
  				name = "targetname",
  				x = kCenter-100,
  				y = kMax-90,
  				command= 
            function()
              ViewObject( target, true );
            end  
			},
  			Button
  			{
  				close = true,
  				flags = 5,
  				label=ok,
  				name = okname,
  				x = kCenter+100,
  				y = kMax-90,
  				command=okcommand
  			},
			Bitmap
			{
				name = okimage,
				image = gDialogTable.image,
				x = 50,
				y = 50,
			},
  			SetStyle( DialogTitleText ),
  			Text{ label=gDialogTable.title },
  			SetStyle( DialogBodyText ),
  			Text
        {
          label=gDialogTable.body,
          x = 200,
          y = 50,
          w = 300,
          h = 135,			
        },
      },
	},
}

gDialogTable = {}
