#include "std.mi"

Function Fn_StartAnim(AnimatedLayer l, int start, int end, int speed);
Function Fn_ReSizeGroup(Group g, int TargetX, int TargetY, Float Speed, int TargetA);


Global Group		grpMain;
Global Group		grpFukidasi;
Global Group		grpChara;
Global Group		grpCompoButton;
Global Group		grpRepeatButton;
Global Group		grpPlayButton;
Global Group		grpSongWindow;
Global Group		grpVolume;
Global Group		grpAlbumA;
Global AnimatedLayer	aniFukidasi;
Global Button		btnPrev;
Global Button		btnPlay;
Global Button		btnPause;
Global Button		btnStop;
Global Button		btnNext;
Global Button		btnDPBtn;
Global Button		btnPL;
Global Button		btnML;
Global Button		btnVideo;
Global Button		btnDCBtn;
Global Button		btnChgBtn;
Global Button		btnMini;
Global Button		btnClose;
Global Button		btnDCBtn2;
Global Button		btnChgBtn2;
Global Button		btnVolup;
Global Button		btnVolDown;
Global Button		btnDAABtn;
Global Button		btnChgChr;
Global ToggleButton	tglShuffle;
Global ToggleButton	tglRepeat;
Global ToggleButton	tglAlbumA;
Global ToggleButton	tglVu;
//Global Layer		lyrSeek;
Global Layer		lyrDinfo;
Global Int		intState;
Global Float		flotState;
Global Int		intPosiY;
Global Slider           sldSeek;

System.onScriptLoaded(){

	grpMain 	= getScriptGroup();
	grpChara	= grpMain.getObject("aisha.Group");
	grpPlayButton	= grpMain.getObject("PlayButton.Group");
	grpCompoButton	= grpMain.getObject("CompoButton.Group");
	grpRepeatButton	= grpMain.getObject("RepeatButton.Group");
	grpSongWindow	= grpMain.getObject("SongWindow.Group");
	grpFukidasi	= grpMain.getObject("Fukidasi.Group");
	grpAlbumA	= grpMain.getObject("AlbumArt.Group");
	aniFukidasi	= grpFukidasi.getObject("Fukidasi");
	btnPrev		= grpSongWindow.getObject("Previous");
	btnPlay		= grpPlayButton.getObject("Play");
	btnPause	= grpPlayButton.getObject("Pause");
	btnStop		= grpPlayButton.getObject("Stop");
	btnNext		= grpSongWindow.getObject("Next");
	btnDPBtn	= grpPlayButton.getObject("DrugPlayBtn");
	btnPL		= grpCompoButton.getObject("pl");
	btnML		= grpCompoButton.getObject("ml");
	btnVideo	= grpCompoButton.getObject("Video");
	btnDCBtn	= grpCompoButton.getObject("DrugCompoBtn");
	btnChgBtn	= grpCompoButton.getObject("ChangeButton");
	btnMini		= grpSongWindow.getObject("Minimize");
	btnClose	= grpSongWindow.getObject("Close");
	grpVolume	= grpRepeatButton.getObject("Volume.Group");
	btnVolup	= grpVolume.getObject("VolumeUP");
	btnVolDown	= grpVolume.getObject("VolumeDown");
	tglRepeat	= grpRepeatButton.getObject("Repeat");
	tglShuffle	= grpRepeatButton.getObject("Shuffle");
	btnDCBtn2	= grpRepeatButton.getObject("DrugCompoBtn2");
	btnChgBtn2	= grpRepeatButton.getObject("ChangeButton2");
	sldSeek		= grpSongWindow.getObject("Seeker");
	lyrDinfo	= grpSongWindow.getObject("DrugSongInfo");
	btnDAABtn	= grpAlbumA.getObject("DrugAlbumABtn");
	tglAlbumA	= grpRepeatButton.getObject("BtnAlubumArt");
	tglVu		= grpRepeatButton.getObject("BtnVuMeter");
	btnChgChr	= grpAlbumA.getObject("BtnChange_Chara");

	flotState = 0.3;
	intPosiY = -4;
}
/*
grpChara.onTargetReached(){

	if(intState == 1) Fn_ReSizeGroup(grpChara, 0, 0, 0, 255);
	intState = 0;
}
*/
/*
btnResetPosi.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 16, 16, 0);
	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
	intState = 1;
}
*/
/*
btnResetPosi.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
	intState = 0;
}
*/
btnPlay.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 1, 1, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnPlay.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnPause.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 2, 2, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnPause.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnStop.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 3, 3, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnStop.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnDPBtn.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 6, 6, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnDPBtn.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnPL.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 10, 10, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnPL.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnML.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 9, 9, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnML.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnVideo.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 8, 8, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnVideo.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnDCBtn.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 6, 6, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnDCBtn.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnChgBtn.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 7, 7, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnChgBtn.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
tglRepeat.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 11, 11, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
tglRepeat.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
tglShuffle.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 12, 12, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
tglShuffle.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnVolup.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 13, 13, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnVolup.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnVolDown.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 14, 14, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnVolDown.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnDCBtn2.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 6, 6, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnDCBtn2.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnChgBtn2.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 7, 7, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnChgBtn2.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
sldSeek.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 15, 15, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
sldSeek.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
lyrDinfo.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 6, 6, 0);
//	Fn_ReSizeGroup(grpChara, 0, 0, 0, 255);
//	intState = 0;
}
lyrDinfo.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnPrev.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 4, 4, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnPrev.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnNext.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 5, 5, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnNext.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
btnDAABtn.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 6, 6, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
btnDAABtn.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
tglAlbumA.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 19, 19, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
tglAlbumA.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}
tglVu.onEnterArea(){

	Fn_StartAnim(aniFukidasi, 20, 20, 0);
//	Fn_ReSizeGroup(grpChara, 0, intPosiY, flotState, 255);
//	intState = 1;
}
tglVu.onLeaveArea(){

	Fn_StartAnim(aniFukidasi, 0, 0, 0);
//	intState = 0;
}


Fn_StartAnim(AnimatedLayer l, int start, int end, int speed){

	l.stop();
	l.setStartFrame(start);
	l.setEndFrame(end);
	l.setSpeed(speed);
	l.play();
}

Fn_ReSizeGroup(Group g, int TargetX, int TargetY, Float Speed, int TargetA){

        g.setTargetX(TargetX);
        g.setTargetY(TargetY);
        g.setTargetSpeed(Speed);
        g.setTargetA(TargetA);
        g.gotoTarget();
}