var lu1;

var bw1 = 1001;

function up1(Kt1, Lt1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'move' ,kt1+ut1);

var Rt1 = 10;
var fy1 = 1000;

if  (  isNaN(Kt1) &&  isNaN(Lt1) )  { return(fy1);}
if  (  !isNaN(Kt1) &&  isNaN(Lt1) )  { return( al1((Kt1*1)+fy1, 0) );  }
if  (  isNaN(Kt1) && !isNaN(Lt1) )  { Kt1=0;}
if  ( !isNaN(Kt1) && !isNaN(Lt1) )  {}

Kt1 = Kt1 - 0;
Lt1 = Lt1 - 0;

if (Kt1 >= Lt1) {JSDebug( '' , 'not able to create position number between :' +Kt1 + ' ' + Lt1); }
var Gw1 = Kt1/2 + Lt1/2;
var qt1 = 0;
var ly1 = al1(Gw1,qt1);
while ( qt1 <= Rt1 && (ly1<=Kt1 || ly1>=Lt1) )  {
ly1 = al1(Gw1,qt1);
qt1 += 1;
}
if (ly1<=Kt1 || ly1>=Lt1) {
JSDebug( '' , 'not able to create position number. RoundedPos :' + ly1 + '    NrA :' + Kt1 + '    NrB :' + Lt1);
}
JSDebug( 'move' , ' old position ' + Kt1 + ' __ ' + Lt1 + ' ' );
JSDebug( 'move' , ' new position ' + Kt1 + ' ' + ly1 + ' ' + Lt1);
return(ly1);
}

function sl1() {
}

function ou1 (Gq1, Gw1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'add' ,kt1+ut1);

Iu1();
DivId = 'd' +Gq1;
var He1 = "" ;
var Ht1;
var My1 = document.getElementById(DivId);

top.TreeFrame.xu1 (bw1, '' ,My1.par,My1.typ,My1.rtp) ;
if (Sy1.isIE || Sy1.isNS) {
if (Gw1== 'After' ) {
Gt1 = up1(My1.whe, My1.nextSibling.whe);
}else {
Gt1 = up1(My1.previousSibling.whe, My1.whe);
}
Did = "d" + bw1;
var Hr1 = "bullet" + bw1;
var Dd1 = document.createElement( "tr" );
Dd1.setAttribute( "id" ,Did);
Dd1.setAttribute( "name" ,Did);
Dd1.setAttribute( "typ" ,My1.typ);
Dd1.setAttribute( "par" ,My1.par);
Dd1.setAttribute( "rtp" ,My1.rtp);
Dd1.setAttribute( "whe" ,Gt1);

var Ed1 = document.createElement( "td" );
Ed1.setAttribute( "className" , "hs" );
He1 = "" ;
He1 += "<div" ;
He1 += tl1 ( "CLASS" , "hs" );
He1 += tl1 ( "onmouseover" , "className='hsmo'" );
He1 += tl1 ( "onmouseout" , "className='hs'" );
He1 += tl1 ( "onclick" , "ou1('" +bw1+ "','Before')" );
He1 += tl1 ( "onmouseup" , "kp1('" +bw1+ "')" );
He1 += ">-</div\n>" ;
Ed1.innerHTML += He1;
He1 = "" ;
He1 += "<div" ;
He1 += tl1 ( "CLASS" , "hs2" );
He1 += tl1 ( "id" ,         Hr1);
He1 += tl1 ( "onmouseover" , "className='hs2mo';rl1(this,'" +bw1+ "')" );
He1 += tl1 ( "onmouseout" , "className='hs2';el1(this,'" +bw1+ "')" );
He1 += tl1 ( "onmousedown" , "vp1('" +bw1+ "')" );

He1 += tl1 ( "onclick" , "OpenItem('" +bw1+ "')" );
He1 += ">&#176</div>\n" ;
Ed1.innerHTML += He1;

Dd1.appendChild(Ed1);

var Ad1 = document.createElement( "td" );
TAid = "a" + bw1;
He1 = "" ;
He1 += "<textarea" ;
He1 += tl1 ( "name" ,    TAid);
He1 += tl1 ( "id" ,      TAid);
He1 += tl1 ( "CLASS" , "item" );
He1 += tl1 ( "rows" ,    1);
He1 += tl1 ( "cols" ,    50);
He1 += tl1 ( "wrap" , "soft" );
He1 += tl1 ( "onKeyUp" , "xp1( this, event, '" +bw1+ "')" );
He1 += tl1 ( "onblur" , "cu1('" +bw1+ "',this.value)" );
He1 += "></textarea\n>" ;
Ad1.innerHTML = He1;
Dd1.appendChild(Ad1);

var Sd1 = document.createElement( "td" );
He1 = "" ;
He1 += "<input" ;
He1 += tl1 ( "name" , "c" +bw1);
He1 += tl1 ( "id" , "c" +bw1);
He1 += tl1 ( "type" , "hidden" );
He1 += tl1 ( "value" ,   My1.typ);
He1 += " >" ;

He1 += "<input" ;
He1 += tl1 ( "name" , "p" +bw1);
He1 += tl1 ( "id" , "p" +bw1);
He1 += tl1 ( "type" , "hidden" );
He1 += tl1 ( "value" ,   My1.par);
He1 += " >" ;

He1 += "<input" ;
He1 += tl1 ( "name" , "f" +bw1);
He1 += tl1 ( "id" , "f" +bw1);
He1 += tl1 ( "type" , "hidden" );
He1 += tl1 ( "value" ,   My1.rtp);
He1 += " >" ;

He1 += "<input" ;
He1 += tl1 ( "name" , "w" +bw1);
He1 += tl1 ( "id" , "w" +bw1);
He1 += tl1 ( "type" , "hidden" );
He1 += tl1 ( "value" ,   Gt1);
He1 += " >" ;
Sd1.innerHTML = He1;
Dd1.appendChild(Sd1);

if (Gw1== 'After' ) {
if(My1.parentNode.lastChild==My1) {My1.parentNode.appendChild(Dd1);}
else {My1.parentNode.insertBefore(Dd1,My1.nextSibling);}
}else {
My1.parentNode.insertBefore(Dd1,My1);
}
Ht1 = document.getElementById(TAid);
Ht1.select();
}
bw1++;
return (Ht1);
}




