// Copyright (c) 2003 Computer Associates International, Inc
// window_manager.js 1.170.1.21 2003/04/03 23:20:36
var scrollDivCount=0;
var scrollDivsClosed=0;
var postScrollDivOpen=false;
function get_ahdtop(alert_on_error)
{
if(typeof window.ahdtop=="object"&&
window.ahdtop!=null&&
!window.ahdtop.closed&&
typeof window.ahdtop.name=="string"&&
window.ahdtop.name=="AHDtop")
return window.ahdtop;
if(typeof parent.ahdtop=="object"&&
parent.ahdtop!=null&&
!parent.ahdtop.closed&&
parent.ahdtop.name=="AHDtop"){
window.ahdtop=parent.ahdtop;
return window.ahdtop;
}
else{
for(var win=window;typeof win=="object";win=win.opener){
if(win==null||
win.closed||
typeof win.name!="string")
break;
if(typeof win.ahdtop=="object"&&
win.ahdtop!=null&&
!win.ahdtop.closed&&
typeof win.ahdtop.name=="string"&&
win.ahdtop.name=="AHDtop"){
window.ahdtop=win.ahdtop;
return window.ahdtop;
}
while(win!=win.parent&&
!win.closed&&
typeof win.name=="string"&&
win.name!="AHDtop"&&
!win.parent.closed&&
typeof win.parent.name=="string"){
win=win.parent;
}
if(!win.closed&&
typeof win.name=="string"&&
win.name=="AHDtop"){
window.ahdtop=win;
return window.ahdtop;
}
}
}
if(typeof alert_on_error=="boolean"&&
alert_on_error)
alert("Unable to perform requested operation - ahdtop not found");
window.ahdtop=void(0);
return window.ahdtop;
}
var ahdtop=get_ahdtop();
function register_window(newframe,name)
{
if(typeof newframe!="object"||
typeof newframe.name!="string")
return;
if(newframe.name=="cai_main"||
(newframe.parent==newframe&&
newframe.name!="AHDtop"))
{
var ahdtop=get_ahdtop();
if(typeof ahdtop!="object")
{
alertmsg(73);
return;
}
var newwin=newframe.parent;
newwin.ahdtop=ahdtop;
if(ahdtop!=null)
{
if(newwin.name.length==0){
if(typeof name!="string"||name.length==0)
name=get_next_window_name();
newwin.name=name;
}
ahdtop.AHD_Windows[newwin.name]=newwin;
if(newwin.name!=popup_window_name("ahdwlist")&&
newwin.document.title.length>0)
refresh_window_list();
}
if(typeof newframe._dtl!="object"&&
typeof newframe.propFormName=="string"&&
newframe.propForm1=="detail"){
}
}
}
function cancel_window()
{
if(typeof sessionEnded=="boolean"&&sessionEnded)
return;
var gobtn=window.gobtn;
var m_win=parent.cai_main;
if(typeof m_win!="object")
m_win=parent.page;
else if(!_browser.isIE){
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&ahdtop!=null)
ahdtop.lastClosedURL=m_win.document.URL;
}
var SID=void(0);
var Cgi=void(0);
if((typeof m_win=="object")&&
(typeof m_win.cfgCgi=="string")&&
(typeof m_win.cfgSID=="string"))
{
SID=m_win.cfgSID;
Cgi=m_win.cfgCgi;
}
var cancel_in_progress=false;
if(typeof gobtn!="object")
gobtn=parent.gobtn;
if(typeof gobtn=="object"&&
typeof gobtn.form_cancelled=="boolean"){
if(gobtn.form_cancelled)
return true;
gobtn.form_cancelled=true;
var cai_main=gobtn.parent.cai_main;
if(typeof cai_main!="undefined"&&
typeof cai_main.ImgBtnDoCancel!="undefined")
cancel_in_progress=cai_main.ImgBtnDoCancel();
}
var delay=30000;
if(!cancel_in_progress&&
typeof parent.is_form_loaded=="boolean"&&
!parent.is_form_loaded&&
typeof cfgInitialURL=="string"&&
cfgInitialURL.indexOf("OP=UPDATE")!=-1&&
typeof parent.opener!="undefined"&&
typeof parent.opener.cfgCgi=="string"&&
typeof parent.opener.cfgSID=="string"&&
typeof parent.name=="string")
{
var Cgi=window.opener.cfgCgi;
var SID=window.opener.cfgSID;
delay=0;
}
if((typeof Cgi=="string")&&
(typeof SID=="string")&&
(typeof parent.name=="string"))
{
remove_popup_window_name(parent.name);
var url=Cgi+"?SID="+SID+"+FID=0+REMOVECACHE="+parent.name;
ahdtop_load_workframe(url,delay,"ONE_WAY","is_popup_window_still_up",parent);
}
deregister_window();
return cancel_in_progress;
}
function deregister_window()
{
if(window==window.parent||
window.name=="cai_main")
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&
ahdtop!=null&&
!ahdtop.closed&&
!ahdtop.parent.closed)
{
var closing_window=window;
if(arguments.length>0)
{
closing_window=arguments[0];
if(typeof closing_window!="object")
return;
}
if(typeof ahdtop.closing_all_windows=="boolean"&&
!ahdtop.closing_all_windows)
{
var i=0;
var window_name=new Array();
for(var registered_name in ahdtop.AHD_Windows)
window_name[i++]=registered_name;
for(i=0;i<window_name.length;i++)
{
var ahdwin=ahdtop.AHD_Windows[window_name[i]];
if(typeof ahdwin=="object"&&
typeof ahdwin.opener=="object"&&
ahdwin.opener==closing_window)
{
delete ahdtop.AHD_Windows[window_name[i]];
deregister_window(ahdwin);
ahdwin.ahdtop=null;
if(!ahdwin.closed)
ahdwin.close();
}
}
}
if(typeof closing_window.name=="string"&&
closing_window.name.length!=0&&
typeof ahdtop.AHD_Windows=="object"&&
typeof ahdtop.AHD_Windows[closing_window.name]=="object")
{
delete ahdtop.AHD_Windows[closing_window.name];
refresh_window_list();
}
}
}
}
function closing_main_window()
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&
ahdtop.AHD_logout_requested!="undefined"&&
!ahdtop.AHD_logout_requested){
if(typeof ahdtop.workframe=="object"&&
typeof cfgCgi=="string"&&
typeof cfgSID=="string"){
var url=cfgCgi+"?SID="+cfgSID+
"+FID=0+ENDSESSION=1";
ahdtop.workframe.location.href=url;
}
close_all_windows(1);
ahdtop.ahdtop=void(0);
ahdtop.window.name="";
}
}
function check_log_reader(ahdtop)
{
var i=0;
var window_name=new Array();
for(var registered_name in ahdtop.AHD_Windows)
window_name[i++]=registered_name;
for(i=window_name.length-1;i>=0;i--)
{
var ahdwin=ahdtop.AHD_Windows[window_name[i]];
if(typeof ahdwin=="object"&&
typeof ahdwin.name=="string"&&
ahdwin.name==popup_window_name("log_reader"))
{
var ans=window.confirm(msgtext(181));
if(ans)
{
ahdwin.make_ahdtop();
delete ahdtop.AHD_Windows[window_name[i]];
}
return ans;
}
}
}
function logout_all_windows(need_logout)
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&
window.name!="AHDtop"&&
window.name!="AHDlogin")
ahdtop.logout_all_windows();
else{
var query_string=cfgCgi;
if(!check_log_reader(ahdtop))
query_string+="?SID="+cfgSID+"+FID=1";
else 
need_logout=0;
if((typeof need_logout=="undefined")||need_logout)
query_string+="+OP=LOGOUT";
if(typeof ahdtop!="object"){
for(var currtop=window;
currtop!=currtop.parent&&
currtop.name!="AHDtop";
currtop=currtop.parent);
currtop.document.location.replace(query_string);
}
else{
AHD_logout_requested=true;
if(typeof ahdtop.close_edit_window=="object")
{
var ret=confirm(msgtext(263));
if(ret)
ahdtop.close_edit_window.skip=1;
else 
return;
}
else 
ahdtop.close_edit_window=new CloseEditWindow(query_string,0);
var ret=close_all_windows(0,1);
if(ret==2)
{
AHD_logout_requested=false;
return;
}
if(ret==1&&
typeof ahdtop.close_edit_window=="object")
{
ahdtop.close_edit_window.skip=1;
close_all_windows(1);
}
window.name="AHDlogin";
ahdtop=void(0);
setTimeout("window.document.location.replace('"+query_string+"')",100);
}
}
}
function CloseEditWindow(query_string,confirm)
{
this.query_string=query_string;
this.skip=0;
this.confirm=confirm;
this.edit_windows=new Array();
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object")
ahdtop.close_edit_window=this;
}
CloseEditWindow.prototype.add_window=function(win)
{
this.edit_windows[this.edit_windows.length]=win;
}
CloseEditWindow.prototype.next_window=function(win_name)
{
var idx=this.edit_windows.length-1;
if(typeof win_name=="string")
{
this.edit_windows[idx]=0;
this.edit_windows.length=idx;
window.status="Window, "+win_name+", closed.";
idx--;
}
if(this.edit_windows.length>0)
{
var edit_win=this.edit_windows[idx];
if((typeof edit_win.cai_main!="undefined")&&
(typeof edit_win.cai_main.ImgBtnDoCancel!="undefined")&&
edit_win.cai_main.ImgBtnDoCancel())
{
if(typeof edit_win.gobtn=="object")
edit_win.gobtn.form_cancelled=true;
}
else 
{
edit_win.close();
this.next_window(edit_win.name);
return;
}
window.status="Close widnow, "+edit_win.name+".";
}
else 
{
window.name="AHDlogin";
ahdtop=void(0);
setTimeout("window.document.location.replace('"+this.query_string+"')",100);
}
}
function close_all_windows(f_force,f_require_ret)
{
var force=0;
if(typeof f_force=="number")
force=f_force;
var require_ret=0;
if(typeof f_require_ret=="number")
require_ret=f_require_ret;
var ret_code=0;
var ahdtop=get_ahdtop(true);
if(typeof ahdtop=="object")
{
if(window.name!="AHDtop"&&
ahdtop.name=="AHDtop")
ahdtop.close_all_windows(force);
else
{
ahdtop.closing_all_windows=true;
var i=0;
var window_name=new Array();
for(var registered_name in ahdtop.AHD_Windows)
window_name[i++]=registered_name;
for(i=window_name.length-1;i>=0;i--)
{
var ahdwin=ahdtop.AHD_Windows[window_name[i]];
if(typeof ahdwin=="object"&&
typeof ahdwin.name=="string"&&
typeof ahdwin.closed=="boolean"&&
!ahdwin.closed)
{
if((typeof ahdtop.close_edit_window=="object")&&
!ahdtop.close_edit_window.skip&&
(typeof ahdwin.cai_main!="undefined")&&
(ahdwin.cai_main.edit_form==1))
{
ahdtop.close_edit_window.add_window(ahdwin);
continue;
}
if(!ahdtop.AHD_logout_requested&&(ahdwin.name==popup_window_name("log_reader")))
{
continue;
}
ahdwin.name="goner";
delete ahdtop.AHD_Windows[window_name[i]];
if(typeof ahdwin.cai_main=="object"){
if(!force&&
typeof ahdwin.cai_main.ImgBtnDoCancel!="undefined"&&
ahdwin.cai_main.ImgBtnDoCancel()){
if(typeof ahdwin.gobtn=="object")
ahdwin.gobtn.form_cancelled=true;
continue;
}
ahdwin.cai_main.name="goner";
}
ahdwin.ahdtop=null;
ahdwin.close();
}
}
if((typeof ahdtop.close_edit_window=="object")&&
!ahdtop.close_edit_window.skip&&
(ahdtop.close_edit_window.edit_windows.length>0))
{
var temp="window";
var length=ahdtop.close_edit_window.edit_windows.length;
if(length>1)temp="windows";
var ret=confirm(msgtext(264,""+length+" "+temp,temp));
if(ret)
ret_code=1;
else 
ret_code=2;
}
ahdtop.closing_all_windows=false;
if(ret_code==2)
{
for(i=0;i<ahdtop.close_edit_window.edit_windows.length;i++)
{
var tmp_win=ahdtop.close_edit_window.edit_windows[i];
if(typeof tmp_win=="object"&&
typeof tmp_win.name=="string"&&
typeof tmp_win.closed=="boolean"&&
!tmp_win.closed)
{
tmp_win.focus();
break;
}
}
ahdtop.close_edit_window=void(0);
}
else 
ahdtop.focus();
if(typeof ahdtop.debugShowWindow=="object"&&
typeof ahdtop.debugShowWindow.closed=="boolean"&&
!ahdtop.debugShowWindow.closed)
ahdtop.debugShowWindow.close();
}
}
if(require_ret)
return ret_code;
}
function session_timeout(sid)
{
if(typeof cfgCgi=="string")
{
if(typeof workframe=="object"&&
typeof sid=="string"&&sid!="0"){
var url=cfgCgi+"?SID="+sid+
"+FID=0+ENDSESSION=1";
workframe.location.href=url;
}
AHD_logout_requested=true;
setTimeout("finish_session_timeout();",10);
}
}
function finish_session_timeout()
{
var winNames=new Array();
for(var name in ahdtop.AHD_Windows)
winNames[winNames.length]=name;
for(var i=winNames.length-1;i>=0;i--){
var win=AHD_Windows[winNames[i]];
if(typeof win=="object"&&!win.closed){
win.sessionEnded=true;
win.close();
}
}
window.name="";
if(typeof window.document.propFormName!="string"||
window.document.propFormName!="login.htmpl")
{
var url=cfgCgi;
if(typeof propPortalSession=="string"&&
propPortalSession.length>0)
url+="?PortalSession="+propPortalSession;
window.document.location.replace(url);
}
}
function popup_window_list()
{
var dflt_width=260;
var dflt_margin=10;
var w_name=get_popup_window_name("ahdwlist");
var url=ahdtop.usdHTML["wlist"];
var features="scrollbars=yes"+
",resizable=yes"+
",width="+dflt_width+
",height=300";
var x_posn=window.screen.availWidth-dflt_width-dflt_margin;
if(_browser.supportsLayers==true)
features+=",screenX="+x_posn+",screenY="+dflt_margin;
else
features+=",left="+x_posn+",top="+dflt_margin;
var listwin=window.open(url,w_name,features);
register_window(listwin);
listwin.opener=ahdtop;
listwin.focus();
}
function refresh_window_list()
{
if(typeof ahdtop!="object"||ahdtop==null||typeof ahdtop.AHD_Windows!="object")
return;
var winlist=ahdtop.AHD_Windows[popup_window_name("ahdwlist")];
if(typeof winlist=="object"&&
typeof winlist.closed=="boolean"&&
!winlist.closed)
winlist.list_windows();
else
cleanup_window_list();
}
function cleanup_window_list()
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&ahdtop!=null){
var i=0;
var window_name=new Array();
for(var registered_name in ahdtop.AHD_Windows)
window_name[i++]=registered_name;
for(i=0;i<window_name.length;i++)
{
if(window_name[i]!=popup_window_name("ahdwlist"))
{
var ahdwin=ahdtop.AHD_Windows[window_name[i]];
if(typeof ahdwin!="object"||
typeof ahdwin.name!="string"||
typeof ahdwin.closed!="boolean"||
ahdwin.closed)
delete ahdtop.AHD_Windows[window_name[i]];
}
}
}
}
function focus_window(window_name)
{
var ahdtop=get_ahdtop(true);
if(typeof ahdtop=="object")
{
var win=ahdtop.AHD_Windows[window_name];
if(typeof win=="object"&&
typeof win.closed=="boolean"&&
!win.closed)
win.focus();
}
}
function focus_main_window()
{
var ahdtop=get_ahdtop(true);
if(typeof ahdtop=="object")
ahdtop.focus();
}
function copy_vals_for_accumulate(cai_main)
{
if(typeof cai_main.setEditElements=="undefined")
return;
if(typeof est_cost!="undefined")
cai_main.setEditElements("SET.est_cost",est_cost,1);
if(typeof cost!="undefined")
cai_main.setEditElements("SET.cost",cost,1);
if(typeof est_total_time!="undefined")
cai_main.setEditElements("SET.est_total_time",est_total_time,1);
if(typeof actual_total_time!="undefined")
cai_main.setEditElements("SET.actual_total_time",actual_total_time,1);
}
function switchToDetail(factory,id,reload,GLType,popup_url)
{
if(factory.match(/^(\w+):(\d+)$/)){
var persid=factory;
factory=RegExp.$1;
id=RegExp.$2;
}
else{
var persid=factory+":"+id;
}
if(typeof reload!="boolean")
reload=true;
var dtlWin=void(0);
if(typeof ahdtop=="object"&&ahdtop!=null){
ahdwin=ahdtop.detailForms[persid];
if(typeof ahdwin!="object"||
ahdwin==null||
typeof ahdwin.closed!="boolean"||
ahdwin.closed||
typeof ahdwin.name!="string"){
ahdwin=null;
if(typeof GLType=="string"&&
GLType=="secondary"){
var edit_windows=getEditWindows(persid);
for(var i=0;i<edit_windows.length;i++){
var w=edit_windows[i];
if(typeof w._dtl=="object"&&
!w._dtl.secondary){
ahdwin=w.parent;
ahdwin.top_splash.popupAfterSave=true;
break;
}
}
}
}
if(ahdwin!=null){
var cai_main=ahdwin.cai_main;
if(typeof cai_main!="object"||cai_main==null)
cai_main=ahdwin.content;
if(typeof cai_main=="object"&&
cai_main!=null){
var url=cai_main.document.URL;
if(reload&&typeof cai_main._dtl!="undefined"&&
cai_main._dtl.edit)
{
if(typeof for_accumulate!="undefined"&&
for_accumulate)
{
copy_vals_for_accumulate(cai_main);
}
if(typeof AlertMsg=="string"&&
AlertMsg!=""&&
typeof cai_main.AlertMsg!="undefined"&&
typeof cai_main.detailValidate!="undefined")
{
cai_main.AlertMsg=AlertMsg;
cai_main.detailValidate(1);
return true;
}
}
if(url.indexOf("?")!=-1&&
url.indexOf("OP=CANCEL")==-1&&
url.indexOf("OP=DELETE")==-1&&
url.indexOf("OP=UPDATE")==-1&&
typeof cai_main.propFormName3=="string"&&
cai_main.propFormName3.toString()!="edit"){
if(reload){
if(typeof AlertMsg=="string"&&
AlertMsg!=""){
if(url.indexOf("KEEP.AlertMsg=")!=-1)
url=url.replace(/\+KEEP.AlertMsg=[^\+]*/,"");
url+="+KEEP.AlertMsg="+AlertMsg;
}
cai_main.set_action_in_progress(ACTN_FILLFORM);
cai_main.location.href=url;
}
if(typeof top.workframe=="undefined"||
typeof top.workframe.SkipInitialFocus=="undefined"||
"1"!=top.workframe.SkipInitialFocus){
if(typeof popup_url=="string"&&
popup_url.indexOf("OP=UPDATE")!=-1&&
typeof cai_main._dtl=="object"&&
!cai_main._dtl.edit)
cai_main.pdm_submit('main_form','UPDATE',
ACTN_LOADFORM);
var focusCmd="if ( typeof window.cai_main == 'object' && typeof window.cai_main.detailFocus1st != 'undefined' ) window.cai_main.detailFocus1st(); else window.focus();";
ahdwin.setTimeout(focusCmd,250);
}
return true;
}
if(typeof dtlWin!="object")
dtlWin=cai_main;
}
}
}
if(reload){
var fid=(typeof dtlWin=="object"?dtlWin.cfgFID:cfgFID);
var url=cfgCgi+
"?SID="+cfgSID+
"+FID="+fid+
"+OP=SHOW_DETAIL"+
"+FACTORY="+factory+
"+PERSID="+escape(persid);
if(typeof AlertMsg=="string"&&
AlertMsg!="")
url+="+KEEP.AlertMsg="+AlertMsg;
}
if(typeof dtlWin=="object"){
if(reload){
if(typeof dtlWin.propFormName3=="string"&&
dtlWin.propFormName3=="edit")
alertSecondaryUpd(dtlWin,GLType);
else{
dtlWin.set_action_in_progress(ACTN_FILLFORM)
if(typeof dtlWin.parent=="object"&&
typeof dtlWin.parent.name=="string"&&
dtlWin.parent.name!="AHDtop")
url+="+KEEP.POPUP_NAME="+dtlWin.parent.name;
dtlWin.document.location.href=url;
}
}
if(typeof top.workframe=="undefined"||
typeof top.workframe.SkipInitialFocus=="undefined"||
"1"!=top.workframe.SkipInitialFocus){
if(typeof popup_url=="string"&&
popup_url.indexOf("OP=UPDATE")!=-1&&
typeof dtlWin._dtl=="object"&&
!dtlWin._dtl.edit)
dtlWin.pdm_submit('main_form','UPDATE',ACTN_LOADFORM);
var focusCmd="window.focus();";
if(typeof dtlWin._dtl=="object")
{
var dtlwin_str="window."+dtlWin.name;
focusCmd="if ( typeof "+dtlwin_str+" == 'object' && typeof "+dtlwin_str+".detailFocus1st != 'undefined' ) "+dtlwin_str+".detailFocus1st(); else window.focus();";
}
dtlWin.parent.setTimeout(focusCmd,500);
}
return true;
}
if(reload){
if(typeof window.parent.top_splash=="object"&&
typeof window.parent.top_splash.popupAfterSave=="boolean"&&
window.parent.top_splash.popupAfterSave)
ahdtop.popupWithURL(url);
else
display_new_page(window.document.location,url);
}
else if(typeof popup_url!="string"){
if(window.parent.name!="content")
window.parent.close();
}
else{
var features="directories=no"+
",location=no"+
",menubar=no"+
",status=no";
preparePopup(popup_url,"",features);
return true;
}
return false;
}
function alertSecondaryUpd(win,GLType)
{
if(typeof GLType=="string"&&
GLType=="secondary"&&
typeof win._dtl=="object"){
var alertmsg=win.document.getElementById("alertmsg");
var alertmsgText=win.document.getElementById("alertmsgText");
if(alertmsg!=null&&alertmsgText!=null){
var msg=alertmsgText.innerHTML;
if(typeof win._dtl.secUpdCnt!="number")
win._dtl.secUpdCnt=1;
else{
msg=msg.replace(msgtext(402,win._dtl.secUpdCnt),"");
++win._dtl.secUpdCnt;
}
if(msg.length>0)
msg+="<BR>"+msgtext(402,win._dtl.secUpdCnt);
else
msg=msgtext(402,win._dtl.secUpdCnt);
alertmsgText.innerHTML=msg;
alertmsg.style.display="block";
win.adjScrollDivHeight();
}
}
}
var bOverrideDisableRightClick=false;
function disable_right_click_handler(e)
{
var mouse_event=0;
if(_browser.isIE==true)
{
mouse_event=event.button;
if(typeof system_doDown=="function")
system_doDown();
}
else 
mouse_event=e.which;
if(!bOverrideDisableRightClick&&
(mouse_event==2||
mouse_event==3))
{
var alert_msg="";
if(typeof propFormName=="string")
alert_msg=ahdtop.msgtext_with_pfx(183,propFormName);
if(typeof __menuBar!="undefined")
alert_msg+=ahdtop.msgtext_with_pfx(74);
alert(alert_msg);
return false;
}
if(_browser.supportsLayers==true)
{
document.routeEvent(e);
}
return true;
}
function CAisdPrint()
{
setScrollOverflow('visible');
if(typeof window.parent.frames['cai_main']=="object")
window.parent.frames['cai_main'].print();
else if(typeof window.parent.frames['content']=="object")
window.parent.frames['content'].print();
setScrollOverflow('auto');
}
var rClickMenu=void(0);
function disable_right_click(showMenu)
{
if(typeof ContextMenu=="undefined"||!(_browser.isIE55||_browser.geckoGetRv()>=1.0001)){
document.onmousedown=disable_right_click_handler;
if(!_browser.isIE&&!_browser.supportsLayers)
document.captureEvents(Event.MOUSEDOWN);
}
else{
document.oncontextmenu=showRClickMenu;
if(typeof showMenu!="boolean"||showMenu){
if(typeof currDocument!="object")
currDocument=document;
if(typeof cfgCAISD!="string"||
typeof cfgUserType!="string"){
var ahdtop=get_ahdtop();
if(typeof ahdtop!="object"||ahdtop==null)
return;
cfgCAISD=ahdtop.cfgCAISD;
cfgUserType=ahdtop.cfgUserType;
}
rClickMenu=new ContextMenu("rClickMenu");
if(typeof cfgProductName!="string")
cfgProductName="Unicenter ServicePlus Service Desk";
var formName="";
if(typeof propFormName=="string")
formName=" "+propFormName;
rClickMenu.addItem(msgtext(169,cfgProductName),
"popup_window('about','help_about.htmpl',467,275,'ahdmenu=no,scrollbars=no,resizable=no')");
rClickMenu.addItem(msgtext(123,formName),"CAisdPrint()");
rClickMenu.addItem(msgtext(124),"refreshForm()");
rClickMenu.addItem(msgtext(167),
"help_on_form('home')");
if(typeof propFormName=="string")
rClickMenu.addItem(msgtext(168),
"help_on_form(self.propFormName)");
rClickMenu.finish();
}
}
}
function showRClickMenu(evt)
{
if(typeof event=="object")
evt=event;
if(evt.ctrlKey)
return true;
if(typeof rClickMenu=="object")
rClickMenu.show(evt,"",0);
return false;
}
function setWindowTitle(title)
{
var win;
for(win=self;typeof win.parent=="object"&&typeof win.parent.name=="string"&&win!=win.parent;win=win.parent);
if(typeof cfgFormTitle!="string"||
cfgFormTitle.length==0){
if(typeof title!="string")
title="";
}
else{
if(typeof title!="string"||
title.length==0)
title=cfgFormTitle;
else if(typeof window.parent=="object"&&
window.parent==get_ahdtop())
title=cfgFormTitle+" - "+title;
else
title=title+" - "+cfgFormTitle;
}
win.document.title=title;
document.write("<TITLE>"+title+"</TITLE>");
if(_browser.supportsLayers)
win.onresize=NS_onResize;
}
function NS_onResize(e)
{
var win;
for(win=self;typeof win.parent=="object"&&win!=win.parent;win=win.parent);
var mb=win.frames["menubar"].document;
if(typeof mb=="object"&&mb!=null){
mb.location.reload();
var url=self.document.URL;
if(url.indexOf("?")==-1||
url.indexOf("OP=UPDATE")!=-1||
url.indexOf("OP=CREATE")!=-1||
url.indexOf("OP=NEW")!=-1||
url.indexOf("OP=DELETE")!=-1)
alertmsg(82);
else
self.document.location.reload();
}
}
function std_head_setup(busy,forLrel)
{
if(busy!="no")
set_action_in_progress(ACTN_LOADFORM,false);
if(typeof parent.gobtn=="object"&&
typeof parent.gobtn.form_cancelled=="boolean"&&
parent.gobtn.form_cancelled&&
typeof parent.cai_main=="object")
parent.window.close();
if(_browser.isUnix==true)
document.write("<link rel='stylesheet' type='text/css' href='"+
cfgCAISD+"/css/unix.css'>\n");
if(typeof ahdtop=="object"&&ahdtop!=null&&
typeof ahdtop.popup_req_time=="object"){
formCheckpoint=new Object();
if(typeof parent.gobtn=="object"&&
typeof parent.gobtn.requestTime=="number"){
formCheckpoint["request"]=new Date(parent.gobtn.requestTime);
parent.gobtn.requestTime=void(0);
}
else if(window.name=="cai_main"&&
parent.location.search.match(/POPUP_URLIX=(\d+)/)&&
typeof ahdtop.popup_req_time[RegExp.$1]!="undefined"){
formCheckpoint["request"]=new Date(ahdtop.popup_req_time[RegExp.$1]);
ahdtop.popup_req_time[RegExp.$1]=void(0);
}
formCheckpoint["load"]=new Date();
}
if(typeof form_title!="string")
form_title="";
show_header=(form_title.length>0);
cfgIsCS=false;
cfgAllowPopupResize=true;
__search_filter=void(0);
timeoutId=0;
busygifLayer=void(0);
currDocument=document;
ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&ahdtop!=null){
cfgCAISD=ahdtop.cfgCAISD;
cfgCgi=ahdtop.cfgCgi;
cfgSID=ahdtop.cfgSID;
cfgProductName=ahdtop.cfgProductName;
cfgProductID=ahdtop.cfgProductID;
cstID=ahdtop.cstID;
cfgUserType=ahdtop.cfgUserType;
cfgGuestUser=ahdtop.cfgGuestUser;
cfgARGISurl=ahdtop.cfgARGISurl;
cfgLdapEnabled=ahdtop.cfgLdapEnabled;
cfgCIurl=ahdtop.cfgCIurl;
cfgHTurl=ahdtop.cfgHTurl;
cfgETRUSTurl=ahdtop.cfgETRUSTurl;
propIsITIL=ahdtop.propIsITIL;
cfgAnyContact=ahdtop.cfgAnyContact;
cfgSearchStr=ahdtop.cfgSearchStr;
cfgAccessReqMgr=ahdtop.cfgAccessReqMgr;
cfgAccessChgMgr=ahdtop.cfgAccessChgMgr;
cfgAccessIssMgr=ahdtop.cfgAccessIssMgr;
cfgAccessAdmin=ahdtop.cfgAccessAdmin;
cfgAccessInventory=ahdtop.cfgAccessInventory;
cfgAccessRef=ahdtop.cfgAccessRef;
cfgAccessNotify=ahdtop.cfgAccessNotify;
cfgAccessSecurity=ahdtop.cfgAccessSecurity;
cfgCgiReportScript=ahdtop.cfgCgiReportScript;
cfgUserAuth=ahdtop.cfgUserAuth;
cfgUserid=ahdtop.cfgUserid;
cfgDateFormat=ahdtop.cfgDateFormat;
cfgCIEbrUrl=ahdtop.cfgCIEbrUrl;
cfgFaqInstalled=ahdtop.cfgFaqInstalled;
cfgCIEbrInstalled=ahdtop.cfgCIEbrInstalled;
}
else{
cfgCAISD="/CAisd";
cfgCgi="";
cfgSID="";
cfgProductName="Unicenter ServicePlus Service Desk";
cfgProductID="ahd";
cstID="0";
cfgUserType="analyst";
cfgGuestUser="0";
cfgARGISurl="";
cfgLdapEnabled="0";
cfgCIurl="";
cfgHTurl="";
cfgETRUSTurl="";
propIsITIL="0";
cfgAnyContact="0";
cfgAccessReqMgr="1";
cfgAccessChgMgr="1";
cfgAccessIssMgr="1";
cfgAccessAdmin="1";
cfgAccessInventory="1";
cfgAccessRef="1";
cfgAccessNotify="1";
cfgAccessSecurity="1";
cfgCgiReportScript="";
cfgUserAuth="2";
cfgUserid="userid";
cfgDateFormat="YYYY.MM.DD hh:mm a(am,pm)";
cfgCIEbrUrl="";
cfgFaqInstalled="0";
cfgCIEbrInstalled="0";
}
UserAuth=cfgUserAuth;
if(window.name=="workframe"){
var w=parent.cai_main;
if(typeof w!="object"||w==null)
w=parent.content;
if(typeof w=="object"&&w!=null)
w.set_action_in_progress(0);
}
if(form_title.length>0)
setWindowTitle(gsub(form_title,"<BR>"," "));
if(typeof window.parent.refresh_window_list=="function")
window.parent.refresh_window_list();
if(!_browser.supportsLayers&&
typeof uspKeydownHandler!="undefined")
document.onkeydown=uspKeydownHandler;
if(forLrel=="1"&&
propFormName1=="update"&&
propFormName2=="lrel"&&
typeof window.opener!="object")
{
window.opener=parent.opener;
}
}
var curr_form_action=0;
var resumeAction=void(0);
var ACTN_COMPLETE=0;
var ACTN_SAVE=1;
var ACTN_CANCEL=2;
var ACTN_LOADPROP=3;
var ACTN_FILLFORM=4;
var ACTN_SEARCH=5;
var ACTN_AUTOFILL=6;
var ACTN_LOADFORM=7;
var ACTN_UPDATE_COUNTS=8;
function set_action_in_progress(action,setReqTime)
{
curr_form_action=action;
var gobtn=void(0);
if(window.name=="gobtn")
gobtn=window;
else if(typeof parent.gobtn=="object")
gobtn=parent.gobtn;
if(typeof parent.menubar=="object")
menubar=parent.menubar;
if(typeof gobtn=="object"){
var busygifLayer=gobtn.document.getElementById("busygifLayer");
if(busygifLayer!=null){
var e1=null;
if(typeof parent.cai_main=="object"||
window.parent.name==popup_window_name("profile_browser")||
ahdtop.propInitialPopup=="1")
e1=menubar.document.getElementById("idMenuCloseWin");
var e2=gobtn.document.getElementById("gobtnDiv");
if(action==0){
busygifLayer.style.display="none";
if(e1!=null)
e1.style.display="block";
if(e2!=null)
e2.style.display="block";
if(typeof resumeAction!="undefined"){
if(typeof resumeAction=="string"){
var curr_resume_action=resumeAction;
resumeAction=void(0);
if(curr_resume_action.length>0)
eval(curr_resume_action);
}
}
}
else{
if(e1!=null)
e1.style.display="none";
if(e2!=null)
e2.style.display="none";
busygifLayer.style.display="block";
if(typeof setReqTime=="undefined"||setReqTime)
gobtn.requestTime=(new Date()).getTime();
}
}
}
}
function action_in_progress()
{
if(curr_form_action==ACTN_COMPLETE)
return false;
var ahdtop=get_ahdtop();
if(typeof ahdtop=="undefined")
return false;
if(typeof ahdtop.AHD_logout_requested!="undefined"&&
ahdtop.AHD_logout_requested)
return false;
switch(curr_form_action){
case 1:
alertmsg(172);
return true;
case 2:
alertmsg(173);
return true;
case 3:
alertmsg(174);
return true;
case 4:
alertmsg(179);
return true;
case 5:
alertmsg(180);
return true;
case 6:
alertmsg(226);
return true;
case 7:
alertmsg(233);
return true;
case 8:
alertmsg(240);
return true;
default:
alertmsg(175,curr_form_action);
return true;
}
}
function getTopFrame()
{
var w=window;
while(w!=w.parent&&
typeof w.parent.name=="string"){
w=w.parent;
if(w.name=="AHDtop")
break;
}
if(typeof w.actionKey!="object"){
w.actionKey=new Array();
w.actionKey[0]="";
}
return w;
}
function getActionKey()
{
var w=getTopFrame();
return w.actionKey;
}
var TAB=9;
var ENTER=13;
var CTRL=17;
var ALT=18;
var ESC=27;
var PAGE_UP=33;
var PAGE_DOWN=34;
var END=35;
var HOME=36;
var ARROW_LEFT=37;
var ARROW_RIGHT=39;
var ARROW_UP=38;
var ARROW_DOWN=40;
function uspKeydownHandler(e)
{
var altKey;
var ctrlKey;
var shiftKey=false;
var key_pressed;
var active_element;
if(_browser.supportsLayers){
altKey=e.modifiers&Event.ALT_MASK;
ctrlKey=e.modifiers&Event.CONTROL_MASK;
key_pressed=e.which;
active_element=e.target;
}
else if(_browser.isIE){
e=window.event;
altKey=e.altKey;
ctrlKey=e.ctrlKey;
shiftKey=e.shiftKey;
key_pressed=e.keyCode;
active_element=document.activeElement;
}
else{
altKey=e.altKey;
ctrlKey=e.ctrlKey;
shiftKey=e.shiftKey;
key_pressed=e.keyCode;
active_element=e.target;
}
if(typeof tempKeyDownHandler=="function"){
if(!tempKeyDownHandler(active_element,key_pressed,
shiftKey,altKey)){
if(_browser.isIE)
e.returnValue=false;
return false;
}
}
if(key_pressed==ENTER&&
typeof active_element.type=="string"&&
active_element.type!="select-one"&&
active_element.type!="select-multiple"&&
active_element.type!="textarea"&&
typeof imgBtnDefault=="object"&&
typeof imgBtnDefault.enabled=="boolean"&&
imgBtnDefault.enabled){
var len=document.forms.length;
var i;
for(var i=0;i<document.forms.length;i++){
var f=document.forms[i];
for(var j=0;j<f.length;j++)
if(f.elements[j]==active_element){
if(!_browser.supportsLayers&&
typeof imgBtnDefault.obj=="object")
imgBtnDefault.obj.className="clsButtonDown";
if(typeof active_element.onchange=="function")
active_element.onchange();
if(_browser.supportsLayers&&
typeof active_element.onblur=="function")
active_element.onblur();
eval(imgBtnDefault.func);
if(imgBtnDefault.nohighlight&&
!_browser.supportsLayers&&
typeof imgBtnDefault.obj=="object")
imgBtnDefault.obj.className="clsButtonEnabled";
if(_browser.isIE)
e.returnValue=false;
return false;
}
}
}
/* SDT 21792
*Netscape 7 doesn't like the ESC key, we've run into what appears to
*be some sort of race condition.
*Besides,the ESC key has special meaning in a web browser:it is supposed
*to cancel whatever action is currently being executed.
*So...we don't do this stuff anymore.
if(key_pressed==ESC&&
typeof active_element.type=="string"&&
typeof imgBtnCancel=="object"&&
typeof imgBtnCancel.enabled=="boolean"&&
imgBtnCancel.enabled){
var len=document.forms.length;
var i;
for(var i=0;i<document.forms.length;i++){
var f=document.forms[i];
for(var j=0;j<f.length;j++)
if(f.elements[j]==active_element){
ImgBtnDoCancel();
if(_browser.isIE)
e.returnValue=false;
return false;
}
}
}
*/
return true;
}
var kdHandlerStack=new Array();
function setTempKeyDownHandler(func)
{
if(typeof func!="function"||func==null){
if(kdHandlerStack.length==0){
tempKeyDownHandler=null;
}
else{
tempKeyDownHandler=kdHandlerStack[kdHandlerStack.length-1];
delete kdHandlerStack[kdHandlerStack.length-1];
}
}
else{
if(typeof tempKeyDownHandler=="function"&&
tempKeyDownHandler!=null)
kdHandlerStack[kdHandlerStack.length]=tempKeyDownHandler;
tempKeyDownHandler=func;
}
}
function registerActionKey(key,label,func)
{
var my_key="";
var actionKey=getActionKey();
var uc_label=label.toUpperCase();
var args=new Array();
for(var j=3;j<arguments.length;j++)
args[j-3]=arguments[j];
if(typeof actionKey=="object"){
var in_use="";
var test_keys=actionKey[0].toUpperCase();
for(var i=0;i<test_keys.length;i++){
var test_key=test_keys.substr(i,1);
var actKey=actionKey[test_key.charCodeAt(0)];
if(typeof actKey=="object"&&
typeof actKey.win=="object"&&
typeof actKey.win.actKeyInUse=="string"&&
actKey.win.actKeyInUse.indexOf(test_key)!=-1)
in_use+=test_key;
else
actionKey[test_key.charCodeAt(0)]=void(0);
}
actionKey[0]=in_use;
my_key=bestKey(key,label,in_use,actionKey,func,args);
if(my_key!=" "){
actionKey[0]=in_use+my_key;
if(typeof window.actKeyInUse!="string"){
window.actKeyInUse="";
window.actKeyOrigUnload=window.onunload;
window.onunload=actKeyWinUnload;
}
window.actKeyInUse+=my_key;
var actKey=new Object;
actionKey[my_key.charCodeAt(0)]=actKey;
actKey.args=new Array;
actKey.label=label;
actKey.win=window;
if(typeof func=="function"){
actKey.func=func;
actKey.activated=false;
actKey.args=args;
}
else{
actKey.func=void(0);
actKey.activated=true;
}
}
}
return my_key;
}
function actKeyWinUnload()
{
var actionKey=getActionKey();
for(var i=0;i<actKeyInUse.length;i++){
var test_key=actKeyInUse.substr(i,1);
actionKey[test_key.charCodeAt(0)]=void(0);
}
if(actKeyOrigUnload!=null)
actKeyOrigUnload();
}
function bestKey(key,label,in_use,actionKey,func,args)
{
var uc_label=label.toUpperCase();
in_use=in_use.toUpperCase();
var key_suggested=false;
var key_rejected=false;
if(key.length>0){
key=key.toUpperCase();
if(key.substr(0,1)!="!")
key_suggested=true;
else if(key.length>1){
key_rejected=true;
key=key.substr(1,key.length-1);
}
}
if(key_suggested){
for(var kx=0;kx<key.length;kx++){
var test_key=key.substr(kx,1);
if(uc_label.indexOf(test_key)!=-1){
if(in_use.indexOf(test_key)==-1)
return test_key;
if(typeof actionKey=="object"){
var actKey=actionKey[test_key.charCodeAt(0)];
if(typeof actKey=="object"&&
typeof actKey.label=="string"&&
actKey.label==label&&
actKey.func==func){
if(typeof args!="object")
return test_key;
if(args.length==actKey.args.length){
for(var i=0;i<args.length;i++)
if(args[i]!=actKey.args[i])
break;
if(i==args.length)
return test_key;
}
}
}
}
}
}
var test_key;
var candidate_key=" ";
for(var posn=0;posn<label.length;posn++){
test_key=uc_label.substr(posn,1);
if(key_rejected&&key.indexOf(test_key)!=-1)
continue;
if(test_key.match(/\w/)){
if(in_use.indexOf(test_key)!=-1){
if(typeof actionKey!="object")
continue;
var actKey=actionKey[test_key.toUpperCase().charCodeAt(0)];
if(typeof actKey!="object"||
typeof actKey.label!="string"||
actKey.label!=label||
actKey.func!=func)
continue;
if(typeof args=="object"){
if(args.length!=actKey.args.length)
continue;
for(var i=0;i<args.length;i++)
if(args[i]!=actKey.args[i])
break;
if(i<args.length)
continue;
}
}
if(test_key==label.substr(posn,1))
return test_key;
if(candidate_key==" ")
candidate_key=test_key;
}
}
return candidate_key;
}
function fmtLabelWithActkey(label,actkey,getoldactkeyvalue)
{
var text=label;
if(typeof getoldactkeyvalue=="undefined")
{
getoldactkeyvalue="";
}
if(getoldactkeyvalue.indexOf("*")==-1)
{
if(typeof actkey=="string"&&
actkey.length==1&&
actkey!=" "){
var posn=-1;
var actkeyLow=actkey.toLowerCase();
for(var i=0;i<label.length;i++){
var c=label.substr(i,1);
if(c=='<'){
i=label.indexOf('>',i);
if(i==-1)
break;
}
if(c==actkey){
posn=i;
break;
}
if(c==actkeyLow&&posn==-1)
posn=i;
}
if(posn!=-1){
if(posn==0)
text="";
else
text=label.substr(0,posn);
text+="<U>"+label.substr(posn,1)+"</U>";
if(posn<label.length-1)
text+=label.substr(posn+1,label.length-posn-1);
}
}
}
else
{
text+=" (<U>"+actKey+"</U>)";
}
return text;
}
function activateActionKeys()
{
if(!_browser.supportsLayers){
var keys="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
for(var i=0;i<keys.length;i++){
var key=keys.substr(i,1);
var text="<A ACCESSKEY="+key;
if(_browser.isIE)
text+=" HREF='javascript:void(0)'"+
" ONFOCUS='altKeyPressed(\""+key+"\")'></A>";
else
text+=" HREF='Javascript:altKeyPressed(\""+key+"\")'></A>";
document.writeln(text);
}
}
}
function altKeyPressed(key)
{
var actionKey=getActionKey();
if(typeof actionKey=="object"){
var code=key.toUpperCase().charCodeAt(0);
var actkey=actionKey[code];
if(typeof actkey=="object"&&
typeof actkey.func=="function"&&
typeof actkey.win=="object"&&
typeof actkey.win.actKeyInUse=="string"&&
actkey.win.actKeyInUse.indexOf(key)!=-1){
actkey.win.focus();
var a=actkey.args;
switch(a.length){
case 0:actkey.func();break;
case 1:actkey.func(a[0]);break;
case 2:actkey.func(a[0],a[1]);break;
case 3:actkey.func(a[0],a[1],a[2]);break;
case 4:actkey.func(a[0],a[1],a[2],a[3]);break;
case 5:actkey.func(a[0],a[1],a[2],a[3],a[4]);break;
default:actkey.func(a);break;
}
}
}
window.status='';
}
function bubbleToMainWindow(active_element,keycode,shiftkey)
{
var f=window.parent.content;
if(typeof f!="object")
f=window.parent.cai_main;
if(typeof f!="object")
f=window.parent.page;
if(typeof f=="object"&&
typeof f.tempKeyDownHandler=="function")
return!f.tempKeyDownHandler(active_element,keycode,shiftkey);
return false;
}
var holdingHTMLText=false;
var writingHTMLText=true;
var htmlTextHolder="";
function holdHTMLText(writeText)
{
htmlTextHolder="";
holdingHTMLText=true;
writingHTMLText=(typeof writeText!="boolean"||writeText);
}
function resetHTMLTextHold()
{
htmlTextHolder="";
holdingHTMLText=false;
writingHTMLText=true;
}
function docWrite(text)
{
if(writingHTMLText)
document.write(text);
if(holdingHTMLText)
htmlTextHolder+=text;
}
function docWriteln(text)
{
if(writingHTMLText)
document.writeln(text);
if(holdingHTMLText)
htmlTextHolder+=text+"\n";
}
function popupHTMLText()
{
if(htmlTextHolder.length>0){
var ahdtop=get_ahdtop();
if(typeof ahdtop!="object")
ahdtop=self;
ahdtop.htmlTextHolder=htmlTextHolder;
ahdtop.debugShowWindow=
ahdtop.window.open(cfgCAISD+"/html/debug_show.html",
"debug_show","scrollbars,resizable");
}
}
function getHTMLText(reset)
{
return htmlTextHolder;
}
function startScrollbar(maindiv,bScroll)
{
if(_browser.isIE)
{
var overflow_style="auto";
if((typeof bScroll!="undefined")&&
bScroll)
overflow_style="scroll";
var txt="<DIV ID=scrollbarDiv"+scrollDivCount+
" STYLE='width:100%;overflow:"+
overflow_style+"'>\n";
if(typeof maindiv=='boolean'&&maindiv==true)
txt+="<SCRIPT>\n"+
"var targetdiv = window.document.all.scrollbarDiv"+
scrollDivCount+" ;</SCRIPT>\n";
document.write(txt);
scrollDivCount++;
}
}
function endScrollbar(postScroll)
{
if(typeof postScroll=="number"){
while(postScroll>0&&scrollDivsClosed<scrollDivCount){
docWriteln("</DIV>");
scrollDivsClosed++;
postScroll--;
}
}
else if(scrollDivCount>0){
while(scrollDivsClosed<scrollDivCount){
docWriteln("</DIV>");
scrollDivsClosed++;
}
if(postScrollDivOpen){
docWriteln("</DIV>");
postScrollDivOpen=false;
}
else{
if(typeof postScroll!="boolean")
postScroll=true;
if(postScroll){
docWriteln("<DIV ID=postScrollbarDiv>");
postScrollDivOpen=true;
}
}
}
}
function adjScrollDivHeight()
{
if(!_browser.isIE)
var winHeight=window.innerHeight;
else
var winHeight=document.body.offsetHeight;
if(window==parent)
winHeight-=5;
var e=document.getElementById("postScrollbarDiv");
if(e!=null&&winHeight>(e.offsetHeight+100))
winHeight-=e.offsetHeight;
var divTop=new Array();
for(var i=0;i<scrollDivCount;i++){
var scrollDiv=document.getElementById("scrollbarDiv"+i);
if(scrollDiv!=null)
if(_browser.isIE&&i>0)
divTop[i]=scrollDiv.offsetTop+divTop[i-1];
else
divTop[i]=scrollDiv.offsetTop;
}
for(var i=scrollDivCount-1;i>=0;i--){
var scrollDiv=document.getElementById("scrollbarDiv"+i);
if(scrollDiv!=null){
var h=winHeight-divTop[i];
if(h<=10||(h<=50&&i!=0))
h="";
scrollDiv.style.height=h;
if(typeof h=="number")
winHeight=0;
}
}
}
function setScrollOverflow(val)
{
if(_browser.isIE)
for(var i=0;i<scrollDivCount;i++){
var scrollDiv=document.getElementById("scrollbarDiv"+i);
if(scrollDiv!=null)
scrollDiv.style.overflow=val;
}
}
function dLog()
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"){
if(typeof ahdtop.debugLog=="undefined"){
ahdtop.debugLog=new Array();
ahdtop.debugLogLen=0;
}
var text="";
for(var i=0;i<arguments.length;i++){
var thisArg=""+arguments[i];
if(thisArg.length>0){
if(text.length==0)
text=thisArg;
else
text+=" "+thisArg;
}
}
ahdtop.debugLog[ahdtop.debugLogLen]=text;
ahdtop.debugLogLen++;
}
}
function dLogShow()
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&
typeof ahdtop.debugLog=="object"&&
ahdtop.debugLogLen>0){
var x="";
for(var i=0;i<ahdtop.debugLogLen;i++)
if(i==0)
x=ahdtop.debugLog[i];
else
x+="\n"+ahdtop.debugLog[i];
if(!confirm(x))
ahdtop.debugLogLen=0;
}
}
function focusById(id)
{
var e=document.getElementById(id);
if(typeof e=="object"&&e!=null)
e.focus();
}
function display_new_page(location_obj,url,is_replace)
{
if((typeof parent.name=="string")&&
(parent.name!="AHDtop"))
{
if(url.indexOf("KEEP.POPUP_NAME")<0)
{
if(url.indexOf("?")<0)
url+="?";
else 
url+="+";
url+="KEEP.POPUP_NAME="+parent.name;
}
}
if((typeof is_replace=="undefined")||
!is_replace)
location_obj.href=url;
else 
location_obj.replace(url);
}
function get_next_window_name()
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object")
ahdtop.ahd_window_count++;
return"USD"+(new Date()).getTime();
}
function get_popup_window_name(w_name)
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object")
{
if(typeof ahdtop.manage_popup_windows=="undefined")
return w_name;
if(typeof ahdtop.manage_popup_windows[w_name]!="undefined")
return ahdtop.manage_popup_windows[w_name];
var real_name=get_next_window_name();
ahdtop.manage_popup_windows[w_name]=real_name;
return real_name;
}
return w_name;
}
function popup_window_name(w_name)
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object")
{
if(typeof ahdtop.manage_popup_windows=="undefined")
return w_name;
if(typeof ahdtop.manage_popup_windows[w_name]!="undefined")
return ahdtop.manage_popup_windows[w_name];
}
return w_name;
}
function popup_window_org_name(w_name)
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object")
{
if(typeof ahdtop.manage_popup_windows=="undefined")
return w_name;
for(var popup_name in ahdtop.manage_popup_windows)
{
if(ahdtop.manage_popup_windows[popup_name]==w_name)
return popup_name;
}
}
return w_name;
}
function remove_popup_window_name(w_name)
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&ahdtop!=null)
{
if(typeof ahdtop.manage_popup_windows!="undefined")
{
for(var tmp_name in ahdtop.manage_popup_windows)
{
if(ahdtop.manage_popup_windows[tmp_name]==w_name)
delete ahdtop.manage_popup_windows[tmp_name];
}
}
}
}
function wf_queue_item(url,request_reset,op_name)
{
this.url=url;
this.request_reset=request_reset;
this.op_name=op_name;
}
function wf_delay_item(queue_item,delay,before_queue_cb,arg)
{
var ahdtop=get_ahdtop();
if((typeof ahdtop!="object")||
(typeof ahdtop.wf_delay_list=="undefined"))
{
return;
}
var d_list=ahdtop.wf_delay_list;
this.queue_item=queue_item;
this.before_queue_cb=before_queue_cb;
this.arg=arg;
if((before_queue_cb=="is_popup_window_still_up")&&
(typeof arg=="object")&&
(typeof arg.name=="string"))
this.popup_name=arg.name;
else 
this.popup_name="";
var i;
for(i=0;(i<d_list.length)&&(typeof d_list[i]!="undefined");i++);
d_list[i]=this;
setTimeout("wf_delay_item.queue_it("+i+")",delay);
}
wf_delay_item.queue_it=function(idx)
{
var ahdtop=get_ahdtop();
if((typeof ahdtop!="object")||
(typeof ahdtop.wf_delay_list=="undefined")||
(typeof ahdtop.work_frame_mgr=="undefined"))
{
return;
}
var d_list=ahdtop.wf_delay_list;
var wf_queue=ahdtop.workframe_queue;
var wf_mgr=ahdtop.work_frame_mgr;
if((idx>=0)&&(idx<d_list.length)&&
(typeof d_list[idx]!="undefined"))
{
if(typeof d_list[idx].before_queue_cb!="undefined")
{
var callback=d_list[idx].before_queue_cb+"("+idx+")";
if(eval(callback))
{
d_list[idx]=void(0);
return;
}
}
var item=d_list[idx].queue_item;
if(item.op_name=="ONE_WAY")
{
wf_mgr.issue_oneway_url(item);
}
else 
{
wf_queue[wf_queue.length]=item;
next_workframe();
}
d_list[idx]=void(0);
}
}
function ahdtop_load_workframe(url,delay,op_name,before_queue_cb,arg)
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&
ahdtop!=null&&
typeof ahdtop.load_workframe!="undefined")
ahdtop.load_workframe(url,delay,op_name,before_queue_cb,arg);
}
function Work_Frame(name)
{
this.name=name;
this.url="";
this.op_name="";
this.frame_obj=eval("window."+name);
this.time_stamp=0;
}
Work_Frame.prototype.issue_url=function(queue_item)
{
this.url=queue_item.url;
this.op_name=queue_item.op_name;
this.frame_obj.location.href=this.url;
var dt=new Date();
this.time_stamp=dt.getTime();
}
Work_Frame.prototype.free_me=function()
{
this.url="";
this.op_name="";
this.time_stamp=0;
}
Work_Frame.prototype.is_expired=function()
{
var dt=new Date();
var cur_time=dt.getTime();
if((cur_time-this.time_stamp)>Work_Frame_Manager.work_frame_timeout)
{
this.free_me();
return true;
}
return false;
}
function Work_Frame_Manager()
{
var i;
this.frame_arr=new Array();
if(typeof work_frames=="undefined")return;
if(typeof window.oneway_frame=="undefined")
this.oneway_frame=void(0);
else 
this.oneway_frame=window.oneway_frame;
for(i=0;i<work_frames.length;i++)
{
if(typeof eval("window."+work_frames[i])=="object")
this.frame_arr[i]=new Work_Frame(work_frames[i]);
}
if(typeof cfgWorkFrameTimeout!="undefined")
Work_Frame_Manager.work_frame_timeout=parseInt(cfgWorkFrameTimeout)*1000;
}
Work_Frame_Manager.work_frame_timeout=30000;
Work_Frame_Manager.prototype.free_work_frame=function(op_name)
{
var i;
for(i=0;i<this.frame_arr.length;i++)
{
var frame=this.frame_arr[i];
if(frame.op_name==op_name)
{
frame.free_me();
break;
}
}
}
Work_Frame_Manager.prototype.is_expired=function(op_name)
{
if(typeof free_it=="undefined")
var free_it=0;
for(var i=0;i<this.frame_arr.length;i++)
{
var frame=this.frame_arr[i];
if(frame.op_name==op_name&&
frame.is_expired())
return true;
}
return false;
}
Work_Frame_Manager.prototype.workframe_is_defined=function()
{
return this.frame_arr.length;
}
var NOT_AVAIL=0;
var ISSUED=1;
var NEXT=2;
var REMOVE=3;
Work_Frame_Manager.prototype.issue_url=function(queue_item)
{
var i;
var ret=NOT_AVAIL;
var frame_found=void(0);
for(i=0;i<this.frame_arr.length;i++)
{
var frame=this.frame_arr[i];
frame.is_expired();
if(typeof frame_found=="undefined"&&
frame.url=="")
frame_found=frame;
else 
if(frame.url!=""&&
frame.op_name==queue_item.op_name)
{
if(frame.url==queue_item.url)
{
frame_found=void(0);
ret=REMOVE;
}
else 
{
frame_found=void(0);
ret=NEXT;
}
break;
}
}
if(typeof frame_found=="undefined")
return ret;
frame_found.issue_url(queue_item);
return ISSUED;
}
Work_Frame_Manager.prototype.issue_oneway_url=function(queue_item)
{
if(typeof this.oneway_frame=="undefined")
return;
this.oneway_frame.location.href=queue_item.url;
}
Work_Frame_Manager.prototype.get_op_name=function(url)
{
if(url.match(/FID=0[\D$]+/i))
{
return"ONE_WAY";
}
else 
{
var ret=url.match(/OP=(\w+)/i);
if(ret==null)return"NO_OP";
return ret[1];
}
}
var load_time=0;
function load_workframe(url,delay,op_name,before_queue_cb,arg)
{
var request_reset=0;
if((typeof delay=="string")&&(delay=="request_reset"))
{
var delay=0;
request_reset=1;
}
var ahdtop=get_ahdtop();
if((typeof ahdtop!="object")||
(typeof ahdtop.workframe_queue=="undefined"))
{
return false;
}
var wf_mgr=ahdtop.work_frame_mgr;
if(typeof wf_mgr=="undefined")
{
ahdtop.work_frame_mgr=new ahdtop.Work_Frame_Manager();
wf_mgr=ahdtop.work_frame_mgr;
}
if(!wf_mgr.workframe_is_defined())
return false;
if(typeof op_name=="undefined"||
op_name=="")
var op_name=wf_mgr.get_op_name(url);
var queue_item=new wf_queue_item(url,request_reset,op_name);
if((typeof delay=="number")&&
(delay>0))
{
new wf_delay_item(queue_item,delay,before_queue_cb,arg);
return true;
}
if(op_name=="ONE_WAY")
{
wf_mgr.issue_oneway_url(queue_item);
return true;
}
var wf_queue=ahdtop.workframe_queue;
wf_queue[wf_queue.length]=queue_item;
next_workframe();
return true;
}
function next_workframe(op_name)
{
var ahdtop=get_ahdtop();
if((typeof ahdtop!="object")||
(typeof ahdtop.workframe_queue=="undefined")||
(typeof ahdtop.work_frame_mgr=="undefined"))
{
return;
}
var wf_mgr=ahdtop.work_frame_mgr;
if(typeof op_name!="undefined"&&
op_name!="")
wf_mgr.free_work_frame(op_name);
var wf_queue=ahdtop.workframe_queue;
var i;
for(i=0;(i<wf_queue.length)&&!wf_queue[i].request_reset;i++);
if((i==wf_queue.length)&&
(typeof ahdtop.scoreboard=="object")&&
(typeof ahdtop.scoreboard.request_reset_active=="boolean"))
ahdtop.scoreboard.request_reset_active=false;
if(wf_queue.length==0||
typeof wf_mgr!="object"||
!wf_mgr.workframe_is_defined()){
return;
}
var next_queue_item;
var ret=NOT_AVAIL;
var nodes_to_try=wf_queue.length;
while(nodes_to_try)
{
next_queue_item=wf_queue[0];
ret=wf_mgr.issue_url(next_queue_item);
if(ret==ISSUED||ret==NEXT||ret==REMOVE)
wf_queue=wf_queue.slice(1);
if(ret==ISSUED||ret==NOT_AVAIL)
break;
if(ret==NEXT)
wf_queue[wf_queue.length]=next_queue_item;
nodes_to_try--;
}
ahdtop.workframe_queue=wf_queue;
}
function is_popup_window_still_up(idx)
{
var ahdtop=get_ahdtop(true);
if((typeof ahdtop!="object")||
(typeof ahdtop.wf_delay_list=="undefined"))
return 1;
var item=ahdtop.wf_delay_list[idx];
if(typeof item=="undefined")
return 1;
var win=item.arg;
if(typeof win=="object"&&
typeof win.closed=="boolean"&&
!win.closed)
return 1;
if(item.popup_name!="")
remove_popup_window_name(item.popup_name);
return 0;
}
function build_alertmsg()
{
if(typeof alertmsg_built=="boolean"&&alertmsg_built)
return;
var txt1="<TABLE ID='alertmsg' WIDTH=100% CLASS=alertmsg";
if(!_browser.supportsLayers)
txt1+=" STYLE='display:none'";
txt1+="><TR><TD ID='alertmsgText'>";
var txt2="</TD></TR></TABLE>";
if(window.name=="cai_main"&&
AlertMsg.length==0&&
typeof parent.AlertMsg=="string"&&
parent.AlertMsg.length!=0){
AlertMsg=parent.AlertMsg;
ShowLockCancel=parent.ShowLockCancel;
parent.AlertMsg="";
parent.ShowLockCancel="";
}
var my_top=window;
while(my_top!=my_top.parent&&
typeof my_top.parent.name=="string")
my_top=my_top.parent;
if(typeof AlertMsg!="string"||
AlertMsg.length==0){
if(!_browser.supportsLayers)
docWriteln(txt1+txt2);
var my_top_ori_name=popup_window_org_name(my_top.name);
if(my_top_ori_name.match(/popunder/)){
if(typeof my_top.popunder_callback=="object"||
typeof my_top.popunder_callback=="function")
my_top.popunder_callback(form_title);
my_top.close();
}
}
else{
AlertMsg=AlertMsg.replace(/\&lt;br\&gt;/gi,"<BR>");
if(window.name=="workframe")
alert(AlertMsg);
var my_top_ori_name=popup_window_org_name(my_top.name);
if(my_top_ori_name.match(/popunder/)){
my_top.name="";
register_window(my_top);
my_top.moveTo(10,10);
my_top.resizeTo(popupWidth,popupHeight);
my_top.focus();
if(typeof my_top.popunder_callback=="object"||
typeof my_top.popunder_callback=="function")
my_top.popunder_callback(form_title,AlertMsg);
}
if(_browser.supportsLayers){
if(window.name!="workframe")
docWriteln(txt1+AlertMsg+txt2);
}
else{
txt1=txt1.replace(/none/,"block");
docWriteln(txt1+AlertMsg+txt2);
}
if(typeof ShowLockCancel=="string"&&
ShowLockCancel.length>0&&
ShowLockCancel=="yes"&&
!_browser.supportsLayers){
docWrite('<TABLE WIDTH=100% CLASS=alertmsg>\n'+
'<TR><TD>\n'+
'<form name="RECORD_LOCK_FORM">\n'+
msgtext(320)+
'<INPUT TYPE=CHECKBOX NAME="RECORD_LOCK_DECISION" '+
'onClick=\'setOverRideLock("RECORD_LOCK_FORM", "RECORD_LOCK_DECISION");\'>\n'+
msgtext(321)+
'</form></TD></TR>\n'+
'</TABLE>\n');
}
}
}
/* replace_location_with_forms takes a variable number of parameters.
*Each parameter is expected to be a form.
*The function grabs the first argument and uses the action of that form to start
*the url.
*After that,all of the elements of all of the forms are translated into a single URL.
*When the url is completed,window.location.replace is called.
*Essentially,this should provide the ability to forget that we had an edit form
*in the history.
*/
function replace_location_with_forms()
{
if(arguments.length<=0)
return;
var url=arguments[0].action;
for(var i=0;i<arguments.length;i++)
{
for(var j=0;j<arguments[i].elements.length;j++)
{
if(url.indexOf("?")==-1)
url+="?";
else
url+="&";
url+=arguments[i].elements[j].name+"="+escape(arguments[i].elements[j].value);
}
}
window.location.replace(url);
}
