// JavaScript Document
//Add recovery disk flow to Backup-Drivers_Process.html page
//Because this flow will skip "SelectSave", "SelectParameter" and "Confirm" page, so we will define the skipped defination below
//Create by Sunny 2007.12.06


//---------------------------------
//Function List
//----------------------------------
function RecoveryDisk(dc3) {
	//--------------------------------------------
	//SelectSave Page
	//--------------------------------------------
	var newfile = String.fromCharCode(cdRomPath)+":";
	var backname = parent.JSbackupName;
	var savePathWithDate = backname;
	
	//Code From Select save page;
	var result=dc3.SetImgFileName(newfile+"\\"+savePathWithDate+"\\"+backname,"");
	if(result==1) {
		DC3RIT_popMsg('',264,135,'ok',GS_Back("Backup_Drive_Select_JS_FileInSource"),'alert');
		//cbpselectlocation.RepaintWnd();
		//return;
		error_handle_cancelProc();
	}
	else if(result==2) {
		DC3RIT_popMsg('',264,135,'ok',GS_Back("Backup_Drive_Select_JS_FileNameError"),'alert');
		//cbpselectlocation.RepaintWnd();
		//return;
		error_handle_cancelProc();
	}
	else if(result==5) {
		DC3RIT_popMsg('',264,135,'ok',GS_Back("Backup_Drive_Select_JS_FileNameExist"),'alert');
		//cbpselectlocation.RepaintWnd();
		//return;
		error_handle_cancelProc();
	}
	else if(result==6) {
		DC3RIT_popMsg('',264,155,'ok',GS_Back("Backup_Drive_Select_JS_FileTooLong"),'alert');
		//cbpselectlocation.RepaintWnd();
		//return;
		error_handle_cancelProc();
	}
	else if(result==0) {
		cdRomFlag = dc3.IsImgFileCDPath(newfile);
		if (cdRomFlag > 0) { window.external.SetStaticData(newfile);parent.JSbackupSelectSavePath = newfile;}
		else { 
			//window.external.SetStaticData(newfile+"\\"+savePathWithDate);parent.JSbackupSelectSavePath = newfile+"\\"+savePathWithDate;
			DC3RIT_popMsg('',264,135,'ok',GS_Back("Backup_Drive_Select_JS_SelectRightPalce").replace("$x_productName", FarstoneProductName),'alert');
			error_handle_cancelProc();
		}
	}
	
	//--------------------------------
	//SelectParameter Page
	//--------------------------------
	var isFullBackup = 0; //0: make a full backup
	var CompressionRate = 1; //0: no compress; 1: compress; 2: high compresssion
	var doImgCheck = 1;
	var SplitedSize = 0; //0: auto, backup to cd/dvd can not adjust this; 1: 650M; 2: 700MB; 3: 2000MB
	var ImgPassword = "";
	 
	//Code from SelectParameter page
	dc3.SetImgFilePars(isFullBackup, CompressionRate, doImgCheck, SplitedSize, ImgPassword);
}

//If there is a error in makeing RecoveryDisk Process, will lead user to statup page
function error_handle_cancelProc() {
	 parent.jumpPageTo("Startup_disk.html");
	 return;
}