// Create highlight object 
highlight = { 
    /************************************* Properties ********************************************************/ 
    // Page section IDs 
    textinputID:'enquiry_name', 
    // Style for highlighted textbox 
    highlightClass:'form_highlight', 
    /************************************* Initialise functionality ********************************************************/ 
      // Initilise object 
      init:function() 
      { 
      /****************** Checks to see if the DOM is available (the browser supports it) AND the element is available ******/ 
        // Check to see if W3C DOM is available - if not terminate script 
        if(!document.getElementById || !document.createTextNode){return;} 
        container = document.getElementById(highlight.textinputID); 
        if(container) 
        { 
            // Add the onclick event behaviour to the link 
            helperMethods.addEvent(container,'click', highlight.highlightField,false); 
            // Add the onclick event behaviour to the link 
            helperMethods.addEvent(container,'blur', highlight.removeFieldHighlight,false); 
        }; 
      }, 
      highlightField:function() 
    { 
        container = document.getElementById(highlight.textinputID); 
        container.setAttribute("class", highlight.highlightClass); 
    }, 
    removeFieldHighlight:function() 
    { 
        helperMethods.cssjs('remove', container ,highlight.highlightClass); 
    } 
} 
helperMethods = { 
    addEvent: function(elm, evType, fn, useCapture) 
    { 
        if (elm.addEventListener) 
        { 
            elm.addEventListener(evType, fn, useCapture); 
            return true; 
        } else if (elm.attachEvent) { 
            var r = elm.attachEvent('on' + evType, fn); 
            return r; 
        } else { 
            elm['on' + evType] = fn; 
        } 
    }, 
 
    // cssjs method that adds, removes or swaps classes 
    cssjs:function(a,o,c1,c2) 
    { 
        switch (a) 
        { 
            case 'swap': 
                o.className=!helperMethods.cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2); 
            break; 
            case 'add': 
                if(!helperMethods.cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;} 
            break; 
            case 'remove': 
                var rep=o.className.match(' '+c1)?' '+c1:c1; 
                o.className=o.className.replace(rep,''); 
            break; 
            case 'check': 
                return new RegExp("(^|\\s)" + c1 + "(\\s|$)").test(o.className) 
            break; 
        } 
    } 
} 
helperMethods.addEvent(window, 'load', highlight.init, false); 
