#include "std.mi"

Global Group	grpMain;
Global Group	grpCombo;
Global Group	grpRepeat;
Global Group	grpVol;
Global Button	btnPL;
Global Button	btnML;
Global Button	btnVD;
Global Button	btnRep;
Global Button	btnSuf;
Global Button	btnChange;
Global Button	btnChange2;
Global ToggleButton	btnAlbumA;
Global ToggleButton	btnVuMeter;
Global Button		btnChangeChara;
Global int	intState;	// 0: PL, 1: ML, 2: VD,
Global int	intState2;	// 0: Rep, 1: Suf, 2: ,

System.onScriptLoaded(){

	grpMain 	= getScriptGroup();
	grpCombo	= grpMain.findObject("CompoButton.Group");
	grpRepeat	= grpMain.findObject("RepeatButton.Group");
	grpVol		= grpRepeat.findObject("Volume.Group");
	btnPL		= grpCombo.findObject("pl");
	btnML		= grpCombo.findObject("ml");
	btnVD		= grpCombo.findObject("Video");
	btnRep		= grpRepeat.findObject("Repeat");
	btnSuf		= grpRepeat.findObject("Shuffle");
	btnChange	= grpCombo.findObject("ChangeButton");
	btnChange2	= grpRepeat.findObject("ChangeButton2");
	btnAlbumA	= grpRepeat.findObject("BtnAlubumArt");
	btnVuMeter	= grpRepeat.findObject("BtnVuMeter");
	btnChangeChara	= grpRepeat.findObject("BtnChange_Chara");
	intState	= System.getPrivateInt("erieze", "State", 0);
	intState2	= System.getPrivateInt("erieze", "State2", 0);

	btnPL.Hide();
	btnML.Hide();
	btnVD.Hide();
	btnRep.Hide();
	btnSuf.Hide();
	grpVol.Hide();
	btnAlbumA.Hide();
	btnVuMeter.Hide();
	btnChangeChara.Hide();

	if(intState == 0) btnPL.Show();
	if(intState == 1) btnML.Show();
	if(intState == 2) btnVD.Show();

	if(intState2 == 0) btnRep.Show();
	if(intState2 == 1) btnSuf.Show();
	if(intState2 == 2) grpVol.Show();
	if(intState2 == 3) btnAlbumA.Show();
	if(intState2 == 4) btnVuMeter.Show();
	if(intState2 == 5) btnChangeChara.Show();
}

System.onScriptUnloading() {
	
	System.setPrivateInt("erieze", "State", intState);
	System.setPrivateInt("erieze", "State2", intState2);
}

btnChange.onLeftButtonUp(int x, int y){


	if(intState == 0){

		btnPL.Hide();
		btnML.Show();
		btnVD.Hide();
	}
	else if(intState == 1){

		btnPL.Hide();
		btnML.Hide();
		btnVD.Show();

	}
	else if(intState == 2){

		btnPL.Show();
		btnML.Hide();
		btnVD.Hide();

	}

	intState ++;
	if(intState >=3) intState = 0;
}

btnChange2.onLeftButtonUp(int x, int y){


	if(intState2 == 0){

		btnRep.Hide();
		btnSuf.Show();
		grpVol.Hide();
		btnAlbumA.Hide();
		btnVuMeter.Hide();
		btnChangeChara.Hide();
	}
	else if(intState2 == 1){

		btnRep.Hide();
		btnSuf.Hide();
		grpVol.Show();
		btnAlbumA.Hide();
		btnVuMeter.Hide();
		btnChangeChara.Hide();

	}
	else if(intState2 == 2){

		btnRep.Hide();
		btnSuf.Hide();
		grpVol.Hide();
		btnAlbumA.Show();
		btnVuMeter.Hide();
		btnChangeChara.Hide();

	}
	else if(intState2 == 3){

		btnRep.Hide();
		btnSuf.Hide();
		grpVol.Hide();
		btnAlbumA.Hide();
		btnVuMeter.Show();
		btnChangeChara.Hide();

	}
	else if(intState2 == 4){

		btnRep.Hide();
		btnSuf.Hide();
		grpVol.Hide();
		btnAlbumA.HIde();
		btnVuMeter.HIde();
		btnChangeChara.Show();

	}
	else if(intState2 == 5){

		btnRep.Show();
		btnSuf.Hide();
		grpVol.Hide();
		btnAlbumA.HIde();
		btnVuMeter.HIde();
		btnChangeChara.Hide();
	}

	intState2 ++;
	if(intState2 >=6) intState2 = 0;
}