function fillIf(id, current, fill)
{
    element = document.getElementById(id);
    if (element.value == current) {
        element.value = fill;
    }
}

function dreLoad()
{
    address_text = '* Address'; 
    zip_text = '* Zip Code';
    suite_text ='Apt #'; 

    // Add the blur and click handlers to the textboxes
    address = document.getElementById('dre-address');
    zip = document.getElementById('dre-zip');
    suite = document.getElementById('dre-suite');

    address.onclick = function() {fillIf('dre-address', address_text, '')};
    zip.onclick = function() {fillIf('dre-zip', zip_text, '')};
    suite.onclick = function() {fillIf('dre-suite', suite_text, '')};

    address.onblur = function() {fillIf('dre-address', '', address_text)};
    zip.onblur = function() {fillIf('dre-zip', '', zip_text)};
    suite.onblur = function() {fillIf('dre-suite', '', suite_text)};

    // Do the initial clearing
    fillIf('dre-address', '', address_text);
    fillIf('dre-zip', '', zip_text);
    fillIf('dre-suite', '', suite_text);

    // set up the form to clear on submit
    var clearAll = function() {
	fillIf('dre-address', address_text, '');
	fillIf('dre-zip', zip_text, '');
	fillIf('dre-suite', suite_text, '');
    }
    if (address.form.onsubmit) {
	address.form.onsubmit = compositeFunc(clearAll, address.form.onsubmit);
    } else {
	address.form.onsubmit = clearAll;
    }
}
addOnloadEvent(dreLoad);
