function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1) 
      return element;

    elements.push(element);
  }

  return elements;
}
 

function $F(element)
{
	 return $(element).value;
}

function $I(element)
{
	 return $(element).innerHTML;
}

function js_request(par)
{
	var thisLocation;
	var tmpStr1="";
	var Arr2=new Array();
	var expKey;
	var outString;
	lct=window.location.toString();
	lct=unescape(lct);
	lct=lct.replace("[|L]","\/")
	lct=lct.replace("[|R]","\\")
	var tmpArr1=lct.split("?");
	for (i=1;i<tmpArr1.length;i++)
	{
		tmpStr1+=tmpArr1[i]+"?";
	}
	tmpStr1=tmpStr1.substr(0,tmpStr1.length-1)
	tmpStr1=tmpStr1+"&.="
	var expKey1=eval("/"+par+"\\=([^\*]+?)\\&[^&]+\\=/");
	var outTmpArray=tmpStr1.match(expKey1);
	if(outTmpArray==null)
	{
		return "";
	}
	return outTmpArray[1];
}

function Request(par)
{
	var thisLocation;
	var tmpStr1="";
	var Arr2=new Array();
	var expKey;
	var outString;
	lct=window.location.toString();
	lct=unescape(lct);
	lct=lct.replace("[|L]","\/")
	lct=lct.replace("[|R]","\\")
	var tmpArr1=lct.split("?");
	for (i=1;i<tmpArr1.length;i++)
	{
		tmpStr1+=tmpArr1[i]+"?";
	}
	tmpStr1=tmpStr1.substr(0,tmpStr1.length-1)
	tmpStr1=tmpStr1+"&.="
	var expKey1=eval("/"+par+"\\=([^\*]+?)\\&[^&]+\\=/");
	var outTmpArray=tmpStr1.match(expKey1);
	if(outTmpArray==null)
	{
		return "";
	}
	return outTmpArray[1];
}
function left(str,leng){ return str.substring(0,leng); }
function len(str){ return str.length; }

////////////////function pop message box
function DC3RIT_popMsg(url,width,height,buttontype,msg,msgtype)
{    
	var beforeSetString = window.external.GetStaticData();
	window.external.SetStaticData(msg);
	var returnFlag = 2;
	width += 30;
	height += 30;
	var tmpCont=window.external.GetStaticData();
	var isDoingThing=window.external.IsPendClose();
		if (msgtype=="erase")
		{
			window.external.SetStaticData("cancel");
			window.external.Navigate("mainui/ChangeEraseCancelDisc.htm?width=350&height=170", 350, 170);
			returnStr=window.external.GetStaticData();
			window.external.PendClose(isDoingThing);
			window.external.SetStaticData(tmpCont);
			return returnStr;
		}
	
	switch (msgtype)
	{
		case "confirm":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		case "okcancel":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		case "yesno":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		case "tryagain":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		case "FinishMount":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		default:
			window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
	}
	window.external.SetStaticData(beforeSetString);
	switch (returnFlag) {
		case 0:
			return "yes";
			break;
		case 1:
			return "no";
			break;
		case 2:
			return;
			break;
	}
}
//////////////////////////////////////
////////////////function pop message box
function DC3RIT_popMsg(url,width,height,buttontype,msg,msgtype)
{    
	var beforeSetString = window.external.GetStaticData();
	window.external.SetStaticData(msg);
	var returnFlag = 2;
	width += 30;
	height += 30;
	var tmpCont=window.external.GetStaticData();
	var isDoingThing=window.external.IsPendClose();
		if (msgtype=="erase")
		{
			window.external.SetStaticData("cancel");
			window.external.Navigate("mainui/ChangeEraseCancelDisc.htm?width=350&height=170", 350, 170);
			returnStr=window.external.GetStaticData();
			window.external.PendClose(isDoingThing);
			window.external.SetStaticData(tmpCont);
			return returnStr;
		}
	
	switch (msgtype)
	{
		case "confirm":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		case "okcancel":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		case "yesno":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		case "tryagain":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		case "FinishMount":
			returnFlag = window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
		default:
			window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			break;
	}
	window.external.SetStaticData(beforeSetString);
	switch (returnFlag) {
		case 0:
			return "yes";
			break;
		case 1:
			return "no";
			break;
		case 2:
			return;
			break;
	}
}
//////////////////////////////////////
/////////////////////
//Cut string(get short string)
//////////////////////
function getCuttedString(str,len,leftLen)
{
	if (str.length<=len)
	{
		return str;
	}
	else
	{
		rightLen=len-leftLen;
		leftStr=str.substr(0,leftLen);
		rightStr=str.substr(str.length-rightLen,rightLen)
		return (leftStr+"..."+rightStr);
	}
}
//////////////////////////////////////////////////
////////////summary function ///////////////
function SetSummaryBack(divObj) {
	var clickDivID = divObj.id;
	if ( clickDivID == "Summary_Summary" ) {
		$("Summary_Summary").style.background="url(images/summary_click_background.gif)";
		window.location="summary.htm";
	}
	else {
		$("Summary_Summary").style.background="url(images/summary_unclick_background.gif)";
	}
	if ( clickDivID == "Summary_Jobs" ) {
		$("Summary_Jobs").style.background="url(images/summary_click_background.gif)";
		window.location="Jobs.html";
	}
	else {
		$("Summary_Jobs").style.background="url(images/summary_unclick_background.gif)";
	}
	if ( clickDivID == "Summary_LogView" ) {
		$("Summary_LogView").style.background="url(images/summary_click_background.gif)";
		window.location="ViewLogs.htm";
	}
	else {
		$("Summary_LogView").style.background="url(images/summary_unclick_background.gif)";
	}
}
////////////summary function ///////////////

