function btf(){
	if(document.getElementById){
		initnoenter();
		var m=document.getElementById('menu');
		var d=m.getElementsByTagName('div');
		var x,a;
		if(d[0].id=='welcome'){
			a=d[1].childNodes;
		}else{
			a=d[0].childNodes;
		}
		var obj=this;
		for(x=0;x<3;x++){
			a[x].img=a[x].childNodes[0];
			a[x].outimg=new Image();
			a[x].outimg.src=a[x].img.src;
			a[x].hovimg=new Image();
			a[x].hovimg.src='/btf/style/images/m'+(x+1)+'-.gif';
			a[x].onmouseover=function(){
				this.img.src=this.hovimg.src;
			}
			a[x].onmouseout=function(){
				this.img.src=this.outimg.src;
			}
		}
		if(typeof(document.incidental)!='undefined'){
			this.labels=['First','Second','Third','Fourth','Fifth','Sixth','Seventh'];
			this.observerdiv=document.getElementById('observers');
			this.form=document.incidental;
			var div=document.createElement('div');
			div.className='pad';
			this.remove=false;
			this.add=document.createElement('a');
			this.add.href='#';
			this.add.appendChild(document.createTextNode('▼ Add Another Observer'));
			this.add.onclick=function(){
				return obj.addobserver();
			}
			div.appendChild(this.add);
			this.observerdiv.parentNode.insertBefore(div,this.observerdiv.nextSibling);
			this.observers=this.form['input[observers]'];
			if(Number(this.observers.value)>1) {
				this.createremove();
				var h2=this.observerdiv.getElementsByTagName('h2');
				if(h2[Number(this.observers.value)-1]){
					h2[Number(this.observers.value)-1].appendChild(this.remove);
				}
			}
		}
	}
}
btf.prototype={
addobserver:function(){
	var o=Number(this.observers.value)+1;
	this.observers.value=o;
	var l,y,obj=this;
	if(o<=7){
		l=this.labels[o-1];
	}else{
		l=String(o);
		if((o%100)<20){
			l+='th';
		}else{
			y=o%10;
			if(y==1){
				l+='st';
			}else if(y==2){
				l+='nd';
			}else if(y==3){
				l+='rd';
			}else{
				l+='th';
			}
		}
	}
	y='o'+o;
	if(this.remove && this.remove.parentNode){
		this.remove.parentNode.removeChild(this.remove);
	}else{
		this.createremove();
	}
	var div=document.createElement('h2');
	div.appendChild(document.createTextNode(l+' Observer'));
	div.appendChild(this.remove);
	this.observerdiv.appendChild(div);
	function createline(name,label,vlabel,vtype){
		var d=document.createElement('div');
		var l=document.createElement('label');
		var s=document.createElement('span');
		s.appendChild(document.createTextNode(label+': '));
		l.appendChild(s);
		var i=document.createElement('input');
		i.type='text';
		i.name='input[o'+name+']';
		i.id='observer'+name;
		i.className='ti text';
		i.setAttribute('vlabel',vlabel+':');
		i.setAttribute('vtype',vtype);
		l.appendChild(i);
		d.appendChild(l);
		obj.observerdiv.appendChild(d);
		l.htmlFor=i.id;
	}
	createline(y+'givenname','Given Name(s)',l+' Observer\'s Given Name','text');
	createline(y+'surname','Surname',l+' Observer\'s Surname','text');
	createline(y+'address','Address',l+' Observer\'s Address','text');
	createline(y+'mobile','Mobile Phone',l+' Observer\'s Mobile Number','phone');
	createline(y+'home','Home Phone',l+' Observer\'s Home Phone Number','phone');
	createline(y+'work','Work Phone',l+' Observer\'s Work Phone Number','phone');
	createline(y+'email','Email Address',l+' Observer\'s Email Address','email');
	return false;
},
createremove:function(){
	var obj=this;
	this.remove=document.createElement('span');
	this.remove.appendChild(document.createTextNode(' ['));
	div=document.createElement('a');
	div.href='#';
	div.appendChild(document.createTextNode('Remove This Observer'));
	div.onclick=function(){
		return obj.removeobserver();
	}
	this.remove.appendChild(div);
	this.remove.appendChild(document.createTextNode(']'));
},
removeobserver:function(){
	if(this.remove.parentNode){
		this.observers.value=Number(this.observers.value)-1;
		var o=this.remove.parentNode;
		o.removeChild(this.remove);
		while (o.nextSibling) {
			o.parentNode.removeChild(o.nextSibling);
		}
		o.parentNode.removeChild(o);
		if(Number(this.observers.value)>1){
			var h2=this.observerdiv.getElementsByTagName('h2');
			if(h2[Number(this.observers.value)-1]){
				h2[Number(this.observers.value)-1].appendChild(this.remove);
			}
		}
	}
	return false;
}
}
function httpreq() {
	try { return new XMLHttpRequest(); } catch(e) { }
	try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { }
	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { }
	return false;
}
function uploadhandler() {
	if (document.createElement) { // these elements preload images
		var preload = document.createElement('div');
		preload.id = 'displayhandlerpreload';
		document.body.appendChild(preload);
		this.progress=false;
		this.checking=false;
		this.ifr=document.getElementById('uploadform');
		this.submitto=/http:\/\/[^\/]+\/([^\?]*)/.exec(document.location.href);
		this.submitto=this.submitto[1];
	}
}
uploadhandler.prototype = {
	check:function(e){
		this.ifr.style.display=e.checked?"block":"none";
		if(e.checked){ e.disabled=true; }
	},
	initprogress:function(){
		this.progress=document.createElement('div');
		this.progress.id="progresswindow";
		var h1=document.createElement('h1');
		h1.appendChild(document.createTextNode('Upload Progress'));
		this.progress.appendChild(h1);
		this.ifr.parentNode.insertBefore(this.progress,this.ifr);
		this.httpreq=httpreq();
		this.container=[];
		this.cc=1;
	},
	addprogress:function(ele) {
		if(!this.progress){
			this.initprogress();
		} else {
			this.progress.style.display="block";
		}
		var c,l,t;
		c=this.container.length;
		this.container[c]=document.createElement('div');
		this.container[c].className="progresscontainer";
		l=document.createElement('div');
		l.appendChild(document.createTextNode(ele.value.replace(/.*[\/\\]/,'')));
		this.container[c].appendChild(l);
		this.container[c].barouter=document.createElement('div');
		this.container[c].barouter.className="barcontainer";
		t=document.createElement('div');
		t.className="bartrim";
		this.container[c].barouter.appendChild(t);
		this.container[c].bar=document.createElement('div');
		this.container[c].bar.className="bar";
		this.container[c].barouter.appendChild(this.container[c].bar);
		t=document.createElement('div');
		t.className="bartrim";
		this.container[c].barouter.appendChild(t);
		this.container[c].appendChild(this.container[c].barouter);
		this.container[c].perc=document.createElement('div');
		this.container[c].perc.className="barperc";
		this.container[c].perc.appendChild(document.createTextNode('...'));
		this.container[c].appendChild(this.container[c].perc);
		this.container[c].ifr=this.ifr;
		this.progress.appendChild(this.container[c]);
	},
	handlesubmit:function(ele) {
		if(document.getElementById){
			if(ele.value){
				this.addprogress(ele);
			}
			ele.form.fileid.value=this.container.length-1;
			this.ifr.style.position="absolute";
			this.ifr.style.top="-100px";
			this.ifr.style.left="0px";
			this.ifr.style.height="1px";
			this.ifr.style.overflow="hidden";
			var newifr=document.createElement('iframe');
			newifr.src=this.submitto+"?op=select&clientid="+ele.form.clientid.value+"&obs="+ele.form.obs.value;
			newifr.style.border="0";
			newifr.style.padding="0";
			newifr.width="400";
			newifr.height="100";
			this.clientid=ele.form.clientid.value;
			newifr.frameBorder="0"
			this.ifr.parentNode.insertBefore(newifr,this.ifr);
			this.ifr=newifr;
			if (this.httpreq) {
				this.checksoon();
			}
		}
		return true;
	},
	setposition:function(d) {
		var ind,w;
		for(i in d) {
			ind=Number(i);
			if(this.container[ind]){
				if(d[i]==100){
					this.container[ind].barouter.style.display="none";
					this.container[ind].perc.childNodes[0].nodeValue = 'Thankyou. This file has been received.';
				} else {
					this.container[ind].bar.style.width=((d[i]*2) + 1)+'px';
					this.container[ind].perc.childNodes[0].nodeValue = d[i]+'%';
				}
			}
		}
	},
	checksoon:function() {
		if(!this.checking) {
			this.checking=true;
			var obj=this;
			setTimeout(function(){
				obj.checkposition();
			},2000);
		}
	},
	checkposition:function() {
		obj = this;
		this.cc = this.cc + 1;
		this.httpreq.open("GET", this.submitto+"?op=p&clientid="+this.clientid+"&cc="+this.cc, true);
		this.httpreq.onreadystatechange = function() {
			if (obj.httpreq.readyState == 4) { // once complete
				try { var s = obj.httpreq.status; } catch(e) { // dodgy browser
					return;
				}
				if (s == 200) {
					obj.setposition(eval('('+obj.httpreq.responseText+')'));
					obj.checking=false;
					obj.checksoon();
				}
			}
		}
		this.httpreq.send(null); // send the request
	}
}
function initmenu() { // Popup menus
	if (document.getElementById) {
		var toplevel,menu = document.getElementById('menu');
		if(menu.childNodes[0].id=='welcome'){
			toplevel = menu.childNodes[1].childNodes;
		} else {
			toplevel = menu.childNodes[0].childNodes;
		}
		var x,curele;
		for (x = 0; x < toplevel.length; x ++) {
			curele = toplevel[x];
			if (curele.childNodes[0].tagName == 'A') {
				curele.childNodes[0].oclassname=curele.childNodes[0].className;
				this.inithover(curele,false);
			}
		}
		this.currentmenu = false;
		this.timer = false;
	}
}
initmenu.prototype={
inithover:function(td,pos) {
	var ele = td.childNodes[0],obj=this;
	ele.img = ele;
	ele.onmouseover = function(){
		obj.mouseover(this);
	}
	ele.onmouseout = function(){
		obj.mouseout(this);
	}
	if ((td.childNodes[1] != null) && (td.childNodes[1].tagName == 'UL')) {
		if (pos) {
			var abs = this.abs(td.childNodes[0]);
			td.childNodes[1].style.left = (abs[1] + 140) + 'px';
			td.childNodes[1].style.top = (abs[0] + 2) + 'px';
		}
		td.childNodes[1].ispos = pos;
		td.childNodes[1].initted = false;
		td.childNodes[1].isvisible = false;
		td.childNodes[1].menuparent = false;
		td.childNodes[1].menubutton = ele;
		td.childNodes[1].img = ele;
	}
},
close:function() {
	this.closeuntil(false);
},
closesoon:function() {
	var obj=this;
	this.timer = setTimeout(function() {
		obj.close();
	},1300);
},
norush:function() {
	clearTimeout(this.timer);
},
mouseover:function(ele) {
	if (ele.img) {
		ele.img.className = 'hover'+(ele.img.oclassname?' '+ele.img.oclassname:'');
	}
	var ul = ele.parentNode.childNodes[1];
	if ((ul != null) && (ul.tagName == 'UL')) {
		if (!ul.isvisible) {
			ul.isvisible = true;
			if (!ul.initted) {
				ul.initted = true;
				var x,y;
				for (x = 0; x < ul.childNodes.length; x ++) {
					y = ul.childNodes[x].childNodes[0];
					var obj=this;
					if (y.tagName == 'A') {
						y.onmouseover = function() {
							obj.mouseover(this);
						}
						y.onmouseout = function() {
							obj.mouseout(this);
						}
						y.img = false;
						var li = ul.childNodes[x];
						var abs = this.abs(li);
						if ((li.childNodes[1] != null) && (li.childNodes[1].tagName == 'UL')) {
							li.childNodes[1].style.marginLeft = ul.offsetWidth + 'px';
							li.childNodes[1].style.marginTop = li.offsetTop + 'px';
							li.childNodes[1].initted = false;
							li.childNodes[1].isvisible = false;
							li.childNodes[1].menuparent = ul;
							li.childNodes[1].menubutton = false;
						}
					}
				}
			}
			ul.style.visibility = 'visible';
			this.closeuntil(ul.menuparent);
			this.currentmenu = ul;
		}
	} else {
		this.closeuntil(ele.parentNode.parentNode);
	}
	this.norush();
},
closeuntil:function(ele) {
	while (this.currentmenu && (this.currentmenu != ele)) {
		if (this.currentmenu.menubutton) {
			this.currentmenu.menubutton.className = this.currentmenu.menubutton.oclassname;
		}
		this.currentmenu.style.visibility = 'hidden';
		this.currentmenu.isvisible = false;
		this.currentmenu = this.currentmenu.menuparent;
	}
},
mouseout:function(ele) {
	var ul = ele.parentNode.childNodes[1];
	if (ele.img) {
		if ((ul == null) || (ul.tagName != 'UL') || (!ul.isvisible)) {
			ele.img.className = ele.img.oclassname;
		}
	}
	this.closesoon();
},
abs:function(n) {
	var t = 0,l = 0;
	while (n && n.id!='menu') {
		t += n.offsetTop; l += n.offsetLeft; n = n.offsetParent;
	}
	return [t,l];
}
}
function treeview(element) {
	if (document.getElementById) {
		this.c=document.getElementById(element);
		var s=[],sp=0,x,ct,e=this.c.childNodes,obj=this;
		if (/#[_0-9]+$/.test(document.location.href)) {
			s=document.location.href; s=s.substr(s.indexOf('#')+1);
			s=s.split('_');
		}
		this.active = false;
		for (x=0,ct=e.length; x<ct; x++) {
			e[x].onmouseover=function() {
				this.className='h';
			}
			e[x].onmouseout=function() {
				this.className='';
			}
			e[x].onclick=function(e) {
				obj.catclick(e,this);
			}
			e[x].style.cursor=/MSIE 5/.test(navigator.userAgent)?'hand':'pointer';
			e[x].ul = e[x].childNodes[1];
			e[x].handle = false;
			if (s[sp] == x) {
				sp ++;
				e[x].ul.style.display="block";
				this.active = e[x];
			} else {
				e[x].ul.style.display="none";
			}
		}
		this.currentref=false;
		e=this.c.getElementsByTagName('a');
		for (x=0,ct=e.length; x<ct; x++) {
			e[x].handle = false;
			e[x].onclick=function() {
				return obj.linkclick(this);
			};
		}
	}
}
treeview.prototype = {
catclick:function(e,ele) {
	if (document.all) e = window.event;
	if (((e.srcElement?e.srcElement:e.target)==ele) || ((e.srcElement?e.srcElement:e.target)==ele.childNodes[0])) {
		if ((ele.ul.style.display=='block')||(ele.ul.style.display=='inline-block')) {
			ele.ul.style.display='none';
			if (ele.handle) {
				clearInterval(ele.handle);
				ele.handle = false;
			}
			this.active = false;
		} else {
			if (this.active) {
				this.active.ul.style.display = 'none';
			}
			if (this.currentref) {
				this.currentref.style.display="none";
				this.currentref = false;
			}
			this.active = ele;
			if (navigator.userAgent.indexOf("MSIE") != -1) {
				ele.ul.style.visibility='hidden';
				ele.ul.style.display='inline-block';
				try {
					ele.ul.filters[0].Apply();
					ele.ul.filters[0].Play();
				} catch(e) { }
				ele.ul.style.visibility='visible';
			} else {
				if (ele.handle) {
					clearInterval(ele.handle);
				}
				ele.ul.style.opacity='0';
				ele.ul.style.mozOpacity='0';
				ele.ul.style.display='block';
				ele.fadestart = new Date().getTime();
				var obj = this;
				ele.handle = setInterval(function() {
					obj.fadestep(ele);
				}, 20);
			}
		}
	}
},
fadestep:function(ele) {
	var c = (new Date().getTime() - ele.fadestart) / 400;
	if (c >= 1) {
		clearInterval(ele.handle);
		ele.handle=false;
		c = 100;
	}
	ele.ul.style.opacity=c;
	ele.ul.style.mozOpacity=c;
},
fadestepnoul:function(ele) {
	var c = (new Date().getTime() - ele.fadestart) / 400;
	if (c >= 1) {
		clearInterval(ele.handle);
		ele.handle=false;
		c = 100;
	}
	ele.style.opacity=c;
	ele.style.mozOpacity=c;
},
buildlist:function() {
	var r='',x,ct,e=this.c.childNodes;
	for(x=0,ct=e.length;x<ct;x++) {
		if((e[x].ul.style.display=='block')||(e[x].ul.style.display=='inline-block')) {
			if (r) r+='_';
			r+=x;
		}
	}
	return r;
},
linkclick:function(ele) {
	ele.blur();
	if (/#q[0-9]+$/.test(ele.href)) {
		var t=ele.href;
		t = t.replace(/^.*#q/,'');
		t = document.getElementById('list'+t);
		if (this.currentref) {
			if (this.currentref == t) {
				this.currentref.style.display="none";
				this.currentref = false;
				return false;
			} else {
				this.currentref.style.display="none";
			}
		}
		this.currentref=t;
		if (navigator.userAgent.indexOf("MSIE") != -1) {
			t.style.visibility='hidden';
			t.style.display='inline-block';
			try {
				t.filters[0].Apply();
				t.filters[0].Play();
			} catch(e) { }
			t.style.visibility='visible';
		} else {
			if (t.handle) {
				clearInterval(t.handle);
			}
			t.style.opacity='0';
			t.style.mozOpacity='0';
			t.style.display='block';
			t.fadestart = new Date().getTime();
			var obj = this;
			t.handle = setInterval(function() {
				obj.fadestepnoul(t);
			}, 20);
		}
		return false;
	} else {
		return true;
	}
}
}
function initgallery(imgs){
	this.links=document.getElementById('photographs');
	var x,y,a;
	var obj=this;
	this.imgs=[];
	this.current=false;
	for (x=0,y=0;x<imgs.length;x+=3){
		this.imgs[y]={'img':false,'id':imgs[x],'set':imgs[x+1],'title':imgs[x+2]};
		y++;
	}
	a=this.links.getElementsByTagName('a');
	for(x=0;x<a.length;x++){
		a[x].onclick=function(){
			return obj.load(this);
		}
	}
	this.div = document.createElement('div');
	this.div.id = 'zoom';
	this.overlay = document.createElement('div');
	this.overlay.className = 'overlay';
	this.div.appendChild(this.overlay);
	this.outputcontainer = document.createElement('div');
	this.outputcontainer.className = 'outputcontainer';
	this.title=document.createElement('div');
	this.title.className='title';
	this.outputcontainer.appendChild(this.title);
	this.div.appendChild(this.outputcontainer);
	this.output=document.createElement('div');
	this.output.className='output';
	this.outputcontainer.appendChild(this.output);
	var div=document.createElement('div');
	div.className='close';
	var a=document.createElement('a');
	a.href='#';
	a.onclick=function(){return obj.close();}
	a.innerHTML='CLOSE';
	a.className="close";
	div.appendChild(a);
	this.prevbtn=document.createElement('a');
	this.prevbtn.href='#';
	this.prevbtn.onclick=function(){return obj.prev();}
	if(navigator.userAgent.indexOf('MSIE')!=-1){
		this.prevbtn.ondblclick=function(){return obj.prev();}
	}
	this.prevbtn.onclick=function(){return obj.prev();}
	this.prevbtn.innerHTML='PREVIOUS';
	div.appendChild(this.prevbtn);
	div.appendChild(document.createTextNode("    "));
	this.nextbtn=document.createElement('a');
	this.nextbtn.href='#';
	this.nextbtn.onclick=function(){return obj.next();}
	if(navigator.userAgent.indexOf('MSIE')!=-1){
		this.nextbtn.ondblclick=function(){return obj.next();}
	}
	this.nextbtn.innerHTML='NEXT';
	div.appendChild(this.nextbtn);
	this.outputcontainer.appendChild(div);
	document.body.appendChild(this.div);
}
initgallery.prototype={
load:function(a) {
	var x,ct,set,id,r,xp=/_([0-9]+)_[0-9]+_([0-9]+)$/;
	a.blur();
	r=xp.exec(a.href);
	for(x=0,ct=this.imgs.length;x<ct;x++){
		if(r[1]==this.imgs[x].id && r[2]==this.imgs[x].set){
			this.display(x);
			return false;
		}
	}
},
display:function(x) {
	this.current=x;
	this.prevbtn.className=(x>0)?'':'disabled';
	this.nextbtn.className=(x<this.imgs.length-1)?'':'disabled';
	var height=window.innerHeight && window.scrollMaxY?window.innerHeight+window.scrollMaxY:(document.body.scrollHeight>document.body.offsetHeight?document.body.scrollHeight:document.body.offsetHeight);
	var width=window.innerWidth && window.scrollMaxX?window.innerWidth+window.scrollMaxX:(document.body.scrollWidth>document.body.offsetWidth?document.body.scrollWidth:document.body.offsetWidth);
	this.div.style.height=height+'px';
	this.overlay.style.height=height+'px';
	this.div.style.width=width+'px';
	this.overlay.style.width=width+'px';
	this.div.style.display = 'block';
	this.outputcontainer.style.left = (Math.floor(width / 2) - 310) + 'px';
	this.outputcontainer.style.top = ((document.body.parentNode.scrollTop?document.body.parentNode.scrollTop:document.body.scrollTop)+50) + 'px';
	if(this.output.childNodes.length) {
		this.output.removeChild(this.output.childNodes[0]);
	}
	if(this.imgs[x].img == false) {
		var i='photographs.nb?nb%5Bop%5D=image&nb%5Bsize%5D=3&nb%5Bid%5D='+this.imgs[x].id+'&nb%5Bsrc%5D='+this.imgs[x].set;
		this.imgs[x].img=new Image();
		var obj=this;
		if(typeof(this.imgs[x].img.complete)!='undefined') {
			this.imgs[x].img.onload=function() {
				obj.show(x);
			}
			this.imgs[x].img.src=i;
			this.title.innerHTML="Loading...";
		}else{
			this.imgs[x].img.src=i;
			this.output.appendChild(this.imgs[x].img);
			this.title.innerHTML=unescape(this.imgs[x].title);
		}
	}else{
		if(typeof(this.imgs[x].img.complete)=='undefined'){
			this.output.appendChild(this.imgs[x].img);
			this.title.innerHTML=unescape(this.imgs[x].title);
		}else if(this.imgs[x].img.complete){
			this.output.style.height=this.imgs[x].img.height + 'px';
			this.output.appendChild(this.imgs[x].img);
			this.title.innerHTML=unescape(this.imgs[x].title);
		}
	}
	return false;
},show:function(x) {
	if(this.current==x){
		this.output.style.height=this.imgs[x].img.height + 'px';
		this.output.appendChild(this.imgs[x].img);
		this.title.innerHTML=unescape(this.imgs[x].title);
	}
},close:function() {
	this.div.style.display='none';
	return false;
},prev:function() {
	if(this.current&&(this.current>0)){
		this.display(this.current-1);
	}
	this.prevbtn.blur();
	return false;
},next:function() {
	if(this.current!==false&&(this.current<this.imgs.length-1)){
		this.display(this.current+1);
	}
	this.nextbtn.blur();
	return false;
}
}
function updatesuburbs(ele) {
	if (typeof(window._suburbhttp) == 'undefined') {
		window._suburbhttp = httpreq();
	}
	if (window._suburbhttp) {
		var tgt=ele.form['input[suburb]'];
		var x;
		for (x=tgt.length-1;x>=0;x--) {
			tgt.options[x]=null;
		}
		tgt.options[0]=new Option('Please wait...','0');
		tgt.selectedIndex=0;
		window._suburbhttp.open('GET','become_a_volunteer.nb?data='+ele.value,true);
		window._suburbhttp.onreadystatechange=function(){
			if(window._suburbhttp.readyState==4){
				if(window._suburbhttp.status==200){
					var data=eval('('+window._suburbhttp.responseText+')');
					tgt.options[0]=null;
					tgt.selectedIndex=0;
					for (x=0;x<data.length;x++) {
						tgt.options[x]=new Option(data[x][1],data[x][0]);
					}
				}else{
					window.location.href=loc;
				}
			}
		}
		window._suburbhttp.send(null);
	}
}
function initnoenter(frm) {
	function setupcallback(nextele) {
		return function(e) {
			if(typeof(e)=='undefined') e = window.event;
			if (e.keyCode == 13) {
				if (nextele.select) {
					nextele.select();
				} else {
					nextele.focus();
				}
				if (e.stopPropagation) e.stopPropagation; // standards
				e.cancelBubble = true; // ie
				return false;
			}
		}
	}

	var x,y,frm,f=document.forms;

	for(y=f.length-1;y>=0;y--) {
		frm=f[y];
		var ele = frm.elements;

		for (x = 0; x < ele.length - 1; x ++) {
			if (ele[x].nodeName && (ele[x].nodeName.toUpperCase() != 'TEXTAREA')) {
				ele[x].onkeypress = setupcallback(ele[x+1]);
			}
		}
	}
}
function tweets(){
	if(document.getElementById){
		this.form=document.chirpform;
		this.form.tweets=this;
		this.httpreq=false;
		this.inhttp=false;
		this.out=document.getElementById('tweets');
		this.form.onsubmit=function(){
			return this.tweets.sendchirp();
		}
		this.input=this.form.chirp;
		this.input.onfocus=function(){
			if(this.value=='Type your chirp here...'&&this.className!='ready ti'){
				this.value='';
				this.className='ready ti';
			}
		}
		this.input.onblur=function(){
			if(this.value==''){
				this.value='Type your chirp here...';
				this.className='ti';
			}
		}
		this.input.onkeypress=function(e){
			if(typeof(e)=='undefined') e = window.event;
			if(e.keyCode==13){
				this.form.tweets.sendchirp();
				if(e.stopPropagation) e.stopPropagation;
				e.cancelBubble = true;
				return false;
			}
			if(e.keyCode==27){
				this.value='';
				this.blur();
			}
		}
		var obj=this;
		setTimeout(function(){
			obj.timeout();
		},10000);
	}
}
tweets.prototype={
sendchirp:function(){
	if(this.input.value!=''&&this.input.value!='Type your chirp here...'){
		var chirp=this.input.value,obj=this;
		this.input.blur();
		this.input.value='Sending...';
		this.input.className='ti';
		this.input.readOnly=true;
		if(this.httpreq==false){
			this.httpreq=httpreq();
		}
		if(this.httpreq){
			this.httpreq.open("GET", "/member_area.nb?chirp="+escape(chirp), true);
			this.httpreq.onreadystatechange=function() {
				if (obj.httpreq.readyState==4) {
					try { var s=obj.httpreq.status; }catch(e){ return; }
					obj.inhttp=false;
					if (s==200){ obj.showtweets(obj.httpreq.responseText); }
					obj.input.value="Type your chirp here...";
					obj.input.readOnly=false;
				}
			}
			this.inhttp=true;
			this.httpreq.send(null);
		}else{
			this.form.submit();
		}
	}
	return false;
},
timeout:function(){
	var obj=this;
	if(this.httpreq==false){
		this.httpreq=httpreq();
	}
	if(this.httpreq&&!this.inhttp){
		this.httpreq.open("GET", "/member_area.nb?chirps=1", true);
		this.httpreq.onreadystatechange=function() {
			if (obj.httpreq.readyState==4) {
				try { var s=obj.httpreq.status; }catch(e){ return; }
				if (s==200){ obj.showtweets(obj.httpreq.responseText); }
				setTimeout(function(){
					obj.timeout();
				},10000);
			}
		}
		this.httpreq.send(null);
	}
},
showtweets:function(tweets){
	this.out.innerHTML=tweets;
}
}