var St1;

function vp1 (Gq1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'move' ,kt1+ut1);

St1=Gq1;
}

function kp1 (Gq1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'move' ,kt1+ut1);

Iu1();
var My1 = document.getElementById( 'd' +Gq1);
var vd1 = document.getElementById( 'd' +St1);

if (1 == 1 && St1 != Gq1) {
var Gt1 = up1(My1.previousSibling.whe, My1.whe);
vd1.parentNode.removeChild(vd1);
My1.parentNode.insertBefore(vd1,My1);
vd1.whe = Gt1;
var Oe1 = document.getElementById( 'w' +St1);
Oe1.value = Gt1;

var Dt1 = document.getElementById( 'p' +St1);
var Mr1 = document.getElementById( 'p' +Gq1);
Dt1.value = Mr1.value;

var At1 = document.getElementById( 'c' +St1);
var Lr1 = document.getElementById( 'c' +Gq1);
At1.value = Lr1.value;

St1= '' ;
var oy1 = document.getElementById( 'x' +St1);
if (!oy1) { oy1 = document.getElementById( 'a' +St1); }
if (oy1 && oy1.type != 'hidden' ) { oy1.focus(); oy1.select();}
}
}

function lp1 (Gq1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'move' ,kt1+ut1);

Iu1();
var My1 = document.getElementById( 'd' +Gq1);
var Ay1;
if (My1.previousSibling.previousSibling) {
Ay1 = My1.previousSibling;
var Gt1 = up1(Ay1.previousSibling.whe, Ay1.whe);
JSDebug( 'move' , ' cell.pre.pre.whe ' +My1.previousSibling.previousSibling.name+ ' ' +My1.previousSibling.previousSibling.whe);
JSDebug( 'move' , ' cell.pre.whe ' +My1.previousSibling.name+ ' ' +My1.previousSibling.whe);
JSDebug( 'move' , ' cell.whe ' +My1.name+ ' ' +My1.whe);
JSDebug( 'move' , ' newpos ' +Gt1);

My1.parentNode.removeChild(My1);
Ay1.parentNode.insertBefore(My1,Ay1);

My1.whe = Gt1;
var Oe1 = document.getElementById( 'w' +Gq1);
Oe1.value = Gt1;
}
var oy1 = document.getElementById( 'x' +Gq1);
if (!oy1) { oy1 = document.getElementById( 'a' +Gq1); }
if (!oy1 || oy1.type == 'hidden' ) { oy1 = document.getElementById( 'h' +Gq1); }
if (oy1 && oy1.type != 'hidden' ) {oy1.focus(); oy1.select(); }
}

