﻿// JScript File
// style : green border on focus / gray border normal
var normal = 'solid 1px gray';
var highlite = 'solid 1px green';
var error = 'solid 1px red';


// Element Focusing functions ////////////////////////////////////////

function dofocus(){
    this.style.border = highlite

}
function doblur(){
    this.style.border = normal;

}
/////////////////////////////////////////////////////////////////////


function assignOnloadFunctions(){
var	frm = document.forms[0]; 
     for(i=0; i<frm.length; i++){

            //skip for invalid forms
            if ((frm.elements[i].type != "hidden") ||(frm.elements[i].type != "checkbox") ){
				if (typeof document.attachEvent!='undefined') {
					frm.elements[i].attachEvent('onfocus',dofocus);
				}
				else {
					frm.elements[i].addEventListener('focus',dofocus,false);
				}
				if (typeof document.attachEvent!='undefined') {
					frm.elements[i].attachEvent('onblur',doblur);
				}
				else {
					frm.elements[i].addEventListener('blur',doblur,false);
				}
                frm.elements[i].style.border = normal;
                
            }
            
        } 
}

//attach events to window onload
if (typeof document.attachEvent!='undefined') {
    window.attachEvent('onload',assignOnloadFunctions);
}
else {
    window.addEventListener('load',assignOnloadFunctions,false);
}

//////////////////////////////////////////////////////////