var __certmanage=function(a){var X=function(n){function y(){if(!a.certsList)return null;for(var b=a.certsList,c=b.list.length,d=[],h=[],e=0;eb||0>c||!d)return-1;var g=0,r=0;u=c;a.certsList&&(a.certsList=null);k=!0;if(a.CONST.__PF_M_LS.device===b){a.PFSH||e(-1);try{a.PFSH.SelectStorage(1)}catch(x){e(-1)}try{a.PFSH.LoadAllCerts(document.domain)}catch(x){301E5===x.code&&(a.PFSH.InstallCACerts(document.domain),a.PFSH.LoadAllCerts(document.domain))}c=null;try{c=a.PFSH.GetUserCerts(document.domain),a.PFUC=c}catch(x){a.uiUtil().errMsgBox(x.message,x.code)}null!=c&&void 0!=c&&void 0!=c.length&&(g=c.length-1);if(0=d)return a.uiUtil().loadingBox(!1,"us-div-list-load"),a.uiUtil().msgBox(c.IDS_MSGBOX_CERT_RECOVER_ERROR),!1;PWDialog=a.loadUI("password")({type:null,args:null,onConfirm:function(b){PWDialog.dispose();a.nimservice().RecoverFromUSB(1,d,b,function(d,f,e){certlistDialog.dispose();0==d?w(l,1,c,"",function(d){(d=y())?m.redrawList(d.list,d.list.length):m.redrawList(null,0);k=!1;b="";a.uiUtil().loadingBox(!1,"us-div-list-load");a.uiUtil().msgBox(c.IDS_MSGBOX_CERT_RECOVER_SUCCESS)}):(a.uiUtil().loadingBox(!1,"us-div-list-load"),a.uiUtil().msgBox(c.IDS_MSGBOX_CERT_RECOVER_ERROR))})},onCancel:function(){PWDialog.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");setTimeout(function(){b.dispose()},10)}});PWDialog.show()},onCancel:function(){certlistDialog.dispose();a.uiUtil().getUserCancelErrCodeNMsg()}});certlistDialog.show();a.uiUtil().loadingBox(!1,"us-div-cert-list-load")},onCancel:function(){a.uiUtil().loadingBox(!1,"us-div-list-load");SSDialog.dispose()}}),SSDialog.show())}function ja(b,c){function d(c,b,d){a.nimservice().BackupToUSB(c,b,d,function(c,b){0===c?a.uiUtil().msgBox(e.IDS_MSGBOX_CERT_BACKUP_SUCCESS):a.uiUtil().errMsgBox(e.IDS_MSGBOX_CERT_BACKUP_ERROR,c);d="";a.uiUtil().loadingBox(!1,"us-div-list-load")})}function h(c,b,e){PWDialog=a.loadUI("password")({type:null,args:null,onConfirm:function(c){PWDialog.dispose();var f=parseInt(m.selectedIndex());a.nimservice().CheckPassword(l,u,f,c,!0,function(g,h){0==g?(SSDialog=a.loadUI("storageselect")({type:"CERT_COPY",args:{drivetype:"BACKUP_DRIVE"},onConfirm:function(a,b){SSDialog.dispose();d(f,b,c)},onCancel:function(){a.uiUtil().loadingBox(!1,"us-div-list-load");SSDialog.dispose();b.focus()}}),SSDialog.show()):(c="",a.uiUtil().msgBox(""==h?e.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD:h),a.uiUtil().loadingBox(!1,"us-div-list-load"),setTimeout(function(){b.dispose()},10))})},onCancel:function(){PWDialog.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");setTimeout(function(){b.dispose()},10)}});PWDialog.show()}var e=c,g=null;if(!a.certsList||0>=parseInt(m.selectedIndex()))return a.uiUtil().msgBox(e.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),!1;if(4&a.ESVS.Mode)if(a.nimservice())a.nimservice().GetBackupedDriveList(function(c,d,k){var f=k.length;if(0==c)if(0c||a.CONST.__USFB_M_DISK.device>e||0>h||null==b||0>=b.length?a.uiUtil().loadingBox(!1,"us-div-list-load"):e==a.CONST.__USFB_M_HSMKEY.device?a.nimservice().EnvelopData("kmcert",c,b,null,"abcdefghijklmnopqrstuvwxyz1234567890",1,function(f,r,m){4503E4==f&&a.uiUtil().msgBox(g.IDS_MSGBOX_HSM_INFO_NO_KMCERT);a.nimservice().CopyCert(c,b,e,h,k,function(e,f){if(0===e)a.uiUtil().msgBox(g.IDS_MSGBOX_CERT_COPY_SUCCESS),d&&d(0,q,a.certUtil().getTheCertAttributes(a.certsList.list[c-1].cert,"Base64"));else switch(e){case 4823E4:a.uiUtil().msgBox(g.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(g.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4013E4:a.uiUtil().msgBox(g.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_LOW_PERFORM_MEDIA);break;case 4844E4:a.uiUtil().msgBox(g.IDS_MSGBOX_HSM_ERROR_MEMORY_TOO_SMALL);break;case 4846E4:a.uiUtil().msgBox(g.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_KEY_LENGTH);break;case 4904E4:a.uiUtil().msgBox(g.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(g.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;case 4843E4:case 4123E4:f=a.nimservice().GetLastErrorMessage();f=g.IDS_MSGBOX_CERT_COPY_ERROR_NEWEST_CERT+"\n\n"+f;a.uiUtil().msgBox(f);break;default:e=a.nimservice().GetLastErrorCode(),a.uiUtil().errMsgBox(f?f:g.IDS_MSGBOX_CERT_COPY_ERROR,e)}b="";a.uiUtil().loadingBox(!1,"us-div-list-load")})}):a.nimservice().CopyCert(c,b,e,h,k,function(c,e){if(0===c)a.uiUtil().msgBox(g.IDS_MSGBOX_CERT_COPY_SUCCESS),d&&d(0);else switch(c){case 4823E4:a.uiUtil().msgBox(g.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(g.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4013E4:a.uiUtil().msgBox(g.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_LOW_PERFORM_MEDIA);break;case 4844E4:a.uiUtil().msgBox(g.IDS_MSGBOX_HSM_ERROR_MEMORY_TOO_SMALL);break;case 4846E4:a.uiUtil().msgBox(g.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_KEY_LENGTH);break;case 4904E4:a.uiUtil().msgBox(g.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(g.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;case 4843E4:case 4123E4:e=a.nimservice().GetLastErrorMessage();e=g.IDS_MSGBOX_CERT_COPY_ERROR_NEWEST_CERT+"\n\n"+e;a.uiUtil().msgBox(e);break;default:c=a.nimservice().GetLastErrorCode(),a.uiUtil().errMsgBox(e?e:g.IDS_MSGBOX_CERT_COPY_ERROR,c)}b="";a.uiUtil().loadingBox(!1,"us-div-list-load")})}if(!b||!c)return!1;var g=c;if(!a.certsList)return a.uiUtil().msgBox(g.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),!1;a.uiUtil().loadingBox(!0,"us-div-list-load",5);Dialog=a.loadUI("storageselect")({type:"CERT_COPY",args:{sourceDevice:l,sourceDrive:u},onConfirm:function(c,b,d){Dialog.dispose();PWDialog=a.loadUI("password")({type:null,args:null,onConfirm:function(e){PWDialog.dispose();if(a.nimservice()){var f=parseInt(m.selectedIndex());a.CONST.__USFB_M_SMARTCARD.device!=l?a.nimservice().CheckPassword(l,u,f,e,!0,function(q,k){0==q?h(f,c,b,e,d):(e="",a.uiUtil().msgBox(""==k?g.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD:k),a.uiUtil().loadingBox(!1,"us-div-list-load"))}):h(f,c,b,e)}else e="",a.uiUtil().msgBox(g.IDS_MSGBOX_NIM_ERROR_UNLOAD),PWDialog.dispose(),a.uiUtil().loadingBox(!1,"us-div-list-load")},onCancel:function(){PWDialog.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load")}});PWDialog.show()},onCancel:function(){Dialog.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");b.focus()}});Dialog.show();return!0}function aa(b,c,d){if(!b||!c)return!1;if(!a.certsList)return a.uiUtil().msgBox(c.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),!1;var h=document.getElementById("us-cert-manage-pw-change-btn");Dialog=a.loadUI("changepassword")({type:null,args:null,onConfirm:function(b,g){Dialog.dispose();if(null==b||0>=b.length||null==g||0>=g.length)return a.uiUtil().msgBox(c.IDS_MSGBOX_PW_ERROR_PLEASE_INPUT_PASSWORD),setTimeout(function(){h.focus()},10),!1;var e=parseInt(m.selectedIndex());if(1>e)return a.uiUtil().msgBox(c.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),setTimeout(function(){h.focus()},10),!1;if(a.uiUtil().isItPFDevice(l))try{var f=a.PFUC[e],n;var v=n=null;var t=a.usWebToolkit.pkcs8.encryptedPrivateKeyFromBase64(f.signpri),q=a.usWebToolkit.pkcs8.checkUserCertPassword(t,b);if(!1===q){t=null;var A={code:-1,message:c.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD};throw A;}v=a.usWebToolkit.pkcs8.changePassword(t,b,g,"Base64");t=null;if("undefined"!==typeof f.kmcert){t=a.usWebToolkit.pkcs8.encryptedPrivateKeyFromBase64(f.kmpri);q=a.usWebToolkit.pkcs8.checkUserCertPassword(t,b);if(!1===q)throw t=null,A={code:-1,message:c.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD},A;n=a.usWebToolkit.pkcs8.changePassword(t,b,g,"Base64")}t=null;try{var x={};x.signcert=f.signcert;x.signpri=v;null!==n&&(x.kmcert=f.kmcert,x.kmpri=n);a.CONST.__PF_M_LS.device===l?(a.PFSH.SaveUserCert(f.ca,x,document.domain,!1),f=x=null,w(l,u,c,"",function(b){(b=y())?m.redrawList(b.list,b.list.length):m.redrawList(null,0);k=!1;a.uiUtil().msgBox(c.IDS_MSGBOX_CERT_CHANGE_PW_SUCCESS);setTimeout(function(){h.focus()},10)})):a.CCPFSH().SaveUserCert(f.ca,x,!1,function(b){0==b?(f=x=null,w(l,u,c,"",function(b){(b=y())?m.redrawList(b.list,b.list.length):m.redrawList(null,0);k=!1;a.uiUtil().msgBox(c.IDS_MSGBOX_CERT_CHANGE_PW_SUCCESS);setTimeout(function(){h.focus()},10)})):(a.uiUtil().errMsgBox(c.IDS_MSGBOX_CERT_CHANGE_PW_ERROR,b),setTimeout(function(){h.focus()},10))})}catch(E){switch(E.code){case 1E7:0<=E.detail.indexOf("115010")?a.uiUtil().msgBox(c.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(c.IDS_MSGBOX_CERT_CHANGE_PW_ERROR,E.code);break;default:a.uiUtil().errMsgBox(c.IDS_MSGBOX_CERT_CHANGE_PW_ERROR,E.code)}setTimeout(function(){h.focus()},10)}finally{}}catch(E){a.uiUtil().errMsgBox(E.message,E.code),setTimeout(function(){h.focus()},10)}finally{}else a.nimservice()?(e=parseInt(m.selectedIndex()),a.nimservice().CheckPassword(l,u,e,b,!0,function(f,q){0===f?a.nimservice().ChangePassword(e,b,g,function(b,e){0===b?(a.uiUtil().msgBox(c.IDS_MSGBOX_CERT_CHANGE_PW_SUCCESS),d&&d(0)):(b=a.nimservice().GetLastErrorCode(),a.uiUtil().errMsgBox(""==e?c.IDS_MSGBOX_CERT_CHANGE_PW_ERROR:e,b));a.uiUtil().loadingBox(!1,"us-div-list-load");setTimeout(function(){h.focus()},10)}):(a.uiUtil().loadingBox(!1,"us-div-list-load"),a.uiUtil().msgBox(""==q?c.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD:q),setTimeout(function(){h.focus()},10))})):(a.uiUtil().loadingBox(!1,"us-div-list-load"),a.uiUtil().msgBox(c.IDS_MSGBOX_NIM_ERROR_UNLOAD),setTimeout(function(){h.focus()},10))},onCancel:function(){a.uiUtil().loadingBox(!1,"us-div-list-load");a.uiUtil().msgBox(c.IDS_MSGBOX_CERT_CHANGE_PW_CANCEL);Dialog.dispose();setTimeout(function(){h.focus()},10)}});Dialog.show()}function ba(b,c,d){function h(b){a.certsList&&(a.certsList=null);w(l,u,r,"",function(b){(b=y())?m.redrawList(b.list,b.list.length):m.redrawList(null,0);k=!1;a.uiUtil().msgBox(r.IDS_MSGBOX_CERT_DELETE_SUCCESS);d&&d(0)})}function e(b){var c=parseInt(m.selectedIndex());if(4&a.ESVS.Mode&&!a.uiUtil().isItPFDevice(l))a.nimservice()?a.CONST.__USFB_M_HSMKEY.device!=l?a.nimservice().CheckPassword(l,u,c,b,!1,function(d,e){0===d?g(c,b,null):(a.uiUtil().loadingBox(!1,"us-div-list-load"),a.uiUtil().msgBox(""==e?r.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED:e))}):g(c,b,null):(a.uiUtil().loadingBox(!1,"us-div-list-load"),a.uiUtil().msgBox(r.IDS_MSGBOX_NIM_ERROR_UNLOAD));else{if(a.CONST.__PF_M_LS.device===l&&!a.PFUC||a.CONST.__PF_M_SS.device===l&&!a.CCPFSH())return b="",!1;try{var d=a.usWebToolkit.pkcs8.encryptedPrivateKeyFromBase64(a.PFUC[c].signpri),e=a.usWebToolkit.pkcs8.checkUserCertPassword(d,b);d="";!1===e?a.uiUtil().msgBox(r.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD):g(c,b,null)}catch(A){a.uiUtil().errMsgBox(A.message,A.code)}finally{}a.uiUtil().loadingBox(!1,"us-div-list-load")}}function g(b,c,d){if("MPKI"==a.ESVS.PKI){if(1>b)return a.uiUtil().loadingBox(!1,"us-div-list-load"),!1}else if(1>b||null==c||0>=c.length)return a.uiUtil().loadingBox(!1,"us-div-list-load"),d&&d.dispose(),!1;if(a.CONST.__PF_M_LS.device===l){try{a.PFSH.DeleteUserCertByIndex(b,document.domain),h(c),d&&d.dispose(),c=""}catch(q){return a.uiUtil().errMsgBox(r.IDS_MSGBOX_CERT_DELETE_ERROR,q.code),c="",d&&d.dispose(),!1}finally{}a.uiUtil().loadingBox(!1,"us-div-list-load")}else a.CONST.__PF_M_SS.device===l?a.CCPFSH().DeleteUserCertByIndex(b,function(b,e){0==b?h(c):a.uiUtil().msgBox(r.IDS_MSGBOX_CERT_DELETE_ERROR,b);d&&d.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load")}):a.nimservice().DeleteCert(b,c,function(b,e){a.uiUtil().loadingBox(!1,"us-div-list-load");d&&d.dispose();if(0===b)h(c);else{c="";switch(b){case 4823E4:a.uiUtil().msgBox(r.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(r.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4904E4:a.uiUtil().msgBox(r.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(r.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;default:b=a.nimservice().GetLastErrorCode(),a.uiUtil().errMsgBox(r.IDS_MSGBOX_CERT_DELETE_ERROR,b)}return!1}});return!0}if(!b||!c)return!1;var r=c;if(!a.certsList)return a.uiUtil().msgBox(r.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),!1;if(confirm(r.IDS_CONFIRMBOX_WARNING_DELETE_CERT))if("MPKI"==a.ESVS.PKI)b=parseInt(m.selectedIndex()),g(b,"",null);else{b=null;b=a.CONST.__USFB_M_HSMKEY.device===l?a.loadUI("pin"):a.loadUI("password");var f=b({type:null,args:null,onConfirm:function(a){f.dispose();e(a)},onCancel:function(){f.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load")}});f.show()}return!0}function ca(b,c){if(null==b||0>=b.length||null==c)return!1;if(0b||!c||!d||!h)return!1;var e=a.loadUI("driveselect")({type:"DEVICE_REMOVABLE_DISK",args:c,onConfirm:function(g){g=c.list[g-1].index;0b||!d||!h)return k=!1;var e=a.loadUI("sectokenselect")({type:b,args:c,onConfirm:function(c){0b||!c||!d||!h)return k=!1;a.uiUtil().loadingBox(!0,"us-div-list-load",0);var e=a.loadUI("driveselect")({type:"DEVICE_SAVE_TOKEN",args:c,onConfirm:function(c){e.dispose();a.nimservice()?a.nimservice().CheckSCardConnected(function(c,e){0===c?(PINDialog=a.loadUI("pin")({type:"PIN_SAVE_TOKEN",args:null,onConfirm:function(c){a.ESVS.Embedded?setTimeout(function(){PINDialog.dispose()},10):PINDialog.dispose();a.nimservice().CheckSCardPin(c,function(e,f){if(0!=e){switch(e){case 4904E4:a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;default:a.uiUtil().errMsgBox(h.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN,e)}m.redrawList(null,0);k=!1;setTimeout(function(){d.dispose()},10)}else w(b,1,h,c,function(a){0!=a?m.redrawList(null,0):(a=y())?m.redrawList(a.list,a.list.length):m.redrawList(null,0);k=!1;setTimeout(function(){d.dispose()},10)})})},onCancel:function(){k=!1;PINDialog.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");setTimeout(function(){d.dispose()},10)}}),PINDialog.show()):(k=!1,a.uiUtil().msgBox(h.IDS_MSGBOX_SMART_CARD_UNCONNECTED),a.uiUtil().loadingBox(!1,"us-div-list-load"),setTimeout(function(){d.dispose()},10))}):(k=!1,a.uiUtil().msgBox(h.IDS_MSGBOX_NIM_ERROR_UNLOAD),a.uiUtil().loadingBox(!1,"us-div-list-load"),setTimeout(function(){d.dispose()},10))},onCancel:function(){k=!1;e.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");setTimeout(function(){d.dispose()},10)}});e.show()}function na(b,c){if(!b||!c)return k=!1;l=a.CONST.__PF_M_SS.device;u=0;G(l);a.certsList&&(a.certsList=null);m.redrawList(null,-1);w(a.CONST.__PF_M_SS.device,0,c,"",function(b){if(0!=b)return win&&"none"!=win.style.display&&a.uiUtil().errMsgBox(c.IDS_MSGBOX_COMMON_ERROR_GET_CERT,b),m.redrawList(null,0),k=!1;(b=y())?m.redrawList(b.list,b.list.length):m.redrawList(null,0);k=!1})}function oa(b,c){if(!b||!c)return k=!1;l=a.CONST.__PF_M_LS.device;u=0;G(l);a.certsList&&(a.certsList=null);m.redrawList(null,-1);a.uiUtil().loadingBox(!0,"us-div-list-load",0);setTimeout(function(){w(a.CONST.__PF_M_LS.device,0,c,"",function(b){a.uiUtil().loadingBox(!1,"us-div-list-load",0);if(0!=b)return a.uiUtil().errMsgBox(c.IDS_MSGBOX_COMMON_ERROR_GET_CERT,b),m.redrawList(null,0),k=!1;(b=y())?m.redrawList(b.list,b.list.length):m.redrawList(null,0);k=!1})},10);return!0}function pa(b,c){if(!b||!c)return k=!1;l=a.CONST.__USFB_M_HDD.device;u=0;G(l);a.certsList&&(a.certsList=null);m.redrawList(null,-1);w(a.CONST.__USFB_M_HDD.device,0,c,"",function(b){if(0!=b)return a.uiUtil().errMsgBox(c.IDS_MSGBOX_COMMON_ERROR_GET_CERT,b),m.redrawList(null,0),k=!1;(b=y())?m.redrawList(b.list,b.list.length):m.redrawList(null,0);k=!1;return!0})}function qa(b,c){if(!b||!c)return k=!1;k=!0;var d=null;l=a.CONST.__USFB_M_DISK.device;u=0;G(l);a.certsList&&(a.certsList=null);m.redrawList(null,-1);if(4&a.ESVS.Mode&&!a.uiUtil().isItPFDevice(l))if(a.nimservice())a.nimservice().GetDiskList(function(h,e,g){e=0;g&&(e=g.length);if(0==h&&0a.ESVS.Media.list.indexOf(b.name)&&(c=!0);if(c)return!1;c=document.getElementById("us-cert-manage-storage-btn-list");var d=document.createElement("li");d.setAttribute("id","us-cert-manage-storage-btn-li-"+b.name,0);d.setAttribute("mediaIndex",b.mediaIndex,0);7==b.mediaIndex&&(d.className="line-first");"hidden"===b.visibility?(d.style.display="none",d.style.visibility="hidden"):(d.style.display="block",d.style.visibility="visible");var h=document.createElement("button");h.setAttribute("type","button",0);h.setAttribute("id","us-cert-manage-btn-"+b.name,0);h.setAttribute("title",b.label,0);h.setAttribute("tabindex",b.tabIndex,0);b.disabled?(h.onclick=function(){a.uiUtil().msgBox(p.IDS_MSGBOX_NOT_SUPPORTED_MEDIA)},h.className="us-layout-storage-btn-none"):(h.onclick=b.onclick,h.className=b.device===l?"us-layout-storage-btn-on":"us-layout-storage-btn-off");d.appendChild(h);if(!a.ESVS.chkEXESetup&&"cloudsign"!==b.name&&"webstorage"!==b.name&&"browsersign"!==b.name&&"qrcode"!==b.name){var e=document.createElement("span");e.className="us-download-select";h.appendChild(e)}e=document.createElement("span");e.className="us-img-storage";var g=document.createElement("img");g.setAttribute("id","us-cert-manage-img-"+b.name,0);g.setAttribute("alt",b.label,0);"browsersign"==b.name?"unknown"==a.browserName?b.disabled?g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+b.name+"_d.png",0):g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+b.name+".png",0):b.disabled?g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/browser/"+a.browserName+"_d.png",0):g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/browser/"+a.browserName+".png",0):b.disabled?g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+b.name+"_d.png",0):g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+b.name+".png",0);e.appendChild(g);h.appendChild(e);e=document.createElement("span");e.setAttribute("id","us-cert-manage-lbl-"+b.name,0);e.className="us-layout-lbl-storage";e.appendChild(document.createTextNode(b.label));h.appendChild(e);d.appendChild(h);c.appendChild(d);return!0}function R(b,c,d){if("no_more"==d)a.uiUtil().msgBox(c.IDS_MSGBOX_NOT_MORE_MEDIA);else{document.getElementById("us-cert-manage-storage-wrap");"open"==d?(b=document.getElementById("us-cert-manage-div-storage"),b.style.height="186px",b=document.getElementById("us-cert-manage-storage-more-btn"),b.setAttribute("title",c.IDS_STORAGE_MORE_VIEW+c.IDS_STORAGE_MORE_VIEW_HIDDEN+c.IDS_BUTTON,0),b.onclick=function(){R(this,c,"close")},b=document.getElementById("us-cert-manage-storage-more-btn-img"),b.setAttribute("alt",c.IDS_STORAGE_MORE_VIEW+c.IDS_STORAGE_MORE_VIEW_HIDDEN,0),b.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_more_btn_close.png",0)):(b=document.getElementById("us-cert-manage-div-storage"),b.style.height="96px",b=document.getElementById("us-cert-manage-storage-more-btn"),b.setAttribute("title",c.IDS_STORAGE_MORE_VIEW+c.IDS_STORAGE_MORE_VIEW_SHOW+c.IDS_BUTTON,0),b.onclick=function(){R(this,c,"open")},b=document.getElementById("us-cert-manage-storage-more-btn-img"),b.setAttribute("alt",c.IDS_STORAGE_MORE_VIEW+c.IDS_STORAGE_MORE_VIEW_SHOW,0),b.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_more_btn_open.png",0));b=a.ESVS.Media.list.split("|");for(var h=0;hm.selectedIndex()&&(document.getElementById("us-layout-cert-manage-detail-box-subject").innerHTML=""+a.IDS_DETAIL_BOX_NOT_SELECTED+"",document.getElementById("us-layout-cert-manage-detail-box-expire-data").innerHTML="")}catch(e){xa.log("getCurrDevice error")}}function ya(a,c,d){switch(n.args.type){case 1:Z(a,c,d);break;case 2:aa(a,c,d);break;case 3:U(c,d);break;case 4:da(a,c,d);break;case 5:ba(a,c,d);break;case 6:ja(a,c,d);break;case 7:S(a,c)}}var za=function(){var b=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");b.open("GET",a.ESVS.SRCPath+"unisignweb/rsrc/layout/certmanage.html?version="+a.ver,!1);b.send(null);return b.responseText},ia=function(){var b=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");b.open("GET",a.ESVS.SRCPath+"unisignweb/rsrc/lang/"+a.ESVS.Language+"/certmanage_"+a.ESVS.Language+".js?version="+a.ver,!1);b.send(null);return b.responseText},p=a.CustomEval(ia,!0),fa=null,m=null,C=a.ESVS.TabIndex+1,ha=0,l=a.CONST.__USFB_M_HDD.device,u=0,k=!1,H=null;if(null!=a.ESVS.Media&&null!=a.ESVS.Media.defaultdevice){l=a.uiUtil().getMediaDevice(a.ESVS.Media.defaultdevice);a.uiUtil().isItPFDevice(l)&&4==a.ESVS.Mode&&(a.SELECTINFO.curdevice=l=a.CONST.__USFB_M_HDD.device);if(l==a.CONST.__USFB_M_SECUREDISK.device||l==a.CONST.__USFB_M_SMARTCARD.device)u=1;a.SELECTINFO.curdevice=l}else 2==a.ESVS.Mode&&(l=a.CONST.__PF_M_LS.device,a.SELECTINFO.curdevice=l);!n.args||6!=n.args.type&&7!=n.args.type||(l=a.CONST.__USFB_M_SECUREDISK.device,u=1,a.SELECTINFO.curdevice=l);var xa=window.console||{log:function(){}},U=null,W=null;window.FileReader?(U=function(b,c){if(null==b)return!1;a.uiUtil().loadingBox(!0,"us-div-list-load");if(a.uiUtil().isItPortableDevice())a.uiUtil().ImportFromBackupStore();else if(a.uiUtil().isItPortableDevice())a.uiUtil().ImportFromBackupStore();else{var d=a.loadUI("importcert")({type:"importcert",args:null,onConfirm:function(b,c){var e=document.getElementById("us-cert-manage-get-cert-btn");"MPKI"==a.ESVS.PKI?(W(a.CONST.__USFB_M_HDD.device,0,b,c),setTimeout(function(){e.focus()},10)):(SSDialog=a.loadUI("storageselect")({type:"CERT_IMPORT",args:{possibleWhale:!1},onConfirm:function(g,f){SSDialog.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");d.dispose();W(g,f,b,c);setTimeout(function(){e.focus()},10)},onCancel:function(){pw="";SSDialog.dispose();setTimeout(function(){e.focus()},10)}}),SSDialog.show())},onCancel:function(){a.uiUtil().loadingBox(!1,"us-div-list-load");a.uiUtil().msgBox(b.IDS_MSGBOX_CERT_IMPORT_CANCEL);d.dispose();var c=document.getElementById("us-cert-manage-get-cert-btn");setTimeout(function(){c.focus()},10)}});d.show()}return!0},W=function(b,c,d,h){function e(){var a=y();a?m.redrawList(a.list,a.list.length):m.redrawList(null,0)}function g(b,c,d,e){0===b&&(a.uiUtil().msgBox(p.IDS_MSGBOX_CERT_IMPORT_SUCCESS),l===c&&u===d&&(a.CONST.__USFB_M_SMARTCARD.device===l&&0===u&&w(l,u,p,e,function(a){(a=y())?m.redrawList(a.list,a.list.length):m.redrawList(null,0);k=!1}),w(l,u,p,"",function(a){(a=y())?m.redrawList(a.list,a.list.length):m.redrawList(null,0);k=!1})))}var r=h;document.getElementById("us-cert-get-btn");if(b==a.CONST.__PF_M_LS.device){var f=0;try{a.PFSH.LoadAllCerts(document.domain)}catch(x){301E5===x.code&&(a.PFSH.InstallCACerts(document.domain),a.PFSH.LoadAllCerts(document.domain))}try{var z=a.PFSH.SetP12OnMemory(d,r),v=z.aluc[z.index];a.usWebToolkit.x509Certificate.parser(v.signcert,"Base64");var t=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),q=a.certUtil().getIssuerEnName(t);a.PFSH.SaveUserCert(q,v,document.domain,!0)}catch(x){switch(f=x.code,x.code){case 1E7:0<=x.detail.indexOf("115010")?a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(p.IDS_MSGBOX_CERT_IMPORT_ERROR,x.code);break;default:a.uiUtil().errMsgBox(p.IDS_MSGBOX_CERT_IMPORT_ERROR,x.code)}}g(f,b,c,"")}else if(b==a.CONST.__PF_M_SS.device){var A=function(d,e){a.CCPFSH().SetP12OnMemory(d,e,function(d,f,h){if(0==d)d=h.aluc[h.index],a.usWebToolkit.x509Certificate.parser(d.signcert,"Base64"),f=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),f=a.certUtil().getIssuerEnName(f),a.CCPFSH().SaveUserCert(f,d,!0,function(d){e="";0==d?g(d,b,c,""):a.uiUtil().errMsgBox(p.IDS_MSGBOX_CERT_IMPORT_ERROR,d)});else{switch(d){case 1E7:0<=f.indexOf("115010")?a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(p.IDS_MSGBOX_CERT_IMPORT_ERROR,d);break;default:a.uiUtil().errMsgBox(p.IDS_MSGBOX_CERT_IMPORT_ERROR,d)}e=""}})};a.CCPFSH().IsCCPFSHAvailable(function(b){0==b?A(d,r):a.CCPFSH().GetCCStorageHandler(a.ESVS.EncAlgo,a.ESVS.HashAlgo,a.ESVS.BSPKI,function(a,b){0==a&&A(d,r)})})}else a.CONST.__USFB_M_HSMKEY.device===b||a.CONST.__USFB_M_SMARTCARD.device===b?(f=null,f=a.CONST.__USFB_M_SMARTCARD.device===b?"PIN_SAVE_TOKEN":"PIN_SECURITY_TOKEN",PINDialog=a.loadUI("pin")({type:f,args:null,onConfirm:function(f){a.nimservice().ImportCert(0,d,h,b,c,f,function(d,h){if(0==d)l==b&&u==c&&b!=a.CONST.__USFB_M_MOBILE.device?g(d,b,c,f):(e(),a.uiUtil().msgBox(p.IDS_MSGBOX_CERT_IMPORT_SUCCESS)),n.args&&3==n.args.type&&M();else switch(a.uiUtil().loadingBox(!1,"us-div-list-load"),d){case 4823E4:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4844E4:a.uiUtil().msgBox(p.IDS_MSGBOX_HSM_ERROR_MEMORY_TOO_SMALL);break;case 4846E4:a.uiUtil().msgBox(p.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_KEY_LENGTH);break;case 4904E4:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;case 4843E4:case 4123E4:h=a.nimservice().GetLastErrorMessage();h=p.IDS_MSGBOX_CERT_COPY_ERROR_NEWEST_CERT+"\n\n"+h;a.uiUtil().msgBox(h);break;case 4019E4:a.uiUtil().errMsgBox(h,d);break;case 4301E4:0<=h.indexOf("3509")?a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD):a.uiUtil().errMsgBox(p.IDS_MSGBOX_CERT_IMPORT_ERROR,d);break;default:switch(d=a.nimservice().GetLastErrorCode(),a.nimservice().GetLastErrorMessage(),d){case 3509:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD);break;default:a.uiUtil().errMsgBox(h?h:p.IDS_MSGBOX_CERT_IMPORT_ERROR,d)}}});PINDialog.dispose()},onCancel:function(){r="";PINDialog.dispose()}}),PINDialog.show()):a.nimservice().ImportCert(0,d,h,b,c,"",function(d,f){if(0==d)l==b&&u==c&&b!=a.CONST.__USFB_M_MOBILE.device?g(d,b,c,""):(e(),a.uiUtil().msgBox(p.IDS_MSGBOX_CERT_IMPORT_SUCCESS)),n.args&&3==n.args.type&&M();else switch(a.uiUtil().loadingBox(!1,"us-div-list-load"),d){case 4823E4:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4844E4:a.uiUtil().msgBox(p.IDS_MSGBOX_HSM_ERROR_MEMORY_TOO_SMALL);break;case 4846E4:a.uiUtil().msgBox(p.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_KEY_LENGTH);break;case 4904E4:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;case 4843E4:case 4123E4:f=a.nimservice().GetLastErrorMessage();f=p.IDS_MSGBOX_CERT_COPY_ERROR_NEWEST_CERT+"\n\n"+f;a.uiUtil().msgBox(f);break;case 4019E4:a.uiUtil().errMsgBox(f,d);break;case 4301E4:0<=f.indexOf("3509")?a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD):a.uiUtil().errMsgBox(p.IDS_MSGBOX_CERT_IMPORT_ERROR,d);break;default:switch(d=a.nimservice().GetLastErrorCode(),a.nimservice().GetLastErrorMessage(),d){case 3509:a.uiUtil().msgBox(p.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD);break;default:a.uiUtil().errMsgBox(f?f:p.IDS_MSGBOX_CERT_IMPORT_ERROR,d)}}})}):(U=function(b,c){if(null==b)return!1;if(a.uiUtil().isItPortableDevice())a.uiUtil().ImportFromBackupStore();else{c=document.getElementById("us-cert-manage-file-search-hidden");if("safari"==a.browserName&&6>parseFloat(a.browserVersion))return a.uiUtil().msgBox(b.IDS_MSGBOX_SEARCH_CERT_GUIDE_FOR_SAFARI),!1;if("opera"==a.browserName||"safari"==a.browserName||"msie"==a.browserName&&8===parseInt(a.browserVersion))c.style.display="block";"safari"==a.browserName&&c.setAttribute("accept","",0);c.value="";if(""!=c.value){b=c.onchange;var d=c.parentNode;d.removeChild(c);c=document.createElement("input");c.setAttribute("type","file",0);"safari"==a.browserName?c.setAttribute("accept","",0):c.setAttribute("accept","application/x-pkcs12",0);c.setAttribute("id","us-cert-manage-file-search-hidden",0);c.className="us-layout-cert-manage-file-search-hidden";c.onchange=b;d.appendChild(c)}c.click()}return!0},ImportPFX=function(b,c){function d(b,c,d,f){a.uiUtil().msgBox(e.IDS_MSGBOX_CERT_IMPORT_SUCCESS);a.CONST.__USFB_M_SMARTCARD.device===l&&1===u?w(l,u,e,f,function(a){(a=y())?m.redrawList(a.list,a.list.length):m.redrawList(null,0);k=!1}):w(l,u,e,"",function(a){(a=y())?m.redrawList(a.list,a.list.length):m.redrawList(null,0);k=!1})}function h(b,c,f,h,k){function q(f){var k=0,q=r;null!=g&&(k=1,q=g);a.nimservice().ImportCert(k,q,h,b,c,f,function(g,k){if(0==g)l==b&&u==c&&b!=a.CONST.__USFB_M_MOBILE.device?d(g,b,c,f):((g=y())?m.redrawList(g.list,g.list.length):m.redrawList(null,0),a.uiUtil().msgBox(e.IDS_MSGBOX_CERT_IMPORT_SUCCESS)),n.args&&3==n.args.type&&M(),h=f="";else switch(a.uiUtil().loadingBox(!1,"us-div-list-load"),g){case 4823E4:a.uiUtil().msgBox(e.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(e.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4844E4:a.uiUtil().msgBox(e.IDS_MSGBOX_HSM_ERROR_MEMORY_TOO_SMALL);break;case 4846E4:a.uiUtil().msgBox(e.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_KEY_LENGTH);break;case 4904E4:a.uiUtil().msgBox(e.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(e.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;case 4843E4:case 4123E4:g=a.nimservice().GetLastErrorMessage();g=e.IDS_MSGBOX_CERT_COPY_ERROR_NEWEST_CERT+"\n\n"+g;a.uiUtil().msgBox(g);break;case 4019E4:a.uiUtil().errMsgBox(k,g);break;default:switch(g=a.CONST.__PF_M_LS.device===b?g:a.nimservice().GetLastErrorCode(),g){case 3509:a.uiUtil().msgBox(e.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD);break;default:a.uiUtil().errMsgBox(e.IDS_MSGBOX_CERT_IMPORT_ERROR,g)}}})}var p=document.getElementById("us-cert-manage-get-cert-btn");if(4<=a.ESVS.Mode)if(a.CONST.__PF_M_LS.device==b||a.CONST.__PF_M_SS.device==b){if(!a.PFSH)return a.uiUtil().msgBox("unsupport html5 storage"),!1;f=0;try{var t=a.PFSH.SetP12OnMemory(r,h),v=t.index,x=t.aluc[v];a.usWebToolkit.x509Certificate.parser(x.signcert,"Base64");var A=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),w=a.certUtil().getIssuerEnName(A);a.PFSH.SaveUserCert(w,x,document.domain,!0)}catch(D){switch(f=D.code,D.code){case 1E7:0<=D.detail.indexOf("115010")?a.uiUtil().msgBox(e.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(e.IDS_MSGBOX_CERT_IMPORT_ERROR,D.code);break;default:a.uiUtil().errMsgBox(e.IDS_MSGBOX_CERT_IMPORT_ERROR,D.code)}}0==f&&d(f,b,c,"");h="";k&&k.dispose();setTimeout(function(){p.focus()},10)}else a.nimservice()?a.CONST.__USFB_M_HSMKEY.device===b||a.CONST.__USFB_M_SMARTCARD.device===b?(k&&k.dispose(),k=null,k=a.CONST.__USFB_M_SMARTCARD.device===b?"PIN_SAVE_TOKEN":"PIN_SECURITY_TOKEN",PINDialog=a.loadUI("pin")({type:k,args:null,onConfirm:function(a){q(a);PINDialog.dispose();setTimeout(function(){p.focus()},10)},onCancel:function(){h="";PINDialog.dispose();setTimeout(function(){p.focus()},10)}}),PINDialog.show()):(k&&k.dispose(),q("")):a.uiUtil().msgBox(e.IDS_MSGBOX_NIM_ERROR_UNLOAD);else{if(!a.PFSH)return a.uiUtil().msgBox("unsupport html5 storage"),!1;f=0;try{t=a.PFSH.SetP12OnMemory(r,h),v=t.index,x=t.aluc[v],a.usWebToolkit.x509Certificate.parser(x.signcert,"Base64"),A=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),w=a.certUtil().getIssuerEnName(A),a.PFSH.SaveUserCert(w,x,document.domain,!0)}catch(D){switch(f=D.code,D.code){case 1E7:0<=D.detail.indexOf("115010")?a.uiUtil().msgBox(e.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(e.IDS_MSGBOX_CERT_IMPORT_ERROR,D.code);break;default:a.uiUtil().errMsgBox(e.IDS_MSGBOX_CERT_IMPORT_ERROR,D.code)}}0==f&&d(f,b,c,"");h="";k&&k.dispose();setTimeout(function(){p.focus()},10)}}if(!b||!c)return!1;var e=c,g=null,r=null,f=document.getElementById("us-cert-manage-get-cert-btn");if("opera"==a.browserName||"safari"==a.browserName)b.style.display="none";if(window.FileReader)if(b=b.files,0=a.ESVS.Media.option&&-1*a.ESVS.Media.option&Math.pow(2,g)&&a.ESVS.Media.defaultdevice!=p&&(f.disabled=!0);f.tabIndex=C;f.mediaIndex=b+1;f.visibility=6"+a.certUtil().getCN(a.usWebToolkit.x509Certificate.getSubjectName())+"",document.getElementById("us-layout-cert-manage-detail-box-expire-data").innerHTML=a.certUtil().getLocalDate(a.usWebToolkit.x509Certificate.getNotBefore())+" ~ "+a.certUtil().getLocalDate(a.usWebToolkit.x509Certificate.getNotAfter()),document.getElementById("us-layout-cert-manage-detail-box-savepath-data").innerHTML=d,document.getElementById("us-layout-cert-manage-detail-box-savepath-data").setAttribute("title",d)):document.getElementById("us-layout-cert-manage-detail-box-subject").innerHTML=""+c.IDS_DETAIL_BOX_NOT_SELECTED+"",document.getElementById("us-layout-cert-manage-detail-box-expire-lbl").innerHTML=c.IDS_DETAIL_BOX_EXPIRE_DATE+" : ",document.getElementById("us-layout-cert-manage-detail-box-savepath-lbl").innerHTML=c.IDS_DETAIL_BOX_SAVE_PATH+" : ",b=document.getElementById("us-cert-manage-detail-view-btn"),b.setAttribute("tabindex",C++,0),b.value=c.IDS_DETAIL_BOX_BTN_VIEW,b.title=c.IDS_DETAIL_BOX_BTN_VIEW,b.onclick=function(){k||F(this,c)},b=document.getElementById("us-cert-manage-sw-info-btn"),b.setAttribute("tabindex",C++,0),b.setAttribute("class","btn-action"),b.value=c.IDS_DETAIL_BOX_BTN_ACTIONS[n.args.type],b.title=c.IDS_DETAIL_BOX_BTN_ACTIONS[n.args.type],b.onclick=function(){k||ya(this,c,function(a,b,c){0==a&&(b&&c?M(b,c):M())})},B(c)):(document.getElementById("us-div-cert-manage-detail").style.display="none",b=document.getElementById("us-cert-manage-cert-view-btn"),b.setAttribute("value",c.IDS_CERT_VIEW,0),b.setAttribute("title",c.IDS_CERT_VIEW+c.IDS_BUTTON,0),b.setAttribute("tabindex",C++,0),b.onclick=function(){k||F(this,c)},b=document.getElementById("us-cert-manage-pw-change-btn"),b.setAttribute("value",c.IDS_PW_CHANGE,0),b.setAttribute("title",c.IDS_PW_CHANGE+c.IDS_BUTTON,0),b.setAttribute("tabindex",C++,0),b.onclick=function(){k||aa(this,c)},d=document.getElementById("us-cert-manage-cert-delete-btn"),d.setAttribute("value",c.IDS_CERT_DELETE,0),d.setAttribute("title",c.IDS_CERT_DELETE+c.IDS_BUTTON,0),d.setAttribute("tabindex",C++,0),d.onclick=function(){k||ba(this,c)},d=document.getElementById("us-cert-manage-cert-copy-btn"),d.setAttribute("value",c.IDS_CERT_COPY,0),d.setAttribute("title",c.IDS_CERT_COPY+c.IDS_BUTTON,0),d.setAttribute("tabindex",C++,0),d.onclick=function(){k||Z(this,c)},"MPKI"==a.ESVS.PKI&&(d.readOnly=!0,d.disabled=!0,b.readOnly=!0,b.disabled=!0),a.uiUtil().isIraq()&&(d.readOnly=!0,d.disabled=!0),b=document.getElementById("us-cert-manage-get-cert-btn"),b.setAttribute("value",c.IDS_CERT_GET,0),b.setAttribute("title",c.IDS_CERT_GET+c.IDS_BUTTON,0),b.setAttribute("tabindex",C++,0),b.onclick=function(){k||U(c)},b=document.getElementById("us-cert-manage-put-cert-out-btn"),b.setAttribute("value",c.IDS_CERT_PUT_OUT,0),b.setAttribute("title",c.IDS_CERT_PUT_OUT+c.IDS_BUTTON,0),b.setAttribute("tabindex",C++,0),b.onclick=function(){k||da(this,c)},b=document.getElementById("us-cert-manage-sw-info-btn"),b.setAttribute("value",c.IDS_SW_INFO,0),b.setAttribute("title",c.IDS_SW_INFO+c.IDS_BUTTON,0),b.setAttribute("tabindex",C++,0),b.onclick=function(){k||X(this)});b=document.getElementById("us-cert-manage-lbl-notice");b.appendChild(document.createTextNode(c.IDS_NOTICE));if("MPKI"==a.ESVS.PKI||a.uiUtil().isIraq())b.style.visibility="hidden";var v=document.getElementById("us-cert-manage-cls-btn");v.setAttribute("value",c.IDS_CLOSE,0);v.setAttribute("title",c.IDS_CLOSE+c.IDS_BUTTON,0);v.setAttribute("tabindex",C++,0);v.onclick=function(){k&&a.ESVS.chkEXESetup||M()};v.onkeydown=function(a){a=a||window.event;var b=a.which||a.keyCode;9==b&&a.shiftKey&&(v.onblur=function(){setTimeout(function(){document.getElementById("us-cert-manage-sw-info-btn").focus()},10)});9!=b||a.shiftKey||(v.onblur=function(){setTimeout(function(){h.focus()},10)})};var t=!1;h.onkeyup=function(a){a=a||window.event;9==(a.which||a.keyCode)&&a.shiftKey&&t&&(t=!1,setTimeout(function(){v.focus()},10))};h.onkeydown=function(a){a=a||window.event;if(9==(a.which||a.keyCode)&&a.shiftKey)return a.cancelBubble=!0,t=a.returnValue=!0,!1};a.ESVS.ShowGuide&&z(l);return document.getElementById("us-div-cert-manage")}()};return function(n){var y=a.uiLayerLevel,w=a.uiUtil().getOverlay(y),F=X({type:n.type,args:n.args,onConfirm:n.onConfirm,onCancel:n.onCancel});F.style.zIndex=y+1;document.body.insertBefore(w,document.body.firstChild);var S=window.onresize;return{show:function(){draggable(F,document.getElementById("us-div-cert-manage-title"));w.style.display="block";a.uiUtil().offsetResize(F);window.onresize=function(){a.uiUtil().offsetResize(F)};a.uiLayerLevel+=10;a.ESVS.TabIndex+=30;setTimeout(function(){a.uiUtil().setFirstFocus("us-cert-manage-lbl-title")},10)},hide:function(){w.style.display="none";F.style.display="none"},dispose:function(n){1==n&&4&a.ESVS.Mode&&a.ESVS.chkEXESetup&&a.nimservice().ClearAllUserCertList(function(a,n){});window.onresize=function(){S&&S()};F.parentNode.removeChild(F);w.parentNode.removeChild(w);a.uiLayerLevel-=10;a.ESVS.TabIndex-=30}}}};