//DynObject v1.34
//15th May 2002
//karl.bunyan@dna.co.uk

var bT = navigator.appName
var b;
if (bT=="Netscape") b = "ns"
else if (bT=="Microsoft Internet Explorer") b = "ie"
else b=bT
var version = navigator.appVersion
var v = parseInt(version)
var ns = b=="ns" && v>=4
var ns4 = b=="ns" && v==4
var ns5 = b=="ns" && v>=5
var ie = b=="ie" && v>=4
var ie4 = version.indexOf('MSIE 4')>0
var ie5 = version.indexOf('MSIE 5')>0
var ie6 = version.indexOf('MSIE 6')>0
var isMac = (navigator.appVersion.indexOf("Mac") != -1);

if(ie4||ns4)document.getElementById=new Function("id","return document.all[id]")
if(ie4)document.getElementsByTagName=new Function("objTag","return document.all.tags(objTag)");

function DynObject(id,parElm) {
	this.id = id
	if (ns4) {
		this.parElm = parElm||document
		var t = document.all[id] = this.ref = this.css = this.parElm[id]
		this.doc = t.document
		this.x = t.left
		this.y = t.top
		this.w = t.clip.width
		this.h = t.clip.height
		spiderLayers(this.doc.layers)
		innerObject("Img","images",this)
		innerObject("Form","forms",this)
	}
	else if (ie||ns5){
		var t = this.ref = document.getElementById(id)
		this.css = t.style
		this.doc = document
		this.x = t.offsetLeft
		this.y = t.offsetTop
		this.w = ie4 ? this.css.pixelWidth : t.offsetWidth
		this.h = ie4 ? this.css.pixelHeight : t.offsetHeight
		var parId=this.ref.offsetParent.id
		this.parElm=parId ? eval(parId+"Div") : document
	}
	this.obj = id + "DynObject"
	eval(this.obj + "=this")
}

function DynObjectInit() {
	if (ns4) {
		document.all=new Object();
		document.doc=document;
		innerObject("Img","images",document)
		innerObject("Form","forms",document)
		spiderLayers(document.layers)
	}
	else if (ie||ns5) {
		spiderLayers(document.getElementsByTagName("div"))
		innerObject("Img","img")
		innerObject("Form","form")
	}
}

function spiderLayers(layRef){
	var arrLen=layRef.length;
	for(var i=0;i<arrLen;i++){
		var divname = layRef[i].id
		if(divname)eval(divname+'Div = new DynObject(divname,layRef)')
	}
}

function DynObjectShow() {
	this.css.visibility = ns4 ? "show" : "visible"
}

function DynObjectHide() {
	this.css.visibility = ns4 ? "hide" : "hidden"
}

function DynObjectInherit() {
	this.css.visibility="inherit";
}

DynObject.prototype.show = DynObjectShow
DynObject.prototype.hide = DynObjectHide
DynObject.prototype.inherit = DynObjectInherit

function DynObjectWrite(html) {
	if (ns4) {
		this.doc.open()
		this.doc.write(html)
		this.doc.close()
	}
	else if (ie||ns5) {
		this.ref.innerHTML = html
	}
}
DynObject.prototype.write = DynObjectWrite

function innerObject(objName,objTag,parElm){
	var docElm;
	if (ns5||ie)docElm=document.getElementsByTagName(objTag);
	else if(ns4)docElm=parElm.doc[objTag];
	for (var i=0; i<docElm.length; i++) {
		var id = docElm[i].name||docElm[i].id;
		if(id&&(id.name!='name'))eval(id.replace(/\s/g,'')+objName+'= new TypeObject(id,parElm,objTag)');
	}
}

function TypeObject(id,parElm,objTag){
	this.name=id
	if(ns4)this.ref=document.all[id]=parElm.doc[id]
	else if(ie5&&isMac)this.ref=document.all[id]
	else this.ref=document.getElementById(id)
	if(this.ref.src){
		this.rollOn=new Image()
		this.rollOff=new Image()
		this.rollOn.src=this.ref.src.replace(/off.gif/,'on.gif')
		this.rollOff.src=this.ref.src.replace(/on.gif/,'off.gif')
	}
}

function roll(imgObj,imgSrc){
	if (eval('typeof '+imgObj +'=="object"')){
		if(typeof eval(imgSrc)=='string')imgSrc=eval(imgSrc)
		eval(imgObj+".ref.src=imgSrc")
	}
}