#include "std.mi"

Global Group		grpMain;
Global Group		grpSongInfo;
Global Text		txtTime;
Global ToggleButton	tglShuffle;
Global ToggleButton	tglRepeat;
Global Int		intShuffleState;
Global Int		intRepeatState;

System.onScriptLoaded() {

	grpMain 	= getScriptGroup();
	grpSongInfo 	= grpMain.findObject("SingInfo.Group");
	txtTime		= grpSongInfo.findObject("songname");
	tglShuffle	= grpSongInfo.findObject("Shuffle");
	tglRepeat	= grpSongInfo.findObject("Repeat");
/*
	intShuffleState = stringtointeger(tglShuffle.getXmlParam("cfgval"));
	if (intShuffleState == 0) txtTime.setAlternateText("Shuffle: ON");
	else if (intShuffleState == 1) txtTime.setAlternateText("Shuffle: OFF");

	intRepeatState = stringtointeger(tglRepeat.getXmlParam("cfgval"));
	if (intRepeatState == 0)  txtTime.setAlternateText("Repeat: OFF");
	else if (intRepeatState == 1)  txtTime.setAlternateText("Repeat: ALL");
	else if (intRepeatState == -1) txtTime.setAlternateText("Repeat: TRACK");
*/
}

tglShuffle.onToggle(boolean on) {

    if (on) {
        txtTime.setAlternateText(" Random: ON");
    }
    else{
	txtTime.setAlternateText(" Random: OFF");
    }
}

tglRepeat.onToggle(boolean on) {
    
    intRepeatState = stringtointeger(tglRepeat.getXmlParam("cfgval"));

    if (intRepeatState == 0){
       txtTime.setAlternateText(" Repeat: OFF");
    }
    else if (intRepeatState == 1){
	txtTime.setAlternateText(" Repeat: ALL");
    }
    else if (intRepeatState == -1){
	txtTime.setAlternateText(" Repeat: TRACK");
    }
}