var dcoutput_running = 0;
initburnobj();

function initburnobj(args)
{
	var hMainWnd = dcoutput.GetHandle();
	var hPhotoWnd = dcoutput.GetHandle();
//	var hPhotoWnd = dcoutput.staticphoto.GetHandle();
	g_dvdcreator.InitBurnClass(	hMainWnd, 
					hPhotoWnd);
	dcoutput_running = 0;
	
	dcoutput.staticphoto.LoadGif("copynow.gif");
}

function dcoutput_burnagain(args)
{
	dcoutput.progressdetail.SetPos(0);
	dcoutput.progresstotal.SetPos(0);
	dcoutput.buttonagain.SetEnable("false");
	dcoutput.buttoncancel.SetText("_btn_abort");
	dcoutput.buttoncancel.SetTipText("_btn_abort");
	dcoutput.statictimeuse.SetText("00:00:00");
	
	dcoutput.staticphoto.Stop();
	
	var skinstr = g_Config.GetValue("basic","skinstr","standard");
	var gifname = "skin\\" + skinstr + "\\copynow.gif";
	dcoutput.staticphoto.LoadGif(gifname);
	
	dcoutput.staticphoto.Start();
	
	g_dvdcreator.BurnAgain();
	
	return 1;
}

function dcoutput_confirm(args)
{
	if(dcoutput_running == 1)
	{
		g_dvdcreator.BurnAbort();
	}
	else
	{
		g_dvdcreator.BurnFinish();
		dcoutput_running = 0;
		dcoutput_reloadclose();
	}
	
	return 1;
}

function dcoutput_dealabort(args)
{
	dcoutput_running = 0;
	dcoutput_reloadclose();
	
	return 1;
}

function dcoutput_execresult(str)
{
	if(str == "true")
	{
		dcoutput.progressdetail.SetPos(100);
		dcoutput.progresstotal.SetPos(100);
		if(targettype == "DVD Folder" || targettype == "ISO")
		{
			dcoutput.buttonagain.SetEnable(false);
		}
		else
		{
			dcoutput.buttonagain.SetEnable(true);
		}
		dcoutput.buttoncancel.SetText("_btn_finish");
		dcoutput.buttoncancel.SetTipText("_btn_finish");
		
		var skinstr = g_Config.GetValue("basic","skinstr","standard");
		var gifname = "skin\\" + skinstr + "\\ok.gif";
		dcoutput.staticphoto.LoadGif(gifname);
		
		dcoutput.staticphoto.Start();
	}
	else
	{
//		dcoutput.statictimeuse.SetText("00:00:00");
//		dcoutput.progressdetail.SetPos(0);
//		dcoutput.progresstotal.SetPos(0);
		dcoutput.buttonagain.SetEnable("false");
		dcoutput.buttoncancel.SetText("_btn_abort");
		dcoutput.buttoncancel.SetTipText("_btn_abort");
		
		var skinstr = g_Config.GetValue("basic","skinstr","standard");
		var gifname = "skin\\" + skinstr + "\\no.gif";
		dcoutput.staticphoto.LoadGif(gifname);

		dcoutput.staticphoto.Start();
	}
	
	return 1;
}

function dcoutput_reloadclose()
{
	dcoutput.staticphoto.Stop();
	
	g_dvdcreator.FlashDevice();
	
	dcoutput.Close();	
	
	return 1;
}
