// Add Prototype based, non-intrusive onload calls here
DOMReady.add(function() {
    $$('input.date').each(function(el) {
        new DGN.DateInput(el);
    });

    if(Prototype.Browser.IE) {
        $$('input[placeholder]').each(function(element) {
            // Don't do anything if the element is prefilled or the placeholder is empty
            if(element.getValue() != '' || element.placeholder == '') return;

            // Apply placeholder
            element.setValue(element.placeholder);
            element.style.color = '#a9a9a9';

            element.observe('focus', function() {
                if(element.getValue() == element.placeholder) {
                    element.setValue('');
                    element.style.color = '#000000';
                }
            });
            element.observe('blur', function() {
                if(element.getValue() == '') {
                    element.setValue(element.placeholder);
                    element.style.color = '#a9a9a9';
                }
            });

            // Try to prevent the placeholder to be submitted.
            element.up('form').observe('submit', function() {
                if($(element).getValue() == $(element).placeholder) {
                    $(element).setValue('');
                }
            });
        });
    }
}, !Prototype.Browser.IE); // Add to end of domready in IE, to beginning in all other browsers
