#include "../../../lib/std.mi"

Global button pltogmain, pltogshade, maintogpl, shadetogpl, plcloseall;
Global Layout mainshade, mainnorm, plist;
Global Container pl;

System.onScriptLoaded() 
{ 
 {
     Group plgroup = getContainer("Pledit").getLayout("plnormal").getObject("Pl.component.group");
     mainshade = getContainer("Main").getLayout("shade");
	 mainnorm = getContainer("Main").getLayout("normal");
	 pltogshade = mainshade.getObject("plmode");
	 pltogmain = mainnorm.getObject("Pl");
	 plist = getContainer("Pledit").getLayout("plnormal");
     Group pltitle = getContainer("Pledit").getLayout("plnormal").getObject("pl.component.title");
	 maintogpl = pltitle.getObject("main-norm-mode");
	 shadetogpl = pltitle.getObject("main-shade-mode");
	 plcloseall = pltitle.getObject("Close");
 }
}

// Close main window and open playlist
pltogmain.onLeftClick() {
  mainnorm.hide();
  plist.show();
}

// Close shade and opens playlist
//pltogshade.onLeftClick() {
//  mainshade.hide();
//  plist.show();
//}

// Close playlist and shows main window
maintogpl.onLeftClick() {
  plist.hide();
  mainnorm.show();
}

// Close playlist and shows shade mode
shadetogpl.onLeftClick() {
  plist.hide();
  mainshade.show();
}

// This doesn't work, trying to exit winamp from the plist mode
plcloseall.onLeftClick() {
  //System.quit();
}
