function getStyle(el,styleProp) {
	/* 	Created by Peter-Paul Koch
		http://www.quirksmode.org/dom/getstyles.html */
	var x = document.getElementById(el);
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}

function fncGoButton () {
	if (document.getElementById) {
		var go = document.getElementById('go');
		var border = getStyle ("go","border");
		if (typeof(borderColor) == "undefined")				// if we coudn't read the style
			borderColor = "border: 1px solid";			// deafult border style
		go.onfocus = function () {this.style.border = "1px solid #000"; };
		go.onblur = function () {this.style.cssText = border; };
	}
}

function initOverLabels () {
/*	created by Mike Brittan
	http://www.alistapart.com/articles/makingcompactformsmoreaccessible
*/
  	if (!document.getElementById) return;
  	var labels, id, field;
  	// Set focus and blur handlers to hide and show LABELs with 'overlabel' class names.  
  	labels = document.getElementsByTagName('label');
 	for (var i = 0; i < labels.length; i++) {
		if (labels[i].className == 'overlabel') {
			id = labels[i].htmlFor || labels[i].getAttribute('for');// Skip labels that do not have a named association with another field.
			if (!id || !(field = document.getElementById(id)))
				continue;
			var originalcolor = getStyle (id,"color");				// read the color style
			if (typeof(originalcolor) == "undefined")				// if we coudn't read the style
				originalcolor = "color: #000";						// default color
			var originalborder = getStyle (id,"border");			// read the border style
			if (typeof(originalborder) == "undefined")				// if we coudn't read the style
				originalborder = "border: 1px solid";				// deafult border style
			labels[i].className = 'overlabel-apply';				// Change the applied class to hover the label over the form field.
			if (field.value !== '')									// Hide any fields having an initial value.
			hideLabel(field.getAttribute('id'), true);
			field.onfocus = function () {
				this.style.border = "1px solid #000";
				this.style.color = "#000";
				hideLabel(this.getAttribute('id'), true);
			};														// Set handlers to show and hide labels.
			field.onblur = function () { 
				this.style.cssText = originalborder + ";  color: " + originalcolor + ";";
				if (this.value === '') hideLabel(this.getAttribute('id'), false); 
			}; 														// Handle clicks to LABEL elements (for Safari).
			labels[i].onclick = function () {
				var id, field;
				id = this.getAttribute('for');
				if (id && (field = document.getElementById(id)))
					field.focus();
			};
		}
	}
};
function hideLabel (field_id, hide) {
 	var field_for;
 	var labels = document.getElementsByTagName('label');
  	for (var i = 0; i < labels.length; i++) {
    	field_for = labels[i].htmlFor || labels[i].getAttribute('for');
    	if (field_for == field_id) {
      	labels[i].style.textIndent = (hide) ? '-9999px' : '0px';
      	return true;
    	}
  	}
}
fncAddLoadEvent (function () {  setTimeout(initOverLabels, 50); } );
fncAddLoadEvent ( fncGoButton ); 