DDBRAHT ;SFISC/DCL-BROWSER ANCHOR & HYPERTEXT PROCESSOR ;NOV 04, 1996@13:50
 ;;22.0;VA FileMan;;Mar 30, 1999
 ;Per VHA Directive 10-93-142, this routine should not be modified.
 Q
TAB ;
 S DDBRHT=$G(DDBRHT)
 I $P(DDBRHT,DDGLDEL,4)'=DDBSA S DDBRHT=""
 N LIM,ULCLR,ULNEW
 S LIM=DDBL,ULCLR=DDBRHT'>0,ULNEW=0
PSR S DDBL=$S(DDBL'>DDBSRL:0,1:DDBL-DDBSRL)
 D SDLR(DDBL+1)
 Q
SDLR(L) N I,J,SFR,STO
 I +DDBRHT<L!(+DDBRHT>LIM) S DDBRHT="",ULCLR=1
 S DX=0,SFR=$P(DDBSY,";",2),STO=$P(DDBSY,";",3)
 S DY=SFR X IOXY
 F I=SFR:1:STO D
 .I $D(@DDBSA@(L)) S X=$S(DDBZN:@DDBSA@(L,0),1:@DDBSA@(L)),DDBL=DDBL+1,L=L+1
 .E  Q
 .I ULCLR,ULNEW Q
 .Q:$L(X,"$.%")'>2
 .S WRF=0,J=$P(X,"$.%",$P(DDBRHT,DDGLDEL,3)),X=$$HTD(X,L-1)
 .I +DDBRHT,J=$P(DDBRHT,DDGLDEL,2) S ULCLR=1,WRF=1
 .Q:'WRF
 .S DY=I
 .X IOXY
 .W $P(DDGLCLR,DDGLDEL),X
 .Q
 ;
 I 'ULNEW S DDBRHT=""
 Q
 ;
HTD(X,WPIEN) ;text
 Q:'DDBRHTF $E(X,DDBSF,DDBST)
 Q:$L(X,"$.")'>2 X
 S:$L(X,"$.$")>2 X=$$HT(X,"$.$","","","","","","")
 S:$L(X,"$.%")>2 X=$$HT(X,"$.%",$P(DDGLVID,DDGLDEL),$P(DDGLVID,DDGLDEL,3),WPIEN'<+DDBRHT,$S(WPIEN=+DDBRHT:$P(DDBRHT,DDGLDEL,3)+2,1:2),$P(DDGLVID,DDGLDEL,4),$P(DDGLVID,DDGLDEL,5))
 Q X
 ;
HT(Y,D,C1,C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