var buttonColor;
function glowTab(tid,onoff){
//    alert("TID: "+tid);
    //var doc = document;
    //alert("lt"+tid);
    var t = document.getElementById("lt"+tid);
    if(onoff==1){
        t.src="/int/global/images/lred-glow.gif";
    }
    else{
        t.src="/int/global/images/lgray.gif";
    }
    t = document.getElementById("rt"+tid);
    if(onoff==1){
        t.src="/int/global/images/rred-glow.gif";
    }
    else{
        t.src="/int/global/images/rgray.gif"; 
    }
    t = document.getElementById("t"+tid);
    if(onoff==1){
        t.background="/int/global/images/rbox-glow.gif";
    }
    else{
        t.background="/int/global/images/gbox.gif"; 
    }

    
}
function hlrow (rown){
  md = document.getElementById('row'+rown);
  buttonColor = md.style.backgroundColor;
  md.style.backgroundColor='#CFE7E7';
  md.style.cursor='Hand';
}
function dhlrow (rown){
  md = document.getElementById('row'+rown);
  md.style.backgroundColor=buttonColor;
}
function getDetails(url){
    if(url.indexOf('javascript:')>-1){
        url = url.replace(/~/g,"'");
        //alert(url);
        eval(url);
    }
    else{
        window.location=url;
    }
    return false;
}
function LDAPlookup(fname,atrib,fcall){
  if (fcall==null){
     fcall="null";
  }
   var popup;
   popup = window.open("/int/utils/lookup.jsp?Fname="+fname+"&Attribute="+atrib+"&Function="+fcall,"Lookup","width=700 ,height=400,resizable=no,scrollbars=yes,status=no",false);
}
function FindJDE(fname,fcall){
  if (fcall==null){
     fcall="null";
  }
   var popup;
   popup = window.open("/int/utils/jdepartner.jsp?Fname="+fname+"&Function="+fcall,"Lookup","width=700 ,height=400,resizable=no,scrollbars=yes,status=no",false);
}

function DatePicker(fname,rfunction,year,month){
   var popup;
   var url ="/int/global/calendar.jsp?fname="+fname; 
   if (rfunction!=null) {
       url+="&rfunction="+rfunction;
   }
   if (year!=null && month!=null) {
       url+="&year="+year+"&month="+month;
   }
  // alert(url);
   popup = window.open(url,"Date","width=201,height=143,resizable=yes,scrollbars=no,status=no,location=no,titlebar=no,left=100,top=120",false);
}
function LDAPGrouplookup(fname,atrib,fcall){
  if (fcall==null){
     fcall="null";
  }
   var popup;
   popup = window.open("/int/utils/grouplookup.jsp?Fname="+fname+"&Attribute="+atrib+"&Function="+fcall,"Lookup","width=600 ,height=300,resizable,scrollbars=yes,status=yes",false);
}

function deleteRecord(database,table,keyfield,keyvalue,fcall){
  if (fcall==null){
     fcall="null";
  }
   var popup;
   url="/int/utils/deleterecord.jsp?database="+database+"&table="+table+"&keyfield="+keyfield+"&keyvalue="+keyvalue+"&fcall="+fcall;
   popup = window.open(url,"areyousure","width=400,height=100,resizable=no,scrollbars=no,status=no,left=200,top=300",false);
}
function ServerdeleteRecord(server,database,table,keyfield,keyvalue,fcall){
  if (fcall==null){
     fcall="null";
  }
   var popup;
   url="/int/utils/deleterecord.jsp?server="+server+"&database="+database+"&table="+table+"&keyfield="+keyfield+"&keyvalue="+keyvalue+"&fcall="+fcall;
   popup = window.open(url,"areyousure","width=400,height=100,resizable=no,scrollbars=no,status=no,left=200,top=300",false);
}
function partDetail(pn){
      openPopupSR("/int/pdm/masterlog/partdetail.jsp?IMLITM="+pn+"&subTab=0",720,400);
}
function deleteFile(fpath,fcall){
  if (fcall==null){
     fcall="null";
  }
   var popup;
   url="/int/global/deletefile.jsp?fpath="+fpath+"&fcall="+fcall;
   popup = window.open(url,"areyousure","width=400,height=100,resizable=yes,scrollbars=no,status=no,left=200,top=300",false);
}
function updateRecord(database,table,keyfield1,keyvalue1,keyfield2,keyvalue2,fcall){
  if (fcall==null){
     fcall="null";
  }
   var popup;
   url="/int/utils/updaterecord.jsp?database="+database+"&table="+table+"&keyfield1="+keyfield1+"&keyvalue1="+keyvalue1+"&keyfield2="+keyfield2+"&keyvalue2="+keyvalue2+"&fcall="+fcall;
   popup = window.open(url,"areyousure","width=400,height=100,resizable=no,scrollbars=no,status=no,left=200,top=300",false);
}
function uploadAttachment(content_area,id,fname,rootdir){
    if(rootdir==null){
        rootdir="/opt/jsproot/int/ca/";
    }
    openPopup("/int/global/attachmentupload.jsp?mode=create&fname="+fname+"&content_area="+content_area+"&id="+id+"&rootdir="+rootdir,400,100);
}
function openPopup(page, my_width, my_height){
    self.name = 'Main';
    ImageViewerWin = this.open (page,"", "toolbar=no,scrollbars=no,resizable=no,status=no,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
    //ImageViewerWin = this.open (page,"", "location=yes,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
}
function openPopupP(page, my_width, my_height){
    self.name = 'Main';
    ImageViewerWin = this.open (page,"", "toolbar=yes,scrollbars=no,resizable=no,status=no,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
    //ImageViewerWin = this.open (page,"", "location=yes,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
}
function openPopupS(page, my_width, my_height){
    self.name = 'Main';
    ImageViewerWin = this.open (page,"", "toolbar=no,scrollbars=yes,resizable=no,status=no,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
    //ImageViewerWin = this.open (page,"", "location=yes,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
}
function openPopupSR(page, my_width, my_height){
    self.name = 'Main';
    ImageViewerWin = this.open (page,"", "toolbar=no,scrollbars=yes,resizable=yes,status=yes,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
    //ImageViewerWin = this.open (page,"", "location=yes,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
}
function openWindow(page, my_width, my_height){
    self.name = 'Main';
    ImageViewerWin = this.open (page,"", "menubar=yes,location=yes,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
    //ImageViewerWin = this.open (page,"", "location=yes,toolbar=yes,scrollbars=yes,resizable=yes,status=yes,width=" + my_width + ",height=" + my_height + ",left=50,top=200");
}

function getUrl(url){
    var popup;
    url=escape(url);
    popup = window.open("/int/utils/geturl.jsp?url="+url,"url","width=405,height=110,resizable=no,scrollbars=no,status=no,left=200,top=300",false);
}
function WgetElementById(id){
    var obj = null;
    if(document.getElementById){
        obj = document.getElementById(id);
    }
    else if(document.all){
        obj = document.all[id];
    }
    return obj;
}
function showLoading(url,doc){
    var x = WgetElementById("loadingImage");
    x.style.visibility='visible';
    x.innerHTML="<img src=\"/int/global/images/loading.gif\">";
    if (doc==null){
        location = url;
    }
    else{
        doc.submit();
    } 
}
function stxt(fname) {
    var doc=document.forms[0];
    eval("doc."+fname+".select()"); 
}

