var msgvalue=0;
ExportObj(msgvalue,"g_msgvalue");

function ShowMsg(title,message,buttonmode,button1text,button2text)
{
	MsgWin.infoimg.SetImage("skin\\info.png");
	_PriShow(title,message,buttonmode,button1text,button2text);
	return 1;
}
function ShowMsg_Error(title,message,buttonmode,button1text,button2text)
{
	MsgWin.infoimg.SetImage("skin\\error.png");
	_PriShow(title,message,buttonmode,button1text,button2text);
	return 1;
}
function ShowMsg_Alert(title,message,buttonmode,button1text,button2text)
{
	MsgWin.infoimg.SetImage("skin\\alert.png");
	_PriShow(title,message,buttonmode,button1text,button2text);
	return 1;
}

function button1click()
{
	g_msgvalue = 1;
	MsgWin.Close();
}
function button2click()
{
	g_msgvalue = 2;
	MsgWin.Close();
}
function _PriShow(title,message,buttonmode,button1text,button2text)
{
	if(buttonmode == 0)
	{
		MsgWin.button1.SetVisible(false);
		MsgWin.button2.SetVisible(false);
	}
	else if(buttonmode == 1)
	{
		MsgWin.button1.SetVisible(true);
		MsgWin.button2.SetVisible(false);
	}
	else if(buttonmode == 2)
	{
		MsgWin.button1.SetVisible(true);
		MsgWin.button2.SetVisible(true);
	}
	
	MsgWin.title.SetText(title);
	MsgWin.message.SetText(message);
	
	//Msg(button1text);
	if(typeof(button1text) == "undefined")
	  button1text = "_confirm";
	if(typeof(button2text) == "undefined")
	  button2text = "_cancel";
	MsgWin.button1.SetText(button1text);
	MsgWin.button1.SetTipText(button1text);
	MsgWin.button2.SetText(button2text);
	MsgWin.button2.SetTipText(button2text);
	MsgWin.ShowModal();
	return 1;
}
function CloseMsgWin(args)
{
	button2click();
}
