// Copyright (c) 2003 Computer Associates International, Inc
// ahdmenus.js 1.146.1.11 2003/04/04 01:27:34
var menuActive;
var menuID;
var menuName;
var menuCount=0;
var submenuCount=0;
function addMenuItem(itemName,callExit)
{
menuActive=true;
var menuNameCurr=itemName;
if(typeof callExit=="boolean"&&callExit==true)
{
if(submenuCount>0)
siteMenuitemAdd(menuName);
menuName=menuNameCurr;
var rc=siteMenuMod(menuName);
if(typeof rc=="boolean"||
typeof rc=="int")
menuActive=rc;
else if(typeof rc=="string")
{
if(rc.length==0)
menuActive=false;
else 
menuNameCurr=rc;
}
}
menuName=menuNameCurr;
if(menuActive)
{
menuCount++;
menuID="mn"+menuCount;
if(_browser.isNS==true)
NS_AddMenuItem(menuID,menuName);
else 
Menu_Lib_AddMenuItem(menuID,menuName,"","");
}
submenuCount=0;
}
function addSubMenuItem(itemName,script,callExit)
{
addSubMenuItem_internal(itemName,
"ahdtop."+script,
"content",
callExit);
}
function addSubMenuItem_internal(itemName,script,target,callExit)
{
if(menuActive)
{
var submenuActive=true;
var submenuName=itemName;
if(typeof callExit=="boolean"&&callExit)
{
var rc=siteMenuitemMod(menuName,submenuName);
if(typeof rc=="boolean"|
typeof rc=="int")
submenuActive=rc;
else if(typeof rc=="string")
{
if(rc.length==0)
submenuActive=false;
else 
submenuName=rc;
}
}
if(submenuActive)
{
submenuCount++;
var submenuID=menuID+"_"+submenuCount;
if(_browser.isNS==true)
NS_AddSubMenuItem(submenuID,submenuName,script,target);
else 
Menu_Lib_AddSubMenuItem(submenuID,submenuName,"",script,target);
}
}
}
function EndMenu()
{
if(submenuCount>0)
siteMenuitemAdd(menuName);
siteMenuAdd();
if(_browser.isNS==true)
NS_EndMenu();
else 
Add_Input_Field();
submenuCount=0;
}
var submenu_x_posn=0;
var submenu_y_posn=0;
function NS_AddMenuItem(menuID,menuName)
{
if(menuCount==1)
document.write("<TABLE class='divMenuBar' HEIGHT=30 border=0 cellspacing=0 cellpadding=0><TR><TD>");
if(submenuCount>0)
{
if(_browser.supportsLayers==true)
document.write("</LAYER>");
else
document.write("</DIV>");
submenuCount=0;
}
document.write("<A CLASS='clsMenuBarItem' HREF=\"javascript:void(0)\" "+
"onMouseOver=\"NS_ShowMenu('Menu"+menuCount+
"')\">&nbsp;"+menuName+"&nbsp;</A>");
submenu_x_posn=document.links[document.links.length-1].x;
submenu_y_posn=document.links[document.links.length-1].y+24;
document.write("<SPAN class=\"clsSeparator\">|</SPAN>");
}
function NS_AddSubMenuItem(menuID,menuName,script,target)
{
if(submenuCount==1)
if(_browser.supportsLayers==true)
document.write("<LAYER ID=Menu"+menuCount+
" left='"+submenu_x_posn+
"' top='"+submenu_y_posn+"' width='200'"+
" visibility=hidden bgColor=#9CC2E4"+
" onMouseOut=\"NS_ShowMenu()\""+
" z-index=99>");
else
document.write("<DIV ID=Menu"+menuCount+
" left='"+submenu_x_posn+
"' top='"+submenu_y_posn+"' width='200'"+
" visibility=hidden bgColor=#9CC2E4"+
" onMouseOut=\"NS_ShowMenu()\""+
" z-index=99>");
document.write("<A CLASS='clsSubMenuItem' HREF=\"javascript:"+script+"\"");
if(target!="")
document.write(" target="+target);
document.write(">&nbsp;"+menuName+"</A>");
}
function NS_ShowMenu(tgt)
{
var i;
var filter_timeout_called=false;
for(i=0;i<document.layers.length;i++)
{
var curr=document.layers[i];
if(curr.name.indexOf("Menu")<0)
continue;
if(curr.name==tgt)
{
curr.visibility="show";
if(typeof searchFilterSetTimeout=="function")
{
searchFilterSetTimeout();
filter_timeout_called=true;
}
}
else
{
curr.visibility="hidden";
if(!filter_timeout_called)
{
if(typeof searchFilterClearTimeout=="function")
searchFilterClearTimeout();
filter_timeout_called=true;
}
}
}
}
function NS_EndMenu()
{
if(submenuCount>0)
{
if(_browser.supportsLayers==true)
document.write("</LAYER>");
else
document.write("</DIV>");
submenuCount=0;
}
if(menuCount>0)
{
document.write("</TD><TD WIDTH=90%>&nbsp;</TD></TR></TABLE>");
}
}
var win_width;
var win_height;
function NS_next()
{
var flds=NS_find_form();
}
function NS_find_form()
{
var flds;
var layers=document.layers;
var len=layers.length;
var i;
for(i=0;i<len;i++)
{
if(layers[i].document.forms["menu_flds"])
{
flds=layers[i].document.forms["menu_flds"];
break;
}
}
return flds;
}
function do_openDetail(factory,num,text)
{
var attr_name;
if((factory=="cr")||(factory=="iss"))
attr_name="ref_num";
else if(factory=="chg")
attr_name="chg_ref_num";
else if(factory.match(/^(\w+)\.(\w+)$/)){
factory=RegExp.$1;
attr_name=RegExp.$2;
if(factory=="pb"){
if(attr_name=="id")
profile_browser("cnt:"+num,text);
else
profile_browser("cnt:"+attr_name+":"+num,text);
return;
}
}
else 
{
alertmsg(0);
return;
}
if(attr_name=="ref_num"||
attr_name=="chg_ref_num"){
var ahdwin=ahdtop.detailForms[factory+num];
if(typeof ahdwin=="object"&&
typeof ahdwin.name=="string"&&
typeof ahdwin.closed=="boolean"&&
!ahdwin.closed){
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){
ahdwin.focus()
if(typeof cai_main._dtl=="object")
cai_main._dtl.firstField.focus();
return;
}
}
}
var query_str=cfgCgi+"?SID="+cfgSID+"+FID="+fid_generator()+
"+OP=GET_DOB+PERSID="+
escape(factory+":"+attr_name+":"+num)+
"+FACTORY_TEXT="+escape(text)+
"+KEEP.IsPopUp=1"+
"+KEEP.backfill_form="+escape("javascript:replaceList")+
"+KEEP.backfill_field=persistent_id"+
"+KEEP.Is3FieldContact=0";
popupWithURL(query_str);
}
function replaceList(persid)
{
var url=cfgCgi+"?SID="+cfgSID+"+FID="+fid_generator()+
"+OP=GET_DOB+PERSID="+escape(persid);
display_new_page(document.location,url,1);
}
function upd_main_window(form)
{
var ahdtop=get_ahdtop(true);
if(typeof ahdtop=="object")
{
if(window.name!="content")
ahdtop.focus();
var url=cfgCgi+"?SID="+cfgSID+"+FID="+fid_generator();
if(form.match(/\.htmpl/))
url+='+OP=JUST_GRONK_IT+HTMPL='+form;
else
url+='+OP='+form;
for(var i=1;i<arguments.length;i++)
url+="+"+arguments[i];
ahdtop.document.location.href=url;
}
}
function upd_frame(form)
{
var ahdtop=get_ahdtop(true);
if(typeof ahdtop=="object")
{
if(window.name!="content")
ahdtop.focus();
var url=cfgCgi+"?SID="+cfgSID+"+FID="+fid_generator();
if(form.match(/\.htmpl/))
url+='+OP=JUST_GRONK_IT+HTMPL='+form;
else
url+='+OP='+form;
for(var i=1;i<arguments.length;i++)
url+="+"+escape(arguments[i]).replace(/%3D/i,"=");
ahdtop.content.document.location.href=url;
}
}
function upd_workframe(form)
{
if(typeof top.workframe=="object")
{
var url=cfgCgi+"?SID="+cfgSID+"+FID="+fid_generator();
if(form.match(/\.htmpl/))
url+='+OP=JUST_GRONK_IT+HTMPL='+form;
else
url+='+OP='+form;
for(var i=1;i<arguments.length;i++)
url+="+"+escape(arguments[i]).replace(/%3D/i,"=");
if(parent.name=="AHDtop")
load_workframe(url,0,"UPD_WORKFRAME");
else 
display_new_page(top.workframe.location,url);
}
}
function invoke_sd_url(servername,jobcontainer)
{
if(servername=="ERROR"&&jobcontainer=="ERROR")
{
var url=ahdtop.cfgNX_SDURL+"html/web_dm_login.html?USERID=";
var w=window.open(url,"","width=850,height=600,location");
next_workframe("UPD_WORKFRAME");
return;
}
var url=ahdtop.cfgNX_SDURL+
"servlet/iDispatcher?FILE=/html/web_dm_login_context.html.tpl&CALLINGAPP=SERVICEDESK&APPLICATION=SD&SERVER="+
servername+
"&NODEID=SDJobContainer@"+
servername+
"!0!"+
jobcontainer+
"&USERID=";
var w=window.open(url,"","width=800,height=600,scrollbars,resizable,menubar,location,status,toolbar");
next_workframe("UPD_WORKFRAME");
}
function invoke_uam_url(policy_type,server_name,object_domain_id,object_id,domain_id)
{
if(policy_type=="ERROR")
{
var url=ahdtop.cfgNX_UAMURL+"html/web_dm_login.html?USERID=";
var w=window.open(url,"","width=850,height=600,location");
next_workframe("UPD_WORKFRAME");
return;
}
var policyType="";
var minus_1="";
var delim="!";
if(policy_type=="10")
{
policyType="AmoEventPolicy";
minus_1="-1!";
delim="~";
}
else if(policy_type=="11")
{
policyType="AmoPolicy";
}
var url=ahdtop.cfgNX_UAMURL+
"servlet/iDispatcher?FILE=/html/web_dm_login_context.html.tpl&CALLINGAPP=SERVICEDESK&APPLICATION=AM&SERVER="+
server_name+
"&NODEID="+
policyType+
"@"+
object_domain_id+
"!"+
minus_1+
object_id+
delim+
domain_id+
"&USERID=";
var w=window.open(url,"","width=800,height=600,scrollbars,resizable,menubar,location,status,toolbar");
next_workframe("UPD_WORKFRAME");
}
function invoke_uam_asset(server_name,unit_domain_id,unit_id,type,domain_id)
{
if(server_name=="ERROR")
{
var url=ahdtop.cfgNX_UAMURL+"html/web_dm_login.html?USERID=";
var w=window.open(url,"","width=850,height=600,location");
next_workframe("UPD_WORKFRAME");
return;
}
var url=ahdtop.cfgNX_UAMURL+
"servlet/iDispatcher?FILE=/html/web_dm_login_context.html.tpl&CALLINGAPP=SERVICEDESK&APPLICATION=AM&SERVER="+
server_name+
"&NODEID=AmoUnitComputer@"+
unit_domain_id+
"!"+
unit_id+
"!"+
type+
"~"+
domain_id+
"&USERID=";
var w=window.open(url,"","width=800,height=600,scrollbars,resizable,menubar,location,status,toolbar");
next_workframe("UPD_WORKFRAME");
}
function post_external(form_name,bopsid)
{
if(form_name=="no"){
popupCiWindow(ahdtop.ciSearchWindow,"BOPSID="+bopsid,"");
next_workframe("UPD_WORKFRAME");
return;
}
var f=void(0);
if(typeof parent.cai_main=="object")
f=parent.cai_main.document.forms[form_name];
if(typeof f!="object"||f==null){
if(typeof parent.content=="object")
f=parent.content.document.forms[form_name];
if(typeof f!="object"||f==null){
if(typeof parent.gobtn=="object")
f=parent.gobtn.document.forms[form_name];
if(typeof f!="object"||f==null){
next_workframe("UPD_WORKFRAME");
alertmsg(182,form_name);
return;
}
}
}
if(typeof f.target=="string"&&
f.target.length>0)
{
var w=window.open(cfgCAISD+"/html/empty.html",f.target);
w.focus();
}
if(f.BOPSID.type=="hidden"||
f.BOPSID.type=="text")
f.BOPSID.value=bopsid;
f.submit();
next_workframe("UPD_WORKFRAME");
}
function customize_scoreboard()
{
var ahdtop=get_ahdtop(true);
if(typeof ahdtop=="object")
{
if(window.name!="content")
ahdtop.focus();
if("function"==typeof ahdtop.scoreboard.maintain_tree){
ahdtop.scoreboard.maintain_tree(cstID);
}else{
alertmsg(280);
}
}
}
function img_button(btn_id,btn_name,btn_width,operation,alt)
{
document.writeln(img_button_text(btn_id,btn_name,btn_width,operation,alt));
}
function img_button_text(btn_id,btn_name,btn_width,operation,alt)
{
var up=cfgCAISD+"/img/b_"+btn_name+"_up.gif";
var down=cfgCAISD+"/img/b_"+btn_name+"_down.gif";
var func=operation;
if(func.indexOf("(")==-1)
func="\"upd_frame('"+func+"'); return false;\"";
else if(func.substr(0,1)!='"'&&
func.substr(0,1)!="'")
func='"'+func+';return false;"';
else 
func=funcWithQuotes(func);
var temp_str="<A ID=\""+btn_id+"\" "+
"HREF=\"javascript:void(0)\" ";
temp_str+="onClick="+func+">"+
"<IMG BORDER=0 SRC='"+up+"' "+
"WIDTH=\""+btn_width+"\" HEIGHT=\"23\" "+
"onMouseOver=\"window.status='';return true;\""+
"onMouseDown=\"this.src='"+down+"';return true;\" "+
"onMouseOut=\"this.src='"+up+"';return true;\" "+
"onMouseUp=\"this.src='"+up+"';return true;\"></A>";
if(typeof default_button_name!="string")
default_button_name="btn001";
if(btn_id==default_button_name&&
typeof imgBtnDefault!="object"){
imgBtnDefault=new Object();
imgBtnDefault.enabled=true;
imgBtnDefault.func=func.substr(1,func.length-14);
}
return temp_str;
}
function funcWithQuotes(func)
{
var pos=0;
var isSQ=1;
var pos_s=func.lastIndexOf("'");
var pos_d=func.lastIndexOf("\"");
if((pos_s>=0)&&(pos_d>=0))
{
if(pos_s>pos_d)
pos=pos_s;
else 
{
isSQ=0;
pos=pos_d;
}
}
else if(pos_s>=0)
pos=pos_s;
else
{
isSQ=0;
pos=pos_d;
}
func=func.slice(0,pos)+";return false;";
if(isSQ)
func+="'";
else 
func+="\"";
return func;
}
function pdm_submit(form_name,operation,action,replace)
{
if(action_in_progress()&&curr_form_action!=0)
return;
if(typeof action=="number")
set_action_in_progress(action);
var f=window.document.forms[form_name];
var htmpl=f.elements["HTMPL"];
var set_id=f.elements["SET.id"];
var is_55_analyst=0;
if((typeof propFormRelease=="undefined"||propFormRelease<60)&&
(typeof cfgUserType=="undefined"||cfgUserType=="analyst"))
is_55_analyst=1;
if(is_55_analyst&&typeof htmpl=="undefined"&&typeof set_id=="object")
{
if(propFormName=="detail_alg_edit.htmpl"||
propFormName=="xfer_esc_cr.htmpl"||
propFormName=="request_status_change.htmpl"||
propFormName=="cr_attach_chg.htmpl"||
propFormName=="cr_detach_chg.htmpl")
{
set_id.name="INPUT_FIELDS_TO_PARSE";
parent.top_splash.next_persid="cr:"+set_id.value;
set_id.value="HTMPL=show_main_detail.htmpl&SET.id="+set_id.value;
}
if(propFormName=="detail_chgalg_edit.htmpl"||
propFormName=="xfer_esc_chg.htmpl"||
propFormName=="order_status_change.htmpl")
{
set_id.name="INPUT_FIELDS_TO_PARSE";
parent.top_splash.next_persid="chg:"+set_id.value;
set_id.value="HTMPL=show_main_detail.htmpl&SET.id="+set_id.value;
}
if(propFormName=="nf.htmpl")
{
var factory=f.elements["FACTORY"];
if(typeof factory!="undefined")
{
set_id.name="INPUT_FIELDS_TO_PARSE";
parent.top_splash.next_persid=factory.value+":"+set_id.value;
set_id.value="HTMPL=show_main_detail.htmpl&SET.id="+set_id.value;
}
}
}
if(typeof f.elements["use_template"]=="object"&&
f.elements["use_template"].value=="1"&&
f.onsubmit==null)
{
curr_form_action=1;
}
if(typeof f!="object")
alertmsg(2,operation,form_name);
else
{
if(typeof operation=="string"&&
operation.length>0)
{
if(typeof f.OP=="object")
f.OP.value=operation;
else
alertmsg(3,operation,f.name);
}
if(typeof divLoadForm=="function")
divLoadForm(f);
if(f.onsubmit==null||
f.onsubmit())
if(typeof replace=="boolean"&&replace)
replace_location_with_forms(f);
else
f.submit();
}
}
function pdm_reset()
{
for(var i=0;i<window.document.forms.length;i++){
window.document.forms[i].reset();
}
}
function browseWithURL(url)
{
display_new_page(window.document.location,url);
}
function view_scoreboard()
{
var ahdtop=get_ahdtop();
if(typeof ahdtop!="object"||
ahdtop.propInitialPopup!="1")
return;
if(confirm(msgtext(176))){
ahdtop.close_all_windows();
var url=cfgCgi+
"?SID="+cfgSID+
"+FID="+fid_generator()+
"+OP=MENU";
ahdtop.onunload=null;
ahdtop.document.location.href=url;
}
}
function doesContain(parent,child)
{
var elems=parent.getElementsByTagName(child.tagName);
for(var e=0;e<elems.length;e++){
if(child==elems[e])
return true;
}
return false;
}
function ci_update_fields(from_window,from_fname,to_fname,attr_arr)
{
if(action_in_progress()&&curr_form_action!=0)
return;
if(typeof document.forms[to_fname]=="undefined"&&
(typeof propFormRelease=="undefined"||propFormRelease<60))
{
alertmsg(403,"ci_search.htmpl",propFormName);
return;
}
if(typeof propFormRelease=="number"&&propFormRelease>=60&&
(typeof from_window=="undefined"||typeof from_window._dtl=="undefined"||!from_window._dtl.edit))
{
return 0;
}
var fromForm,toForm;
toForm=document.forms[to_fname];
if(typeof from_window=="object"&&from_window!=null){
fromForm=from_window.document.forms[from_fname];
}else{
fromForm=document.forms[from_fname];
}
for(var i=0;i<attr_arr.length;i++){
var innerArr=attr_arr[i];
copy_set_or_key_val(fromForm,toForm,innerArr[0],innerArr[1]);
}
}
function copy_set_or_key_val(fromForm,toForm,from_attr,to_attr)
{
if(typeof fromForm=="undefined"||typeof toForm=="undefined"||
typeof from_attr=="undefined"||typeof to_attr=="undefined")
{
return-1;
}
var attrPrefix="";
var plainAttrName="";
if(0==from_attr.indexOf("KEY.")||0==from_attr.indexOf("SET.")){
attrPrefix=from_attr.slice(0,3);
plainAttrName=from_attr.slice(4);
}else{
return-1;
}
var src_elm=fromForm.elements[from_attr];
if(typeof src_elm!="object"||src_elm==null){
if("KEY"==attrPrefix){
src_elm=document.main_form.elements["SET."+plainAttrName];
if(typeof src_elm!="object"||src_elm==null||src_elm.type!="select-one")
{
return-1;
}
}else{
return-1;
}
}
var val=null;
if(src_elm.type=="select-one"){
var opts=src_elm.options;
var idx=src_elm.selectedIndex;
if("KEY"==attrPrefix){
val=opts[idx].text;;
}else{
val=opts[idx].value;
}
}else{
val=src_elm.value;
}
if(null!=val){
var to=toForm.elements[to_attr];
if(typeof to=="object")
to.value=val;
else{
return-1;
}
}
return 0;
}
var ctxMenus=new Array();
var activeCtxMenu=void(0);
function ContextMenu(name)
{
this.name=name;
this.mnum=ctxMenus.length;
this.itemCnt=0;
this.actKeys="";
this.func=new Array();
this.dynlayer=void(0);
this.hdlTimeout=void(0);
this.isVisible=false;
this.mouseless=false;
this.focused=false;
this.owningWindow=window;
this.inum=-1;
this.changeLabel=void(0);
ctxMenus[this.mnum]=this;
var out;
if(_browser.supportsLayers)
out="<LAYER ID='"+name+"'Z-INDEX='1' VISIBILITY='hide' ";
else{
out="<DIV ID='"+name+"' STYLE='display:none' ";
}
out+="CLASS=ctxMenu ";
if(_browser.isIE55){
out+="onMouseOut=\"parent.contextMenuMouseOut(event,"+this.mnum+")\" "+
"onMouseOver=\"parent.contextMenuMouseOver("+this.mnum+")\">\n";
}
else{
out+="onMouseOut=\"contextMenuMouseOut(event,"+this.mnum+")\" "+
"onMouseOver=\"contextMenuMouseOver("+this.mnum+")\">\n";
}
out+="<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>\n";
document.writeln(out);
}
ContextMenu.prototype.addItem=function(text,func)
{
if(typeof siteContextMenuitemMod!="undefined"){
var label=siteContextMenuitemMod(this.name,text);
if(typeof label=="boolean"&&!label)
return;
if(typeof label=="string"&&label.length>0)
text=label;
}
var out="<TR><TD"
if(_browser.isIE55)
out+=" onMouseOver=\"parent.contextMenuMouseOver("+this.mnum+")\"";
out+="><A";
if(!_browser.supportsLayers)
out+=" ID=ctx_"+this.mnum+"_"+this.itemCnt;
this.func[this.itemCnt]=func;
this.itemCnt++;
out+=" CLASS='ctxMenu' onMouseOver='return true;'";
if(_browser.isIE55)
out+=" HREF="+cfgCAISD+"/html/empty.html"+
" onClick=\"parent."+func+"\""+
" onMouseOver=\"parent.contextMenuFocus("+this.mnum+")\">";
else
out+=" HREF=\"javascript:"+func+"\" onclick=\"contextMenuHide("+String(this.mnum)+");\">";
var actkey="";
if(!_browser.supportsLayers){
actkey=bestKey("",text,this.actKeys);
this.actKeys+=actkey;
}
out+=fmtLabelWithActkey(text,actkey);
out+="</A></TD></TR>\n";
document.writeln(out);
}
ContextMenu.prototype.eval_func=function(funcString)
{
eval(funcString);
}
ContextMenu.prototype.changeItemLabel=function(itemCnt,changeToText)
{
if(_browser.supportLayers)
return;
var id="ctx_"+this.mnum+"_"+itemCnt;
var doc;
if(_browser.isIE55)
{
if(this.isVisible==false)
{
this.changeLabel="this.changeItemLabel("+itemCnt+", '"+changeToText+"')";
return;
}
if(typeof this.popup.document=="undefined")return;
doc=this.popup.document.body.document;
}
else
doc=document;
this.changeLabel=void(0);
var menuItem=doc.getElementById(id);
if(typeof menuItem=="undefined")
return;
var temp_str=this.actKeys.substring(0,itemCnt)+
this.actKeys.substring(itemCnt+1,this.actKeys.length);
var actkey=bestKey("",changeToText,temp_str);
this.actKeys=this.actKeys.substring(0,itemCnt)+actkey+
this.actKeys.substring(itemCnt+1,this.actKeys.length);
menuItem.innerHTML=fmtLabelWithActkey(changeToText,actkey);
}
ContextMenu.prototype.finish=function()
{
if(typeof siteContextMenuitemAdd!="undefined")
siteContextMenuitemAdd(this.name,this);
if(_browser.supportsLayers)
document.writeln("</TABLE></LAYER>");
else
document.writeln("</TABLE></DIV>");
}
ContextMenu.prototype.show=function(e,assoc,delay)
{
this.ifired=false;
var x=0,y=0;
var mouseless=(typeof e=="string"&&e=="mouseless");
if(_browser.supportsLayers){
x=e.x;
y=e.y;
}
else if(typeof assoc=="object"&&
typeof assoc.tagName=="string"){
x=assoc.offsetWidth;
for(e=assoc;e.tagName!="BODY";e=e.parentNode){
if(e.tagName=="TD"){
x+=e.offsetLeft;
y+=e.offsetTop;
}
if(e.tagName=="TABLE"){
x+=e.offsetLeft;
y+=e.offsetTop;
}
if(e.tagName=="DIV"&&
e.id.match(/scrollbar|nbtab/)){
x+=e.offsetLeft;
y+=e.offsetTop;
if(_browser.isIE55){
x-=e.scrollLeft;
y-=e.scrollTop;
}
}
}
if(_browser.isIE55){
x-=document.body.scrollLeft;
y-=document.body.scrollTop;
}
}
else if(_browser.isIE){
x=window.event.clientX+1;
y=window.event.clientY-2;
if(_browser.isIE55){
x+=document.body.scrollLeft;
y+=document.body.scrollTop;
}
}
else{
x=e.pageX+1;
y=e.pageY-2;
}
this.x=x;
this.y=y;
if(typeof assoc!="object")
assoc=null;
if(typeof delay!="number")
delay=500;
if(typeof this.hdlTimeout!="undefined"){
if(assoc==this.assoc)
return;
window.clearTimeout(this.hdlTimeout);
this.hdlTimeout=void(0);
}
if(!_browser.isIE55&&this.isVisible){
if(assoc!=this.assoc){
this.assoc=assoc;
this.dynlayer.moveTo(x,y);
}
}
else{
if(_browser.isIE55&&this.isVisible)
contextMenuHide(this.mnum);
this.assoc=assoc;
this.mouseless=mouseless;
if(delay==0)
contextMenuShow(this.mnum);
else
this.hdlTimeout=window.setTimeout("contextMenuShow("+this.mnum+")",
delay);
}
}
function contextMenuShow(mnum)
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&
typeof ahdtop.LoadingPopup=="object"&&
typeof ahdtop.LoadingPopup.closed=="boolean"&&
!ahdtop.LoadingPopup.closed)
return;
if(mnum<ctxMenus.length){
var m=ctxMenus[mnum];
if(typeof m.hdlTimeout!="undefined"){
window.clearTimeout(m.hdlTimeout);
m.hdlTimeout=void(0);
}
m.owningWindow.focus();
m.owningWindow.setTempKeyDownHandler(contextMenuKeyDown);
if(_browser.isIE55){
var menuData=document.getElementById(m.name);
if(typeof menuData=="object"&&menuData!=null){
menuData.style.display="";
var width=menuData.scrollWidth+8;
var height=menuData.scrollHeight+5;
menuData.style.display="none";
var popup=window.createPopup();
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&ahdtop!=null){
var popupStyle=popup.document.createStyleSheet();
if(ahdtop.menuStyles.length==0)
ahdtop.initMenuStyles(window);
for(var i=0;i<ahdtop.ctxmenuStyles.length;i++){
var ruleName=ahdtop.ctxmenuStyles[i][0];
var ruleText=ahdtop.ctxmenuStyles[i][1];
popupStyle.addRule(ruleName,ruleText);
}
}
popup.document.body.innerHTML=
menuData.outerHTML.replace(/self\./ig,"parent.");
var e=popup.document.body.document.getElementById(m.name);
e.style.display="";
popup.show(m.x,m.y,width,height,window.document.body);
m.popup=popup;
m.inum=-1;
}
}
else{
if(typeof m.dynlayer!="object")
m.dynlayer=new DynLayer(m.name);
m.dynlayer.moveTo(m.x,m.y);
m.dynlayer.show();
if(_browser.isIE)
m.dynlayer.layer.scrollIntoView();
}
m.isVisible=true;
activeCtxMenu=m;
if(m.mouseless){
if(_browser.isIE55)
var d=m.popup.document.body.document;
else
var d=document;
var e=d.getElementById("ctx_"+m.mnum+"_0");
if(typeof e=="object"&&e!=null){
e.className="ctxMenuSel";
m.inum=0;
}
}
if(!_browser.supportsLayers&&
(typeof m.changeLabel!="undefined"))
{
m.eval_func(m.changeLabel);
m.changeLabel=void(0);
}
}
}
ContextMenu.prototype.hide=function(delay)
{
if(typeof this.hdlTimeout!="undefined"){
window.clearTimeout(this.hdlTimeout);
this.hdlTimeout=void(0);
}
if(this.isVisible){
if(typeof delay!="number")
delay=250;
if(delay==0)
contextMenuHide(this.mnum);
else
this.hdlTimeout=window.setTimeout("contextMenuHide("+this.mnum+")",
delay);
}
}
function contextMenuHide(mnum)
{
if(mnum<ctxMenus.length){
var m=ctxMenus[mnum];
if(typeof m.hdlTimeout!="undefined"){
window.clearTimeout(m.hdlTimeout);
m.hdlTimeout=void(0);
}
if(m.isVisible){
if(_browser.isIE55){
if(m.focused)
return;
if(typeof m.popup=="object")
m.popup.hide();
}
else
m.dynlayer.hide();
m.isVisible=false;
activeCtxMenu=void(0);
m.owningWindow.setTempKeyDownHandler(null);
if(typeof m.assoc=="object"&&m.assoc!=null)
m.assoc.focus();
}
}
}
function contextMenuMouseOver(mnum)
{
if(mnum<ctxMenus.length){
var m=ctxMenus[mnum];
m.focused=true;
if(typeof m.hdlTimeout!="undefined"){
window.clearTimeout(m.hdlTimeout);
m.hdlTimeout=void(0);
}
}
return true;
}
function contextMenuMouseOut(ev,mnum)
{
if(_browser.isIE)
ev=window.event;
window.status=window.defaultStatus;
if(mnum<ctxMenus.length){
var m=ctxMenus[mnum];
m.focused=false;
if(typeof m.hdlTimeout!="undefined"){
window.clearTimeout(m.hdlTimeout);
m.hdlTimeout=void(0);
}
if(m.isVisible){
if(_browser.isIE55){
m.hide(100);
}
else if(!m.dynlayer.isInside(ev)){
m.dynlayer.hide();
m.isVisible=false;
activeCtxMenu=void(0);
m.owningWindow.setTempKeyDownHandler(null);
}
}
}
return true;
}
function contextMenuKeyDown(active_element,keycode,shiftkey)
{
if(typeof activeCtxMenu=="object"&&activeCtxMenu!=null){
var m=activeCtxMenu;
if(_browser.isIE55&&
(typeof m.popup!="object"||
!m.popup.isOpen)){
m.hide(0);
m.focused=false;
m.owningWindow.setTempKeyDownHandler(null);
return true;
}
var new_inum=m.inum;
switch(keycode){
case 38:
if(m.inum>0)
new_inum=m.inum-1;
break;
case 40:
if(m.inum<m.itemCnt-1)
new_inum=m.inum+1;
break;
case 9:
m.hide(0);
return true;
case 37:
m.hide(0);
break;
case 35:
m.hide(0);
break;
case 13:
m.hide(0);
m.ifired=true;
eval(m.func[m.inum]);
break;
default:
var key=String.fromCharCode(keycode).toUpperCase();
var posn=m.actKeys.indexOf(key);
if(posn!=-1){
m.hide(0);
eval(m.func[posn]);
}
break;
}
if(m.inum!=new_inum){
if(_browser.isIE55)
var d=m.popup.document.body.document;
else
var d=document;
if(m.inum>=0){
var e=d.getElementById("ctx_"+m.mnum+"_"+m.inum);
if(typeof e=="object"&&e!=null)
e.className="ctxMenu";
}
var e=d.getElementById("ctx_"+m.mnum+"_"+new_inum);
if(typeof e=="object"&&e!=null)
e.className="ctxMenuSel";
m.inum=new_inum;
}
return false;
}
}
function bool(arg)
{
switch(typeof arg){
case"boolean":return arg;
case"string":return arg.length==1&&arg!="0";
case"number":return arg!=0;
default:return false;
}
}
function activateStatistics()
{
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&ahdtop!=null){
ahdtop.popup_req_time=new Array();
alertmsg(323);
}
}
function showStatistics()
{
if(typeof formCheckpoint=="object"){
var loadTime=formCheckpoint["load"];
if(typeof formCheckpoint["request"]=="undefined"){
if(typeof propFormName=="string"&&
propFormName=="bin_form_np.htmpl")
return;
var stats="Request Time:  unknown";
}
else{
var reqTime=formCheckpoint["request"];
var stats="Request Time: "+fmtTimeDiff(reqTime);
}
var doneTime=new Date();
stats+="\nLoad Start: "+fmtTimeDiff(loadTime,reqTime)+
"\nLoad Complete: "+fmtTimeDiff(doneTime,loadTime);
if(typeof reqTime=="object")
stats+="\nUser Resp Time: "+
(doneTime.getTime()-reqTime.getTime())/ 1000 + " secs";
if(!confirm(stats)){
var ahdtop=get_ahdtop();
if(typeof ahdtop=="object"&&ahdtop!=null)
ahdtop.popup_req_time=void(0);
}
}
}
function fmtTimeDiff(endTime,startTime)
{
var s=endTime.toTimeString();
if(typeof startTime=="object"){
var delta=endTime.getTime()-startTime.getTime();
s+=" ("+delta/ 1000 + " secs)";
}
return s;
}
function do_ci_60()
{
var w_name=get_popup_window_name("ci_window");
var js="<script>var fromArr = new Array();";
js+='fromArr[0] = ["KEY.category", "CATEGORY"];';
js+='fromArr[1] = ["KEY.affected_resource", "ITEM"];';
js+='fromArr[2] = ["SET.affected_resource", "SD_ASSET_ID"];';
js+='var dOptField = cfgSearchStr;';
js+='if (null == dOptField || "" == dOptField) ';
js+='dOptField = "description";';
js+='fromArr[3] = ["SET." + dOptField, "DESCRIPTION"];';
js+="</script>";
js+=img_button_text('KT_NLS','search_nls',125,"\"ci_update_fields(window, 'main_form', 'ci_search', fromArr);popupCiWindow('"+w_name+"' ,'ci_search', '', 1)\"","<INPUT TYPE=BUTTON VALUE=\'Search NLS\' onClick=\"ci_update_fields(window, 'main_form', 'ci_search', fromArr);popupCiWindow('"+w_name+"' ,'ci_search', '', 1)\">");
document.writeln(js);
}
function redo_ci_60()
{
var file_name=propFormName;
if(typeof cfgUserType=="string"&&
cfgUserType=="analyst"&&
propFormName=="detail_cr_ro.htmpl")
{
file_name="crro_alg_tab.htmpl";
}
var temp='<TD VALIGN=TOP class=detailro><A HREF="javascript:void(0)" onClick="alertmsg(404, \''+file_name+'\')" >'+msgtext(336)+'</A></TD>';
return temp;
}
function cst_do_ci_60()
{
var tmp=img_button_text('KT_NLS','search_nls',125,"\"cst_popup_knowledge()\"","<INPUT TYPE=BUTTON VALUE=\'Search NLS\' onClick=\"cst_popup_knowledge()\">");
document.writeln(tmp);
}
function cst_popup_knowledge()
{
var search_form=document.forms["ci_search"];
if(typeof search_form=="undefined")
{
alertmsg(403,"cst_ci_search.htmpl",propFormName);
return;
}
var description_elem=search_form.elements["DESCRIPTION"];
var main_form=document.forms["main_form"];
var set_desc_elem;
if(typeof main_form=="object")
set_desc_elem=main_form.elements["SET.description"];
if(typeof search_form!="object"||
typeof description_elem!="object"||
typeof set_desc_elem!="object")
return;
description_elem.value=set_desc_elem.value;
popupCiWindow("ci_search","ci_search");
}
function refreshForm()
{
var url="";
if(typeof propFormName3!="string"||
propFormName3.toString()!="edit"){
url=window.document.URL;
if(typeof propFormName1=="string"&&
propFormName1=="detail"&&
typeof argPersistentID=="string"){
var colon=argPersistentID.indexOf(":");
if(colon!=-1)
url=cfgCgi+"?SID="+cfgSID+"+FID="+cfgFID+
"+OP=SHOW_DETAIL+FACTORY="+
argPersistentID.slice(0,colon)+
"+PERSID="+escape(argPersistentID);
}
}
if(url.indexOf("?")==-1||
url.match(/OP=(CANCEL|DELETE|UPDATE)/))
alertmsg(83);
else{
set_action_in_progress(ACTN_LOADFORM);
url=url.replace(/\'/g,"%27");
display_new_page(window.document.location,url,true);
}
}