///////////////////set window size/////////////////
function SetWindowWidthAndHeight(wWidth,wHeight)
{
	SetDivWidhtAndHeight("windows-table",wWidth,wHeight);
	SetDivWidhtAndHeight("windows-02",wWidth-15-64,30);
	SetDivWidhtAndHeight("windows-04",15,wHeight-30-17);
	SetDivWidhtAndHeight("windows-05",wWidth-15-14,wHeight-30-17);
	SetDivWidhtAndHeight("windows-06",14,wHeight-30-17);
	SetDivWidhtAndHeight("windows-08",wWidth-15-14,17);
	var topRelativeSize=wHeight-17;
	topRelativeSize+="px";
	var leftRelativeSize=wWidth-14;
	leftRelativeSize+="px";
	var window3Left=wWidth-64;
	window3Left+="px";
	document.getElementById("windows-07").style.top = topRelativeSize;
	document.getElementById("windows-08").style.top = topRelativeSize;
	document.getElementById("windows-09").style.top = topRelativeSize;
	document.getElementById("windows-03").style.left = window3Left;
	document.getElementById("windows-06").style.left = leftRelativeSize;
	document.getElementById("windows-09").style.left = leftRelativeSize;
}
function SetDivWidhtAndHeight(divId,wWidth,wHeight)
{
	try
	{
		with(document.getElementById(divId).style)
		{
			width=wWidth+"px";
			height=wHeight+"px";
		}
	}
	catch(e)
	{
		
	}
}
function windowMoveWindow(){ window.external.OnMoveWindow(); }
/////////////////////set location 
function BackupLocation( locationValue ) {
	if ( parent.processFlag ) { return; }
	var openURL;
	switch ( parseInt(locationValue) ) {
		case 0:
			openURL = "backupDriver.htm?clearFlag=1";
			break;
		case 1:
			openURL = "FileBackupName.htm";
			break;
		case 2:
			openURL = "Startup_Disk.html";
			break;
	}
	return openURL;
}
function RestoreLocation( locationValue ) {
	if ( parent.processFlag ) { return; }
	var openURL;
	switch ( parseInt(locationValue) ) {
		case 0:
			openURL = "Restore_Driver.htm";
			break;
		case 1:
			openURL = "customrestore.htm";
			break;
		case 2:
			openURL = "Mount.htm";
			break;
	}
	return openURL;
}
function CloneLocation( locationValue ) {
	if ( parent.processFlag ) { return; }
	var openURL;
	switch ( parseInt(locationValue) ) {
		case 0:
			openURL = "Clone_Partition.html?clearFlag=1";
			break;
		case 1:
			//IframeMainUI.location = "Clone-Disk.html";
			openURL = "Clone_Disk.html?clearFlag=1";
			break;
	}
	return openURL;
}
///////////////////set location finish
///////////////set process location flag
function EnableProcessFlag() {
	window.external.PendClose(true);
	parent.processFlag = true;
	parent.Disable_LeftUI();
	return;
}
function DisableProcessFlag() {
	window.external.PendClose(false);
	parent.processFlag = false;
	parent.Enable_LeftUI();
	return;
}
///////////////set process location flag
//////////////set presskey down event////////////
var focusInTextFlag = false;
function SetAllInputTextEvent() {
	//document.attachEvent("onclick",getCloseTopMenuFunction(null));
	document.attachEvent("onkeydown", function() {return OnBodyKeyDown(event.keyCode);});
	var inputObject = document.getElementsByTagName("input");
	var i;
	for (i=0;i<inputObject.length;i++) {
		inputObject[i].onfocus = function() {
			focusInTextFlag = true;
		}
		inputObject[i].onblur = function() {
			focusInTextFlag = false;
		}
	}
	var textObject = document.getElementsByTagName("textarea");
	var j;
	for (j=0;j<textObject.length;j++) {
		textObject[j].onfocus = function() {
			focusInTextFlag = true;
		}
		textObject[j].onblur = function() {
			focusInTextFlag = false;
		}
	}
}
function OnBodyKeyDown(key)
{
	switch (key) {
		case 8:
			if ( !focusInTextFlag ) { return false; }
			break;
		case 13:
			OnEnterKeyPress();
			return key;
			break;
		default:
			return key;
	}
}
/////////////////test cdrom //////////////////
/////true can go on               false is cancel
function TestCD( dc3Object , cdRomValue )
{
	//alert(dc3Object.CDIsRoomHasDisc(cdRomValue));
	while ( dc3Object.CDIsRoomHasDisc(cdRomValue) == 0 ) {
		dc3Object.CDEjectCDRoom(cdRomValue);
		var returnValue = DC3RIT_popMsg('',264,135,'ok',GS_Back("TestCDInputBlankDisc"),'okcancel');
		//pop message , no--------- cancel   yes ------------ again
		if ( returnValue == "no") { return false; }
		else { dc3Object.CDInsertCDRoom(cdRomValue); }
	}
	// CDIsDiscIsEmpty  true ---- empty     false  ---- not empty
	if ( !dc3Object.CDIsDiscIsEmpty(cdRomValue) ) {
	//Int CDIsWritable( int doschar)
//	short CDC30OcxCtrl::CDIsDiscCanBeErase(short doschar) > 0 disc can be Erase
		if ( dc3Object.CDIsDiscCanBeErase(cdRomValue) > 0 ) {
			var beforeSetString = window.external.GetStaticData();
			window.external.Navigate("mainui/ChangeEraseCancelDisc.htm?width=350&height=170", 350, 170);
			var eraseOrChangeDisc = window.external.GetStaticData();;
			window.external.SetStaticData(beforeSetString);
			//eraseOrChangeDisc        erase         change              cancel
			switch ( eraseOrChangeDisc ) {
				case "erase":
					if (dc3Object.CDIsDiscCanBeErase(cdRomValue) <= 0 ) {
						return TestCD( dc3Object , cdRomValue );
					}
					else {
						dc3Object.CDInsertCDRoom(cdRomValue);
						var setBeforeString;
						window.external.SetStaticData("");
						FormatDisc(0,cdRomValue);
						var eraseFlag = window.external.GetStaticData();
						window.external.SetStaticData(setBeforeString);
						if (eraseFlag == "yes") { return false;}
						return true;
					}					
					break;
				case "change":
					dc3Object.CDEjectCDRoom(cdRomValue);
					return TestCD( dc3Object , cdRomValue );
					break;
				case "cancel":
					return false;
					break;
				default:
					return false;
					break;
			}
		}////////if (dc3Object.CDIsDiscCanBeErase(cdRomValue) > 0) 
		else {
			dc3Object.CDEjectCDRoom(cdRomValue);
			DC3RIT_popMsg('',264,135,'ok',GS_Back("TestCDDiscCannotWrite"),'alert');
			return TestCD( dc3Object , cdRomValue );
		}////////////if if (dc3Object.CDIsWritable(cdRomValue)==1) else
	}///////////////	if ( !dc3Object.CDIsDiscIsEmpty(cdRomValue) ) 
	else {
		if (dc3Object.CDIsWritable(cdRomValue)==1) { return true; }
		else { return TestCD( dc3Object , cdRomValue ); }
	}///////////////	if ( !dc3Object.CDIsDiscIsEmpty(cdRomValue) ) { else
}
////////////////test cd rom finish/////////////////////////////////////
////////////////cancel all progress finish////////////////////////////////////////
//2：拷贝文件出错； （msg：文件名?
//3：更新数据库出错；（msg：文件名?
//4：错误提示（msg：错误码?
//5: 烧录状态提?	Msg?10 Start PreProcess!11 End PreProcess!13 Start Close Session!14 Close Session Successful!
//					15 Start Verify data!16 End Verify data!
//6 备份状态提示：	MSG?10 Start Backup!11 Start copy files!12 End copy files!13 Start Update Database!14 End Update Database!
//					15 Start Create File List!16 End Create File List!17 Start Finish Backup!18 End Finish Backup!
//7 磁盘空间不足?Msg?路径?
//10	提示用户换一张空盘；
//11	提示用户换一张正确的盘片（msg：卷标）
//20	  提示擦除盘片或换空盘?
//30	备份结束?
//31	关机消息?
//   换空盘消息：WPARAM: EFB_MSG_CHANGE_EMPTY_DISK----
//WPARAM:10  LPARAM 盘片状?|用户需要标记的光盘卷标 | 用户需要插入的光盘卷标
//?）如果“用户需要标记的光盘卷标”为空，并且//１）如果“用户需要插入的光盘卷标”不为空，则提示用户插入一张该卷标的光盘或空盘
//                                       ２）如果“用户需要插入的光盘卷标”为空，则只提示换一张空?
//?）如果不为空，则提示向光盘上贴卷标，并且//１）如果“用户需要插入的光盘卷标”不为空，则提示用户插入一张该卷标的光盘或空盘
//                              　　　　　２）如果“用户需要插入的光盘卷标”为空，则只提示换一张空?
//换正确盘消息：WPARAM: EFB_MSG_CHANGE_RIGHT_DISK------ 
//WPARAM:11       LPARAM 当前光盘工程?| 正确的光盘卷?
//提示用户插入卷标为“正确的光盘卷标”的光盘 如果“正确的光盘卷标”为空，则提示插入一张空盘（第一次备份）
//擦除或换盘消息：WPARAM: EFB_MSG_CHANGE_ERASE_DISK---- 
//WPARAM: 20      LPARAM  光驱ID｜当前光盘工程名｜用户需要插入的光盘卷标  
//-1:无盘 0,为空?1:不为空且不能擦除 2:不为空可以擦?没有终结 3:已终结光?// 4:为不可写盘片 5:没判断对盘片类型  注意：DVD 盘片没有2这种状态，只有3，但可以烧成多节区盘!!!
//////////////////////////////function //////////////////////////////////////////////
//input value //////////////////////////////////////////////////////////////////////
//id
//msg
//EFBObject
//return value//////////////////////////////////////////////////////////////////////
// error  -1    delete projectname,
//        -2    process end
//         0    process succeed
//         1    process continue
//         2    process cancel
//         3    process continue without any memotion
////////////efb writelog
//void LogWriteLog(
//int logType , //Log类别? 为fileback , 10 ?fileback schedule 11 restore file
//int iType ,  //类别
//int iError , //错误?
//char *strPjName , //项目名称，用于显示来?
//char *describe , //log的描?
//BOOL bUnicode )// dc3所有UI都是unicode,如果传入的不是unicode置为false
//parent.Main_Object.LogWriteLogChar(9, "222333F", "222333F","strPjName", "strDesc", "path");
function EFBWriteLogBackupNow( errorID, errorDescribe, projectName,writelog,EFBObject) {
//alert(errorID+"_____"+errorDescribe);
	var errorType = 9;
	try { 
		if (scheduleWriteLogFlag == 1 ) {
			errorType = 10;
		}
		else {
			errorType = 9;
		}
	}
	catch(e) {
		errorType = 9;
	}
	var projectPath = EFBObject.GetShownProjectPath(projectName);
	//alert(errorType+"___"+errorID+"___"+errorID+"___"+projectName+errorDescribe+projectPath);
	writelog.LogWriteLogChar(errorType, errorID, errorID, projectName, errorDescribe, projectPath);
}
function EFBChangeDiscFunctionBackupNow(id, msg, EFBObject, projectName,writelog) {
	switch (parseInt(id)) {
		case 1:
		case 2:
//			DC3RIT_popMsg('',264,135,'ok',"Copy file error.<br>"+msg,'alert');
			try {
						var ermsg=null;
						var tempa = msg.split("|");
						var cpfile=tempa[0];
						var tempa1=tempa[1];
						var strlong=tempa1.length;
						var msg1 = tempa1.substring(strlong-4 , strlong );
						if(msg1=="714b"){
							ermsg=XMLRA.getString("customrestoreefb_Thepathlong");
						}
						else if(msg1=="7011"){
							ermsg=XMLRA.getString("customrestoreefb_Failedmemory");
						}
						else if(msg1=="7141"){
							ermsg=XMLRA.getString("customrestoreefb_Failedcopyfile");
						}
						$("ProgressMessage").innerHTML += ermsg + cpfile + "<br>";
			}
			catch (e) {}
//			EFBWriteLogBackupNow( 22, "Copy file error."+msg, projectName, writelog, EFBObject);
			return 3;
			break;
		case 3:
			DC3RIT_popMsg('',264,135,'ok',GS_Back("F_JS_UpError")+msg,'alert');
			EFBWriteLogBackupNow( 33, GS_Back("F_JS_UpError")+msg, projectName ,writelog, EFBObject);
			return -1;
			break;
		case 4:
			if (parseInt(msg)!=1){
				if ( msg.length == 7 ) { msg = msg.substring( 3, 7 ); }
				var toatserFlag = 0;
				try {
					if (scheduleWriteLogFlag == 1 ) { toatserFlag = 1; }
					else { toatserFlag = 0; }
				}
				catch(e) { toatserFlag = 0;}
				if ( msg == "711a" ) {
					if ( toatserFlag == 0 ) { DC3RIT_popMsg('',264,135,'ok',GetErrorMessage(msg),'alert'); }
					return -2;
				}
				if ( msg == "7135" ) {
					EFBWriteLogBackupNow( msg, GetErrorMessage(msg), projectName, writelog, EFBObject);
					return -2;
				}
				DC3RIT_popMsg('',264,135,'ok',GetErrorMessage(msg),'alert');
			}
			EFBWriteLogBackupNow( msg, GetErrorMessage(msg), projectName, writelog, EFBObject);
			return -1;
			break;
		case 6:
			return 3;
			break;
		case 10:		////////////Send message msg id:10      please insert disc
			var rst1;
			var msgArr = msg.split("|");
			for (i=1;i<msgArr.length;i++) { msgArr[i]=msgArr[i].toUpperCase(); }
			if (msgArr[0]=="0" && msgArr[2]=="")  //msgArr[0]:flow id (0:first disc ;    2:last disc)
			{
				rst1=DC3RIT_popMsg('',260,155,'ok',GS_Back("F_JS_NoDiscInput"),'okcancel');		
			}
			else if ((msgArr[0]=="0" || msgArr[0]=="1") && msgArr[2]!="") {
				rst1=DC3RIT_popMsg('',274,145,'ok',GS_Back("F_JS_InputLabelNew").replace(/\$labCDRom\$/g,msgArr[2]),'okcancel');
			}
			else if (msgArr[0]=="1" && msgArr[1]=="" && msgArr[2]=="") {
				rst1=DC3RIT_popMsg('',264,135,'ok',GS_Back("F_JS_InputNew"),'okcancel');
			}
			else if (msgArr[0]=="1" && msgArr[1]!="" && msgArr[2]=="") {
				rst1=DC3RIT_popMsg('',264,135,'ok',GS_Back("F_JS_LabelInNew").replace(/\$labCDRom\$/g,msgArr[1]),'okcancel');
			}
			else if (msgArr[0]=="2" && msgArr[1]!="")////////////   backup to Cd finished........(Need to check backup progress)
			{
				//alert(EFBObject.GetProgressCtrl());
				DC3RIT_popMsg('',264,135,'ok',GS_Back("F_JS_LabelFinish").replace(/\$labCDRom\$/g,msgArr[1]),'info');
				EFBWriteLogBackupNow( 0, GS_Back("F_JS_BFinish"), projectName, writelog, EFBObject);
				
return 0;
			}
			else if (msgArr[0]=="2" && msgArr[1]=="") {
				EFBWriteLogBackupNow( 0, GS_Back("F_JS_BFinish"), projectName, writelog, EFBObject);
				
return 0;
			}
			else if (msgArr[0]=="10") {
				rst1=DC3RIT_popMsg('',264,135,'ok',GS_Back("F_JS_NotWriteDVD"),'okcancel');
			}
			else {
				rst1=DC3RIT_popMsg('',260,135,'ok',GS_Back("F_JS_NotType"),'okcancel');
			}
			if (rst1=="yes") { return 1;}
			else if (rst1=="no") {  EFBWriteLogBackupNow( 0, GS_Back("F_JS_BCancel"), projectName, writelog, EFBObject);return 2; }
			break;
		case 11:	////////////Send message msg id:10      disc id is wrong
			var rst1;
			wrongDiscArr=msg.split("|");
			for (i=1;i<wrongDiscArr.length;i++) { wrongDiscArr[i]=wrongDiscArr[i].toUpperCase(); }
			if (wrongDiscArr[1]=="") {
				rst1=DC3RIT_popMsg('',264,145,'ok',GS_Back("F_JS_DiscNotRight"),'okcancel');
			}
			else {
				rst1=DC3RIT_popMsg('',264,135,'ok',GS_Back("F_JS_DiscNotSupport").replace(/\$labCDRom\$/g,wrongDiscArr[1]),'okcancel');
			}
			if (rst1=="yes") { return 1;}
			else if (rst1=="no") { EFBWriteLogBackupNow( 0, GS_Back("F_JS_BCancel"), projectName, writelog, EFBObject);return 2; }
			break;
		case 20:////////////Send message msg id:10      ask user wether to erase the disc
			var eraseArr=msg.split("|");
			for (i=1;i<eraseArr.length;i++) { eraseArr[i]=eraseArr[i].toUpperCase(); }
			var beforeSetString = window.external.GetStaticData();
			window.external.Navigate("mainui/ChangeEraseCancelDisc.htm?width=350&height=170", 350, 170);
			var eraseOrChangeDisc = window.external.GetStaticData();;
			window.external.SetStaticData(beforeSetString);
			//eraseOrChangeDisc        erase         change              cancel
			switch ( eraseOrChangeDisc ) {
				case "erase":
					var isE=EFBObject.IsEraser(eraseArr[0]);
					if (isE!=0) {
						window.external.Navigate("mainui/EFBEraseDiscProcess.html?dvcId="+msg,380,130);
						return 1;
					}
					return 1;
					break;
				case "change":
					return 1;
					break;
				case "cancel":
					EFBWriteLogBackupNow( 0, GS_Back("F_JS_BCancel"), projectName, writelog, EFBObject);
					return 2;
					break;
				default:
					return false;
					break;
			}			
			break;
		case 7:
			DC3RIT_popMsg('',264,135,'ok',GS_Back("F_JS_BNoEnoughtDisk")+msg,'alert');
			EFBWriteLogBackupNow( 7, GS_Back("F_JS_BNoEnoughtDisk")+msg, projectName, writelog, EFBObject);
			return -1;
			break;
		default:
			return 3;
			break;
	}
	return 3;
}
/////////////////get error message with error code///////////////////////
function GetErrorMessage(errorID) {
	var errorID = errorID.toString();
	try {
		var xmlDoc = new ActiveXObject("Microsoft.xmldom");
		xmlDoc.load("errorcode.xml");
	}
	catch(e) {
		DC3RIT_popMsg('',294,175,'ok',"Can't open xml file.",'alert');
	}
	var messageObject  = xmlDoc.selectSingleNode("errorcode/message[@id='" + errorID + "']");
	if ( messageObject == null ) { return "Transfer value error, please check your error id:"+errorID+"."; }
	else { 	return messageObject.text; }
}
/////////////////get error message with error code finish///////////////////////
////////////format disc          0 -------- quick format        1 ---------- full format
function FormatDisc( formatType, cdRomPath ) {
	window.external.Navigate("mainui/EraseDiscProcess.html?type="+formatType+"&cdRomPath="+cdRomPath, 380, 130);
}
////////////format disc          0 -------- quick format        1 ---------- full format
/////////////////hard disc has bad sector, check continue//////////////////
function SectorBadContinue(dc3Object) {
	var returnValue = DC3RIT_popMsg('',264,135,'ok',GS_Back("SectorBadContinuePrompt"),'okcancel');
	if ( returnValue == "no") { dc3Object.DC30ContinueTask(0); }
	else { dc3Object.DC30ContinueTask(1); }
}
/////////////////hard disc has bad sector, check continue finish////////////
////////////////add task return value///////////////////////////////////////
// 0 --- right       1 -- need loop         -1 ----- error/////////////////
//	Int BackupNow( char *strDesc  ?int  bFromSchedule ) ;strDesc为任务的描述，driveclone定义?name  bFromSchedule 从schedule执行任务时为?
//       Int BackupNow( char *strDesc  ?int  bFromSchedule ) ;
//       strDesc为任务的描述，driveclone定义?name      bFromSchedule 从schedule执行任务时为?
//      return -2 时说明源分区不存在了
//           -5  其它任在执行
//           -3  目标路径不存?
//           -6  网络路径不可防问
//           -7  目标路径不可?
//return 0 success

