function initHighlight() {
	var paddingValues= detectBrowser();
	// alert(paddingValues);
    if (!document.getElementsByTagName){ return; }
    var allfields = document.getElementsByTagName("input");

    // loop through all input tags and add events
    for (var i=0; i<allfields.length; i++){
        var field = allfields[i];
        if ((field.getAttribute("type") == "text") || (field.getAttribute("type") == "password") ) {
            field.onfocus = function () 
			   {
				this.style.border="1px solid #2c3c6f";
				this.style.padding=paddingValues;
				//this.style.padding="2px 7px 4px 5px";
				//this.className = 'highlightActiveField';
				}
            field.onblur = function () {
				this.style.border="1px solid #ffffff";
				this.style.padding=paddingValues;
				//this.className = 'highlightInactiveField';
				}
        }
    }
}

// Nifty function to add onload events without overwriting
// ones already there courtesy of the lovely and talented
// Simon Willison http://simon.incutio.com/
function addLoadEvent(func) {   
    var oldonload = window.onload;
    if (typeof window.onload != 'function'){
        window.onload = func;
    } else {
        window.onload = function(){
        oldonload();
        func();
        }
    }
}

function detectBrowser()
{

if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 var paddingValues="2px 7px 4px 5px";
 if (ieversion>=8)
 paddingValues="3px 6px 2px 6px"
 else if (ieversion>=7)
  paddingValues="3px 6px 1px 6px"
 else if (ieversion>=6)
  paddingValues="3px 6px 2px 6px"
}
else
 paddingValues="2px 7px 4px 5px";
 
 return paddingValues;

}

addLoadEvent(initHighlight);


