
//     JAVASCRIPT INCLUDE FILE - (c) J R Stockton  >= 2002-11-26
//             http://www.merlyn.demon.co.uk/include1.js
//       Routines may be copied, but URL must not be linked to.


// DynWrite(target, text) (Jim Ley) works on controls, after page load :
// it is a computed function :

// Classify browser :
var nCheck = 0
DocDom = (document.getElementById?true:false) // NS6 also IE5
                                        if (DocDom) nCheck++
DocLay = (document.layers?true:false) ; if (DocLay) nCheck++  // NS4
DocAll = (document.all?true:false) ;    if (DocAll) nCheck++  // IE4

// Define Function DynWrite(Where, What) to suit browser :
DocStr=''
if (DocLay) DocStr="return document.layers['NS_'+id]"
if (DocAll) DocStr="return document.all[id]"
if (DocDom) DocStr="return document.getElementById(id)"
GetRef=new Function("id", DocStr)

// DocLay = true ; DocAll = DocDom = false // Simulate NS4.7
DynWarn = 0

if (DocStr=='') { DynWrite=new Function("return false") } else {
 if (DocAll || DocDom) {
  DynWrite=new Function("id", "S", "GetRef(id).innerHTML=S; return true")
  }
// if (DocLay) DynWrite=new Function("id", "S", "var x=GetRef(id).document;"+
//  "x.open('text/html'); x.write(S); x.close(); return true")
 if (DocLay) DynWrite=new Function(
  "if (0==DynWarn++)"+
  " alert('DynWrite not supported in \".layers\" browsers');"+
  "return false")
 }

function NoDynLay() {
 if (DocLay) document.writeln(
  '<p><i>Dynamic Writing in a ".layers" browser ',
  'such as yours is difficult and I cannot now test it.  Therefore, ',
  'I don\'t now attempt it. An alert will be given in the first use in ',
  'each load/reload of a page.<\/i>') }

// DynWrite() end.
