function addEvent(elm, evType, fn, useCapture)

// cross-browser event handling for IE5+, NS6 and Mozilla

{
if (elm.addEventListener){
elm.addEventListener(evType, fn, useCapture);
return true;
} else if (elm.attachEvent){
var r = elm.attachEvent("on"+evType, fn);
return r;
} else {
alert("Handler could not be removed");
}
}

function prepareTextBoxes(){
if (!document.getElementsByTagName) return;
var oi=0;
var thisObj;
var objs = document.getElementsByTagName("input");

for (oi=0;oi<objs.length;oi++) {
thisObj = objs[oi];
if(thisObj.getAttribute('type') == 'text'){ //For Text
thisObj.className = 'text ' + thisObj.className;
}

if(thisObj.getAttribute('type') == 'radio'){// For Radio
thisObj.className = 'radio ' + thisObj.className;
}

if(thisObj.getAttribute('type') == 'checkbox'){ //For Checkbox
thisObj.className = 'checkbox ' + thisObj.className;
}

if(thisObj.getAttribute('type') == 'button'){ //For Button
thisObj.className = 'button ' + thisObj.className;
}

if(thisObj.getAttribute('type') == 'submit'){ //For Button
thisObj.className = 'submit ' + thisObj.className;
}

}
}

addEvent(window, 'load', prepareTextBoxes);

//Focus

sfFocus = function() {
	var sfEls = document.getElementsByTagName("INPUT");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfFocus);

