// Copyright (c) 2003 Computer Associates International, Inc
var imgBtnArray=new Array();
var imgBtnID=0;
var imgBtnRowCentered=true;
var imgBtnDisabledSupported=false;
var imgBtnPadding="";
var imgBtnRowCount=0;
var imgBtnRowActive=false;
var imgBtnDefault=void(0);
var imgBtnCancel=void(0);
if(typeof ahdtop=="undefined")
ahdtop=get_ahdtop();
if(typeof imgBtnData!="object")
var imgBtnData=ahdtop.imgBtnData;
if(typeof _browser=="undefined"){
var _browser=new Object();
_browser.supportsLayers=!document.all;
_browser.isIE=document.all;
}
function ImgBtnMouseOver(lID,obj)
{
var btn=imgBtnArray[lID];
if(typeof btn=="object"&&btn.enabled){
obj.style.cursor="hand";
window.status=btn.help;
btn.right.src=imgBtnData["right_active"];
if(!_browser.supportsLayers){
btn.left.src=imgBtnData["left_active"];
btn.obj.style.background="url('"+imgBtnData["middle_active"]+"')";
}
}
else{
obj.style.cursor="default";
window.status=window.defaultStatus;
}
return true;
}
function ImgBtnExecute(lID)
{
if(typeof lID=="object")
lId=lID[0];
var btn=imgBtnArray[lID];
if(btn.enabled)
eval(btn.func);
return false;
}
function ImgBtnFocus(lID)
{
var btn=imgBtnArray[lID];
if(btn.enabled){
btn.obj.style.color=imgBtnData["down_color"];
if(_browser.isIE){
var e=window.event;
if(typeof e=="object"&&
e.altKey)
eval(btn.func);
}
}
}
function ImgBtnBlur(lID)
{
var btn=imgBtnArray[lID];
if(btn.enabled)
btn.obj.style.color=imgBtnData["enabled_color"];
else
btn.obj.style.color=imgBtnData["disabled_color"];
}
function ImgBtnMouseDown(lID)
{
var btn=imgBtnArray[lID];
if(typeof btn=="object"&&btn.enabled){
btn.right.src=imgBtnData["right_down"];
btn.left.src=imgBtnData["left_down"];
if(!_browser.supportsLayers){
btn.obj.style.color=imgBtnData["down_color"];
btn.obj.style.background="url('"+imgBtnData["middle_down"]+"')";
}
}
}
function ImgBtnMouseUp(lID)
{
var btn=imgBtnArray[lID];
if(typeof btn=="object"&&btn.enabled){
btn.right.src=imgBtnData["right"];
btn.left.src=imgBtnData["left"];
if(!_browser.supportsLayers){
btn.obj.style.color=imgBtnData["enabled_color"];
btn.obj.style.background="url('"+imgBtnData["middle"]+"')";
}
}
window.status=window.defaultStatus;
return true;
}
function ImgBtnChangeCaption(btnID,sNewCaption)
{
if(!_browser.supportsLayers){
for(var i=0;i<imgBtnArray.length;i++){
var btn=imgBtnArray[i];
if(btn.id==btnID){
if(typeof btn.actKey=="string"&&
btn.actKey!=" "&&
btn.actKey.length==1){
var posn=sNewCaption.indexOf(btn.actKey);
if(posn==-1)
posn=sNewCaption.indexOf(btn.actKey.toLowerCase());
if(posn!=-1){
var text="";
if(posn!=0)
text+=sNewCaption.substr(0,posn);
text+="<U>"+sNewCaption.substr(posn,1)+"</U>";
if(posn<sNewCaption.length-1)
text+=sNewCaption.substr(posn+1,sNewCaption.length-posn-1);
sNewCaption=text;
}
}
btn.obj.innerHTML=sNewCaption;
break;
}
}
}
}
function ImgBtnChangeHelp(btnID,sNewHelp)
{
for(var i=0;i<imgBtnArray.length;i++)
{
var btn=imgBtnArray[i];
if(btn.id==btnID)
{
btn.help=sNewHelp;
break;
}
}
}
function ImgBtnDisabled(btnName){
for(var i=0;i<imgBtnArray.length;i++){
var btn=imgBtnArray[i];
if(btn.id==btnName)
return!btn.enabled;
}
return true;
}
function ImgBtnEnableDeferred()
{
if(typeof imgBtnDeferred=="object"){
for(var i=imgBtnDeferred.length-1;i>=0;i--)
ImgBtnEnableButton(imgBtnDeferred[i]);
imgBtnDeferred=void(0);
}
}
function ImgBtnEnableButton(btnName,btnEnable)
{
if(typeof btnEnable=="boolean"&&!btnEnable){
ImgBtnDisableButton(btnName);
return;
}
for(var i=0;i<imgBtnArray.length;i++){
var btn=imgBtnArray[i];
if(btn.id==btnName){
if(!_browser.supportsLayers)
btn.obj.style.color=imgBtnData["enabled_color"];
else if(typeof btn.disable_layer=="object")
btn.disable_layer.visibility="hide";
btn.enabled=true;
return;
}
}
}
function ImgBtnDisableButton(btnName)
{
ImgBtnSupportDisabled();
for(var i=0;i<imgBtnArray.length;i++){
var btn=imgBtnArray[i];
if(btn.id==btnName){
if(!_browser.supportsLayers)
btn.obj.style.color=imgBtnData["disabled_color"];
else
btn.disable_layer.visibility="show";
btn.enabled=false;
return;
}
}
}
function ImgBtnNoHighlight(btnName)
{
for(var i=0;i<imgBtnArray.length;i++){
var btn=imgBtnArray[i];
if(btn.id==btnName){
btn.nohighlight=true;
return;
}
}
}
function ImgBtnOnload()
{
if(_browser.supportsLayers){
if(typeof imgBtnOnload=="function")
imgBtnOnload.apply();
ImgBtnSupportDisabled();
}
}
function ImgBtnOnresize(e)
{
if(_browser.supportsLayers){
imgButtonDisabledSupported=false;
if(typeof imgBtnOnresize=="function")
imgBtnOnresize.apply();
ImgBtnSupportDisabled();
}
}
function ImgBtnSupportDisabled()
{
if(_browser.supportsLayers&&
!imgBtnDisabledSupported){
for(i=0;i<imgBtnArray.length;i++){
var btn=imgBtnArray[i];
var width=0;
if(typeof btn.obj=="object"&&typeof btn.end=="object")
width=btn.end.x-btn.obj.x-10;
if(width<=0)
width=100;
var s="<TABLE><TR>";
s+="<A CLASS=clsButtonDisabled>"+btn.caption+"</A>"
s+="</TD></TR></TABLE>";
btn.disable_layer=new Layer(width);
btn.disable_layer.document.write(s);
btn.disable_layer.document.close();
btn.disable_layer.moveToAbsolute(btn.obj.x,btn.obj.y);
if(btn.enabled)
btn.disable_layer.visibility="hide";
else
btn.disable_layer.visibility="show";
}
}
imgBtnDisabledSupported=true;
}
function ImgBtnShow(btnID)
{
for(var i=0;i<imgBtnArray.length;i++)
{
var btn=imgBtnArray[i];
if(btn.id==btnID)
{
var btn=document.getElementById("imgBtn"+String(i));
if(typeof btn=="object"){
recursively_set_display(btn,"");
adjScrollDivHeight();
}
break;
}
}
}
function ImgBtnHide(btnID)
{
for(var i=0;i<imgBtnArray.length;i++)
{
var btn=imgBtnArray[i];
if(btn.id==btnID)
{
var btn=document.getElementById("imgBtn"+String(i));
if(typeof btn=="object"){
recursively_set_display(btn,"none");
adjScrollDivHeight();
}
break;
}
}
}
function ImgBtnRow(padding,centered)
{
var text="";
imgBtnRowCentered=typeof centered!="boolean"||centered;
if(imgBtnRowCentered)
text+="<CENTER>";
imgBtnPadding="";
var width="";
if(typeof padding=="number")
for(;padding>0;padding--)
imgBtnPadding+="&nbsp;";
else if(typeof padding=="string"&&
padding.match(/\d+%/))
width=" WIDTH='"+padding+"'";
if(_browser.supportsLayers&&imgBtnPadding.length==0)
imgBtnPadding="&nbsp;";
text+="<TABLE border=0"+width+"><TR>\n";
docWrite(text);
imgBtnRowActive=true;
imgBtnRowCount=0;
}
function ImgBtnEndRow()
{
if(imgBtnRowActive){
var text="</TR></TABLE>";
if(imgBtnRowCentered)
text+="</CENTER>\n";
docWrite(text);
imgBtnRowActive=false;
}
}
function ImgBtnDoCancel()
{
if(typeof imgBtnCancel=="object"&&
typeof imgBtnCancel.enabled=="boolean"&&
imgBtnCancel.enabled){
if(!_browser.supportsLayers&&
typeof imgBtnCancel.obj=="object")
imgBtnCancel.obj.style.color=imgBtnData["down_color"];
eval(imgBtnCancel.func);
if(imgBtnCancel.nohighlight&&
!_browser.supportsLayers&&
typeof imgBtnCancel.obj=="object")
imgBtnCancel.obj.style.color=imgBtnData["enabled_color"];
return true;
}
return false;
}
function ImgBtnKeydownHandler(e)
{
if((typeof imgBtnDefault.enabled!="boolean"||
!imgBtnDefault.enabled)&&
(typeof imgBtnCancel.enabled!="boolean"||
!imgBtnCancel.enabled))
return true;
var key_pressed;
var active_element;
if(_browser.supportsLayers)
{
key_pressed=e.which;
active_element=e.target;
}
else if(_browser.isIE)
{
e=window.event;
key_pressed=e.keyCode;
active_element=document.activeElement;
}
else
{
key_pressed=e.keyCode;
active_element=e.target;
}
if(key_pressed==13&&
typeof active_element.type=="string"&&
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.style.color=imgBtnData["down_color"];
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.style.color=imgBtnData["enabled_color"];
return false;
}
}
}
if(key_pressed==27&&
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();
return true;
}
}
}
return true;
}
function ImgBtnCreate(btnID,btnCaption,func,btnEnabled,btnWidth,help)
{
var lID;
lID=imgBtnID;
imgBtnID++;
if(typeof btnID!="string"||btnID.length==0){
if(lID<10)
btnID="btn00"+lID;
else if(lID<100)
btnID="btn0"+lID;
else
btnID="btn"+lID;
}
if(func.indexOf("(")==-1)
func="upd_frame('"+func+"')";
if(btnCaption.indexOf("[")!=-1)
{
var initalval=btnCaption.indexOf("[");
var endval=btnCaption.indexOf("]");
var actkeylen=(endval-1)-initalval;
actKey=btnCaption.substr(initalval+1,actkeylen);
btnCaption=btnCaption.substr(0,initalval);
var keepoldactKeyvalue=actKey;
}
if(typeof actKey!="string")
actKey="";
if(actKey.indexOf("*")!=-1)
{
var foundindex=actKey.indexOf("*");
var keylength=actKey.length;
actKey=actKey.substr(foundindex+1,keylength);
}
var btnActCaption=actKey+btnCaption;
actKey=registerActionKey(actKey,btnActCaption,ImgBtnExecute,lID);
var currentClass="clsButtonEnabled";
if(typeof btnEnabled!="boolean"){
if(_browser.supportsLayers||
typeof btnEnabled!="string"||btnEnabled!="defer")
btnEnabled=true;
else{
btnEnabled=false;
if(typeof imgBtnDeferred=="undefined")
imgBtnDeferred=new Array();
imgBtnDeferred[imgBtnDeferred.length]=btnID;
}
}
if(!btnEnabled){
if(!_browser.supportsLayers)
currentClass="clsButtonDisabled";
else if(typeof imgBtnOnload=="undefined"){
imgBtnOnload=window.onload;
imgBtnOnresize=window.onresize;
window.onload=ImgBtnOnload;
window.onresize=ImgBtnOnresize;
}
}
var sTDWidth="";
if(typeof btnWidth=="number"&&btnWidth>30)
sTDWidth=" width="+(btnWidth-28);
else if(typeof btnWidth=="string")
sTDWidth=" width="+btnWidth;
imgBtnArray[lID]=new Object();
imgBtnArray[lID].id=btnID;
imgBtnArray[lID].caption=btnCaption;
imgBtnArray[lID].func=func;
imgBtnArray[lID].enabled=btnEnabled;
imgBtnArray[lID].nohighlight=false;
imgBtnArray[lID].actKey=actKey;
if(typeof help=="undefined")
{
help=btnCaption;
}
if(typeof help=="string")
{
if(help.indexOf("(")!=-1)
{
var initalval=help.indexOf(")");
help=help.substr(0,initalval-1);
}
imgBtnArray[lID].help=help;
}
var actions,actions_img,name;
var text="";
if(imgBtnRowActive){
if(imgBtnRowCount>0&&
imgBtnPadding.length>0)
text+="<TD>"+imgBtnPadding+"</TD>";
text="<TD ALIGN=center HEIGHT=21>\n";
imgBtnRowCount++;
}
if(!_browser.supportsLayers){
actions_img=" onMouseOver='return ImgBtnMouseOver("+lID+",this);'"+
" onMouseDown='ImgBtnMouseDown("+lID+");'"+
" onMouseOut='return ImgBtnMouseUp("+lID+");'"+
" onMouseUp='return ImgBtnMouseUp("+lID+");'";
if(typeof help=="string")
actions_img+=" TITLE='"+help.replace(/'/,"\\'")+"'";
actions=actions_img+
" onClick='return ImgBtnExecute("+lID+");'"+
" onFocus='ImgBtnFocus("+lID+");'"+
" onBlur='ImgBtnBlur("+lID+");'";
text+="<A HREF='JavaScript:void(0)'";
text+=" ID=imgBtn"+lID+" NAME=imgBtn"+lID+actions+">\n";
text+="<TABLE cellspacing=0 cellpadding=0 border=0><TR>\n";
text+="<TD VALIGN=middle HEIGHT=21><IMG SRC='"+
imgBtnData["left"]+"' WIDTH=10 HEIGHT=21 BORDER=0"+
actions_img+"></TD>\n";
text+="<TD VALIGN=middle"+sTDWidth+" ALIGN=CENTER"+
" ID=imgBtn"+lID+"_caption CLASS="+currentClass+
" NOWRAP>";
text+=fmtLabelWithActkey(btnCaption,actKey,keepoldactKeyvalue);
text+="</TD>\n<TD VALIGN=middle HEIGHT=21><IMG SRC='"+
imgBtnData["right"]+"' WIDTH=10 HEIGHT=21 BORDER=0"+
actions_img+"></TD>\n";
text+="</TR></TABLE></A>\n";
docWrite(text);
imgBtnArray[lID].obj=document.getElementById("imgBtn"+lID+"_caption");
imgBtnArray[lID].obj.style.background="url('"+imgBtnData["middle"]+"')";
}
else{
actions=" onClick='return ImgBtnExecute("+lID+");'";
actions_img=" onMouseDown='ImgBtnMouseDown("+lID+");'"+
" onMouseUp='ImgBtnMouseUp("+lID+");'";
text+="<TABLE cellspacing=0 cellpadding=0 border=0><TR>\n";
text+="<TD VALIGN=middle><IMG SRC='"+
imgBtnData["left"]+"' WIDTH=10 HEIGHT=21 BORDER=0"+
actions_img+"></TD>\n";
text+="<TD VALIGN=middle"+sTDWidth+" ALIGN=CENTER"+
" BACKGROUND='"+imgBtnData["middle_ns"]+"' HEIGHT=21"+
" NOWRAP>";
text+="<A CLASS="+currentClass+" HREF='JavaScript:void(0)'"+
" ID=imgBtn"+lID+" NAME=imgBtn"+lID+actions+">"+
btnCaption+"</A></TD>\n";
text+="<TD VALIGN=middle><IMG SRC='"+
imgBtnData["right"]+"' WIDTH=10 HEIGHT=21 BORDER=0"+
actions_img+"></TD>\n";
text+="<TD><A NAME=imgBtn"+lID+"_end></A></TD>\n";
text+="</TR></TABLE>\n";
docWrite(text);
var alen=document.anchors.length;
imgBtnArray[lID].obj=document.anchors[alen-2];
imgBtnArray[lID].end=document.anchors[alen-1];
}
if(imgBtnRowActive)
docWriteln("</TD>");
var ilen=document.images.length;
imgBtnArray[lID].left=document.images[ilen-2];
imgBtnArray[lID].right=document.images[ilen-1];
if(typeof default_button_name!="string")
default_button_name="btndflt";
if(typeof cancel_button_name!="string")
cancel_button_name="btncncl";
if(btnID==default_button_name&&
typeof imgBtnDefault!="object"){
imgBtnDefault=imgBtnArray[lID];
if(typeof document.onkeydown!="function")
document.onkeydown=ImgBtnKeydownHandler;
}
else if(btnID==cancel_button_name&&
typeof imgBtnCancel!="object"){
imgBtnCancel=imgBtnArray[lID];
if(typeof document.onkeydown!="function")
document.onkeydown=ImgBtnKeydownHandler;
}
return btnID;
}
/* SDT 26462
The name of this routine may be a little confusing if we're IE.
IE doesn't support the DOM spec very well.  That means that
it has no idea what a Node is(which is an interface,hence an object/
function).So..if the typeof Node!=function,then we really don't
recurse.Besides,we're only having problems with Mozilla/Netscape7,
not IE!*/
function recursively_set_display(elem,display)
{
if(typeof Node=="function")
{
if(typeof elem.firstChild=="object"&&elem.firstChild!=null)
recursively_set_display(elem.firstChild,display);
if(typeof elem.nextSibling=="object"&&elem.nextSibling!=null)
recursively_set_display(elem.nextSibling,display);
if(elem.nodeType==Node.ELEMENT_NODE&&
typeof elem.style=="object"&&
typeof elem.style.display=="string")
elem.style.display=display;
}
else
elem.style.display=display;
}