function pp1 (Gq1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'move' ,kt1+ut1);

Iu1();
var My1 = document.getElementById( 'd' +Gq1);
var Ay1;
if (My1.nextSibling.nextSibling) {
Ay1 = My1.nextSibling.nextSibling;
var Gt1 = up1(Ay1.previousSibling.whe, Ay1.whe);
JSDebug( 'move' , ' cell.whe ' +My1.name+ ' ' +My1.whe);
JSDebug( 'move' , ' cell.next.whe ' +Ay1.previousSibling.name+ ' ' +Ay1.previousSibling.whe);
JSDebug( 'move' , ' cell.next.next.whe ' +Ay1.name+ ' ' +Ay1.whe);
JSDebug( 'move' , ' newpos ' +Gt1);

My1.parentNode.removeChild(My1);
Ay1.parentNode.insertBefore(My1,Ay1);

My1.whe = Gt1;
var Oe1 = document.getElementById( 'w' +Gq1);
Oe1.value = Gt1;
}
var oy1 = document.getElementById( 'x' +Gq1);
if (!oy1) { oy1 = document.getElementById( 'a' +Gq1); }
if (!oy1 || oy1.type == 'hidden' ) { oy1 = document.getElementById( 'h' +Gq1); }
if (oy1 && oy1.type != 'hidden' ) {oy1.focus(); oy1.select(); }
}

function Fu1 (Gq1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'goto' ,kt1+ut1);

var My1 = document.getElementById( 'd' +Gq1);
var ht1;
if (My1.previousSibling.previousSibling) {
ht1 = My1.previousSibling;
var oy1 = document.getElementById( 'x' + ht1.id.substr(1,ht1.id.length-1));
if (!oy1) { oy1 = document.getElementById( 'a' + ht1.id.substr(1,ht1.id.length-1)); }
if (!oy1 || oy1.type == 'hidden' ) { oy1 = document.getElementById( 'h' + ht1.id.substr(1,ht1.id.length-1)); }
if (oy1 && oy1.type != 'hidden' ) {oy1.focus();}
}
}

function Du1 (Gq1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'goto' ,kt1+ut1);

var My1 = document.getElementById( 'd' +Gq1);
var ht1;
if (My1.nextSibling.nextSibling) {
ht1 = My1.nextSibling;
var oy1 = document.getElementById( 'x' + ht1.id.substr(1,ht1.id.length-1));
if (!oy1) { oy1 = document.getElementById( 'a' + ht1.id.substr(1,ht1.id.length-1)); }
if (!oy1 || oy1.type == 'hidden' ) { oy1 = document.getElementById( 'h' + ht1.id.substr(1,ht1.id.length-1)); }
if (oy1 && oy1.type != 'hidden' ) {oy1.focus();}
}
}


var Tt1 = 1 ;
var Ut1 = 10000 ;
var Yt1 = 50 ;
var It1 = 50 ;
var wt1 = 0;

function xp1 (su1, Xy1, Gq1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'resize' ,kt1+ut1);
JSDebug( 'resize' , 'TxtA::xp1 ' +su1+ ' ' +Xy1+ ' ' +Gq1);
DivId = 'd' +Gq1;
var md1;
var nd1;
var bd1;
var Pd1;
var rt1;
var tt1;
var zy1;






var hu1 = su1.value;

if (window.event) {
md1 = window.event.keyCode;
nd1 = window.event.ctrlKey;
bd1 = window.event.altKey ;
Pd1 = window.event.shiftKey ;
}
else if (Xy1) {md1 = Xy1.which;}

JSDebug( 'resize' , "keycode: " + md1 + "  " + nd1 + "  " + bd1 + "  " + Pd1);