// > 0 文件存在但格式不正确
// -1 文件不存?
// -2 网络连接失败，可能输入密码在?
// -3 用户没有输入密码，直接cancel
// -4 host not exist
//long CDCGetPathCtrl::IsImgExist(LPCTSTR strPath) 
//com interface 
//=9 backupnow到网络时，出错的log接口，传入
//        <log><taskname></taskname>
//              <ifromschedule></ifromschedule> //从schedule备份时为非0
//            <errorcode><errorcode>
            //6 = Network location is not accessible.
//7 = Destination location is not writable.
//8 = 用户取消息输入密码
//          <log>
function AddTaskFunction( addValue, checkObject, showPathObject ) {
	switch ( parseInt(addValue) ) {
		case -2:
			DC3RIT_popMsg('',264,135,'ok',GS_Back("BackupNow_SouceDonnotExist"),'alert');
			return -1;
			break;
		case -5:
			DC3RIT_popMsg('',264,135,'ok',GS_Back("BackupNow_Error"),'alert');
			return -1;
			break;
		case -3:
			DC3RIT_popMsg('',264,135,'ok',GS_Back("BackupNow_BackupPathNotExist"),'alert');
			return -1;
			break;
		case -6:
			//IsUI() 返回1表示有UI，0无 UI
			try {
				var uiFlagA = window.external.IsUI();
				if (parseInt(uiFlagA) == 0) {
					return -1;
				}
			}
			catch(e)	{ return -1;}
			var pathString="";
			var xmlDoc = new ActiveXObject("Microsoft.xmldom");
			xmlDoc.loadXML(checkObject.GetTaskDetail(0,backupPar));
			pathString = xmlDoc.selectSingleNode("/detail/path").text;
			var saveLogFlag = showPathObject.IsImgExist(pathString);
			if (parseInt(saveLogFlag) ==-3 ) {
				//DC3RIT_popMsg('',264,135,'ok',GS_Back("BackupNow_SouceDonnotExist"),'alert');
				return -2;
			}
			else if (parseInt(saveLogFlag) <-1 ) {
				DC3RIT_popMsg('',264,135,'ok',GS_Back("BackupNow_SouceDonnotExist"),'alert');
				return -1;
			}
			else {
				return 1;
			}
			break;
		case -7:
			DC3RIT_popMsg('',264,135,'ok',GS_Back("BackupNow_BackupPathNotExist"),'alert');
			return -1;
			break;
		case 0:
			return 0;
			break;
		default:
			DC3RIT_popMsg('',264,135,'ok',GS_Back("BackupNow_Error"),'alert');
			return -1;
			break;
	}	
}
////////////////add task return value end///////////////////////////////////////
////////////////cancel all progress ////////////////////////////////////////
//12	ͣ Void TaskPauseTask( Bool bPause ) //0  0 pause
function CancelTaskProgress( dc3Object ) {
	dc3Object.TaskPauseTask(1);
	var temp=DC3RIT_popMsg('',264,165,'ok',GS_Back("CancelTaskProgressPrompt"),'confirm');
	if(temp=="yes") {
		dc3Object.CancelTask();
		dc3Object.TaskPauseTask(0);
		return true;
	}
	else {
		dc3Object.TaskPauseTask(0);
		return false;
	}
}
function CancelBackProgress( dc3Object ) {
	dc3Object.TaskPauseTask(1);
	var temp=DC3RIT_popMsg('',264,165,'ok',GS_Back("CancelBackProgressPrompt"),'confirm');
	if(temp=="yes") {
		dc3Object.CancelTask();
		dc3Object.TaskPauseTask(0);
		return true;
	}
	else {
		dc3Object.TaskPauseTask(0);
		return false;
	}
}
////////////////cancel all progress finish////////////////////////////////////////
//reison, 2006-11-7:  Ocx 事件
//Void DC30MessageBox( char *strMsg ,int iIcon );     iIcon 定义如下
//#define ICONOK     0         define ICONWARING 1             #define ICONERROR  2     #define ICONCANCELOK 4
//Ocx接口 消息弾出后，回调用户的选择    void UserMsgBoxReturn(long iRet)
//iRet : 0 OK 1 retry  -1 cancel
/////////////////backup progress show message/////////////////////////////////////
function DCBackupShowMessage( dc3object, msg, icon) {
	if ( parseInt(icon) == 0 ) {
		DC3RIT_popMsg('',300,200,'ok',msg,'alert');
		dc3object.UserMsgBoxReturn(0);
	}
	else {
		var returnValue = DC3RIT_popMsg('',300,200,'ok',msg,'okcancel');
		if ( returnValue == "yes") { 
			dc3object.UserMsgBoxReturn(0);
		}
		else {
			dc3object.UserMsgBoxReturn(-1);
		}
	}
}
/////////////////backup progress show message/////////////////////////////////////
///////////////cancel operation ////////////////////////////////////////////////////
//////   0 ---  backup          1 ---- restore      2 ------ clone
function CancelOperation( operateID ) {
	var showString = "";
	switch ( parseInt(operateID) ) {
		case 0:
			showString = GS_Back("CancelOperationBackupDrive");
			break;
		case 1:
			showString = GS_Back("CancelOperationRestoreDrive");
			break;
		case 2:
			showString = GS_Back("CancelOperationClone");
			break;
		default:
			DC3RIT_popMsg('',294,175,'ok',GS_Back("CancelOperationError"),'alert');
			return;
			break;
	}
	if ( DC3RIT_popMsg('',294,145,'ok',showString,'okcancel') == "yes" ) {
		document.location="summary.htm";
	}
}
///////////////cancel operation ////////////////////////////////////////////////////
/////////////////get all message with any languange/////////////////////////////
function GS_Back(StringID)
{
	StringID = StringID.toString();
	try {
		var xmlDoc = new ActiveXObject("Microsoft.xmldom");
		xmlDoc.load("xmlStrings_back.xml");
	}
	catch(e) {
		DC3RIT_popMsg('',294,175,'ok',"Can't open xml file.",'alert');
	}
	var messageObject  = xmlDoc.selectSingleNode("RESOURCES/Language[@type='English']/STRING[@ID='" + StringID + "']");
	if ( messageObject == null ) { return "Can't find string."; }
	else { return messageObject.text; }
}
/////////////////get all message with any languange finish//////////////////////
///////////////clear all code error message
function killErrors() { return true; }
window.onerror = killErrors;
////////////////clear all code error message
function xmlResourceAgent(xmlFile,lan)
{
	this.isObject=false;
	this.language="English";
	if(typeof(lan)!="undefined")
	{
		this.language=lan;
	}
	

	if (xmlFile=="")
	{
		return false;
	}
	try
	{
		this.xmlDoc = new ActiveXObject("Microsoft.xmldom");
		this.xmlDoc.load(xmlFile);
	}
	catch(e)
	{
		return false;	
	}
	
	this.setLanguage=function(lan)
	{
		this.language=lan
	}
	
	this.getString=function(id)
	{
		var messageObject  = this.xmlDoc.selectSingleNode("RESOURCES/Language[@type='"+this.language+"']/STRING[@ID='" + id + "']");
	 	if ( messageObject == null ) 
	 	{ 
	 		return ""; 
	 	}
	 	else 
	 	{
		 	return messageObject.text; 
	 	}
	}
	this.isObject=true;
}
var xmlStringAgent=function()
{
	this.attachVar=function(name,value)
	{
		eval("this."+name+"=\""+value+"\"")
	}
}
function analyseXml(str)
{
	var innerStr;
	var XSA=new xmlStringAgent();
	str=str.replace(/^\s+/,'');
	str=str.replace(/\s+$/,'');
	var arrtmp=str.match(/\<([\w\s]+)\>([^\<]+)\<\/\1\>/);
	while (arrtmp!=null)
	{
		str=str.replace(/\<([\w\s]+)\>[^\<]+\<\/\1\>/,"");
		XSA.attachVar(arrtmp[1],arrtmp[2]);
		arrtmp=str.match(/\<([\w\s]+)\>([^\<]+)\<\/\1\>/);
	}
	return XSA;
}
var XMLDOM = function(loadxml,parentNode)
{
	this.xmlDoc = new ActiveXObject("Microsoft.xmldom");
	this.xmlDoc.loadXML(loadxml);
	this.GetNode=function(nodename)
	{
		if(parentNode.length>0)
		{
			nodename=parentNode+"/"+nodename;
		}
		var rv=this.xmlDoc.selectSingleNode(nodename).text;
		return rv;
	}
	this.SetNode=function(nodename,value)
	{
		if(parentNode.length>0)
		{
			nodename=parentNode+"/"+nodename;
		}
		this.xmlDoc.selectSingleNode(nodename).text=value;
		//alert(value);
	}
	this.getXmlString=function()
	{
		return this.xmlDoc.xml;
	}
	//this.xml=this.xmlDoc.xml;
}
function ButtonPrevious() {
	history.go(-1);
}
