// f78 Add <TEXTAREA> Line Numbers (26-August-2006)
// by Vic Phillips http://www.vicsjavascripts.org.uk


// **** Functional Code - NO NEED to Change


function f78AddLines(f78obj,f78h,f78col,zxcnu){
 if (typeof(f78obj)=='string'){ f78obj=document.getElementById(f78obj); }
 var f78p=f78obj.parentNode;
 var f78div=f78Style('DIV',{position:'relative',overflow:'auto',width:f78obj.offsetWidth+'px',height:f78obj.offsetHeight+'px',backgroundColor:(f78col||'white'),border:'solid #565656 1px',borderRight:'#B7B7B7',borderBottom:'#B7B7B7'});
 f78p.insertBefore(f78div,f78obj);
 f78p.removeChild(f78obj);
 f78div.appendChild(f78obj);
 f78Style(f78obj,{position:'relative',top:'0px',height:(f78h)+'px',border:'0px'});
 var f78ldiv=f78Style('DIV',{position:'absolute',overflow:'hidden',left:'0px',top:'0px',height:(f78h+5)+'px'});
 f78div.appendChild(f78ldiv);
 var f78lines=f78obj.cloneNode(true);
 f78lines.removeAttribute('id');
 f78lines.cols='4';
 f78lines.disabled=true;
 f78Style(f78lines,{position:'relative',left:(0)+'px',top:'0px',height:'7600px'});
 f78lines.value=f78Numbers(zxcnu||500);
 f78ldiv.appendChild(f78lines);
 f78div.appendChild(f78ldiv);
 if (f78obj.wrap=='off'){ f78obj.style.width=(f78obj.scrollWidth+f78lines.offsetWidth*.7)+'px'; }
 f78obj.style.left=(f78lines.offsetWidth*.6+1)+'px';
 f78ldiv.style.width=(f78lines.offsetWidth*.6)+'px';
 if (f78h){
  f78div.tog=[f78div.offsetHeight,f78h,f78obj,f78ldiv]
  f78div.ondblclick=function(){ f78Expand(this); }
 }
}

function f78Style(f78ele,f78style){
 if (typeof(f78ele)=='string'){ f78ele=document.createElement(f78ele); }
 for (key in f78style){ f78ele.style[key]=f78style[key]; }
 return f78ele;
}

function f78Numbers(f78nu){
 var f78val='';
 for (var f780=1;f780<=f78nu;f780++){ f78val+=(f780<10)?'00'+f780+'\n':(f780<100)?'0'+f780+'\n':f780+'\n'; }
 return f78val;
}

function f78Expand(f78obj){
 f78obj.style.height=(f78obj.offsetHeight<f78obj.tog[1])?f78obj.tog[1]+'px':f78obj.tog[0]+'px';
 f78obj.tog[2].scrollTop=0;
}