if (Gq1 != my1){

if (md1 == 13){
if (ty1 == "enter" ) {
if ( escape (hu1.substr(hu1.length-2,2)) == "%0D%0A" ) {
ou1 (Gq1, 'After' );
su1.value = hu1.substr(0,hu1.length-2);
hu1 = hu1.substr(0,hu1.length-2);
}
}
else if (ty1 == "entertwice" ) {
if ( escape (hu1.substr(hu1.length-4,4)) == "%0D%0A%0D%0A" ) {
ou1 (Gq1, 'After' );
su1.value = hu1.substr(0,hu1.length-4);
hu1 = hu1.substr(0,hu1.length-4);
} else {



}
}
else if (ty1 == "no" ) {}
else {}
}
if (md1 == 8 || md1 == 46 ){
if  (su1.value.length == 0 && wt1>0 ) {
wt1 =0;

var Vt1 = document.getElementById( 'p' +Gq1)
var Jr1 = document.getElementById( 'c' +Gq1)
var pt1 = document.getElementById( 'f' +Gq1)
top.TreeFrame.op1(Gq1,Vt1.value,Jr1.value,pt1.value);

Iu1();
rt1 = document.getElementById( 'd' +Gq1);
tt1 = rt1.parentNode;

if ( document.getElementById( 'o' +Gq1) ){
var yy1 = "r" + Gq1;
var py1 = document.createElement( "input" );
py1.setAttribute( "name" ,yy1);
py1.setAttribute( "id" ,yy1);
py1.setAttribute( "type" , "hidden" );
py1.setAttribute( "value" ,yy1);
tt1.appendChild(py1);
zy1 = document.getElementById( 'x' +Gq1);
tt1.appendChild(zy1.parentNode.nextSibling)
}
Fu1 (Gq1);
tt1.removeChild(rt1);
}
else{
wt1++;

}

}
JSDebug( 'resize' , "test keycodes" );
if (md1 == 38 && nd1) { lp1 (Gq1) }
if (md1 == 40 && nd1) { pp1 (Gq1) }
if (md1 == 38 && bd1)  { Fu1 (Gq1) }
if (md1 == 40 && bd1)  { Du1 (Gq1) }
}

var gu1 = hu1.length;
var Jd1 = 0 ;


var Wy1 = su1.value.split( "\n" );

for(var i=0; i<=Wy1.length-1; i++){

Jd1++;
if(Wy1[i].length > It1-5) {


Jd1 += Math.ceil(Wy1[i].length/(It1-5))-1
}
}

if (Sy1.isNS) {Jd1--;}

if(gu1 == 0){

su1.cols = Yt1 ;
su1.rows = Tt1 ;
} else {


if(Jd1 <= 1) {
su1.cols = (gu1 % It1) + 1 >= Yt1 ? ((gu1 % It1) + 1) : Yt1 ;
su1.rows = Tt1;
}else{

su1.cols = It1 ;
su1.rows = Jd1 > Ut1 ? Ut1 : Jd1 ;
}
}
}




function cu1 (Gq1,ne1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'edit' ,kt1+ut1);





if (re1 == 'Edit' ){
top.TreeFrame.Ou1(Gq1,ne1);
}else if (re1 == 'Design' ){
top.StrucTreeFrame.Pu1(Gq1,ne1);
top.TreeFrame.Ou1(Gq1,ne1);
}
Iu1();

}


function Iu1(){

top.ButtonsFrame.document.all.ScreenName.innerText += "*" ;
top.BodyFrame.document.form1.changed = true;
}



function ol1 (Ny1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'edit' ,kt1+ut1);
if (Ny1.createTextRange) {
var wu1 = Ny1.createTextRange();
wu1.collapse(false);
wu1.select();
}
else if (Ny1.setSelectionRange) {
Ny1.focus();
var sy1 = Ny1.value.length;
Ny1.setSelectionRange(sy1, sy1);
}
}


function zl1 (Ny1) {
var kt1=Xp1();var ut1= '' ; for(var i=0;i<arguments.length;i++)ut1+= ", " +arguments[i];
JSDebug( 'edit' ,kt1+ut1);
if (Ny1.createTextRange) {
var wu1 = Ny1.createTextRange();
wu1.collapse(true);
wu1.select();
}
else if (Ny1.setSelectionRange) {
Ny1.focus();
Ny1.setSelectionRange(0, 0);
}
}



