
function seedmarkInit()
{
    normalizeHeights('home-teasers-services', 'h4', '');
    normalizeHeights('home-teasers-services', 'div', 'teaser');
    normalizeHeights('home-teasers-products', 'div', 'teaser');

    installSearchText('search-criteria');
}

function normalizeHeights(containerId, tagName, className)
{
    if (!document.getElementById || !document.getElementsByTagName)
        return false;

    containerElt = document.getElementById(containerId);
    if (!containerElt)
        return false;

    elts = containerElt.getElementsByTagName(tagName);

    maxHeight = -1;
    for (i = 0; i < elts.length; i++) {
        if (elts[i].className != className)
            continue;
        maxHeight = Math.max(maxHeight, elts[i].offsetHeight);
    }

    for (i = 0; i < elts.length; i++) {
        if (elts[i].className != className)
            continue;
        elts[i].style.height = maxHeight + 'px';
    }
}

function installSearchText(id)
{
    elt = document.getElementById(id);
    if (elt) {
        elt.defaultText = 'Search ...';
        elt.onfocus = searchFocus;
        elt.onblur = searchBlur;
        elt.onblur();
    }
}

function searchFocus()
{
    if (this.value == this.defaultText)
        this.value = '';

    return true;
}

function searchBlur()
{
    if (this.value.length == 0)
        this.value = this.defaultText;

    return true;
}
