// JavaScript Document to fix autofill //

function restoreStyles() {
    if (event.srcElement.style.backgroundColor !== '') {
        event.srcElement.style.backgroundColor = '';
    }
}

function setListeners() {
    var inputList  = document.getElementsByTagName('input'),
        selectList = document.getElementsByTagName('select'),
        i;

    for (i = 0; i < inputList.length; i++) {
        inputList[i].attachEvent('onpropertychange', restoreStyles);
        inputList[i].style.backgroundColor = '';
    }

    for (i = 0; i < selectList.length; i++) {
        selectList[i].attachEvent('onpropertychange', restoreStyles);
        selectList[i].style.backgroundColor = '';
    }
}

if (window.attachEvent) {
    window.attachEvent('onload', setListeners);
}
