function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function init(){
	var inp = document.getElementsByTagName('input');
	for(var i = 0; i < inp.length; i++) {
		if(inp[i].type == 'text') {
			inp[i].setAttribute('rel',inp[i].defaultValue)
			inp[i].onfocus = function() {
				if(this.value == this.getAttribute('rel')) {
					this.value = '';
				} else {
					return false;
				}
			}
			inp[i].onblur = function() {
				if(this.value == '') {
					this.value = this.getAttribute('rel');
				} else {
					return false;
				}
			}
			inp[i].ondblclick = function() {
				this.value = this.getAttribute('rel')
			}
		}
	}
	var imp = document.getElementsByTagName('textarea');
	for(var i = 0; i < imp.length; i++) {
		imp[i].setAttribute('rel', imp[i].defaultValue)
		imp[i].onfocus = function() {
			if(this.value == this.getAttribute('rel')) {
				this.value = '';
			} else {
				return false;
			}
		}
		imp[i].onblur = function() {
			if(this.value == '') {
				this.value = this.getAttribute('rel');
			} else {
				return false;
			}
		}
		imp[i].ondblclick = function() {
			this.value = this.getAttribute('rel')
		}
	}
}

if(document.childNodes) {
	window.onload = init
}
