#include "std.mi"

Function fn_ReSizeGroup(Group G, int TargetX, int TargetY, int TargetW, int TargetH, Float SpeedW, Float SpeedH, int TargetA);

Global Group		grpMain;
Global Group		grpSubBtnWid;
Global Button		btnSubBtnOP;
Global Button		btnSubBtnClose;
Global int		intSubBtn;	//(0:Close 1:Open)

System.onScriptLoaded(){

	grpMain 	= getScriptGroup();
	grpSubBtnWid	= getContainer("main").getLayout("normal").getObject("SubButtonWindow.Group");
	btnSubBtnOP     = getContainer("main").getLayout("normal").getObject("SubButtonOP");
	btnSubBtnClose	= grpMain.findObject("SubButtonClose");
}

btnSubBtnOP.onLeftButtonUp(int x, int y){

	if(intSubBtn == 0){
		fn_ReSizeGroup(grpSubBtnWid, 6, 26, 165, 175, 0.8, 0.8, 255);
		intSubBtn = 1;
	}
	else if(intSubBtn == 1){
		fn_ReSizeGroup(grpSubBtnWid, 6, 26, 0, 0, 0.8, 0.8, 255);
		intSubBtn = 0;
	}
}

btnSubBtnClose.onLeftButtonUp(int x, int y){

	if(intSubBtn == 1){
		fn_ReSizeGroup(grpSubBtnWid, 6, 26, 0, 0, 0.8, 0.8, 255);
		intSubBtn = 0;
	}
}


fn_ReSizeGroup(Group G, int TargetX, int TargetY, int TargetW, int TargetH, Float SpeedW, Float SpeedH, int TargetA){

        G.setTargetX(TargetX);
        G.setTargetY(TargetY);
        G.setTargetW(TargetW);
        G.setTargetH(TargetH);
        G.setTargetSpeed(SpeedW);
        G.setTargetSpeed(SpeedH);
        G.setTargetA(TargetA);
        G.gotoTarget();
}