document.observe("dom:loaded", function() {
    // Round corners for all IEs
    $$('.ie-rc').each(function(el){
        var lt = new Element('i', { 'class': 'cnr lt' }); el.appendChild(lt);
        var rt = new Element('i', { 'class': 'cnr rt' }); el.appendChild(rt);
        var lb = new Element('i', { 'class': 'cnr lb' }); el.appendChild(lb);
        var rb = new Element('i', { 'class': 'cnr rb' }); el.appendChild(rb);
    });

    // Search form label
    if($('searchform').down('.input-text').value != '') $('searchform').down('label').hide();
    $('searchform').down('.input-text').observe('focus', function(evt) { $('searchform').down('label').hide(); });
    $('searchform').down('.input-text').observe('blur', function(evt) { if(Event.element(evt).value == '') $('searchform').down('label').show() });

    // Resizable catalog items
    resizableCatItems();
});

window.onresize = function() {
    resizableCatItems();
};


function resizableCatItems() {
    var parentElWidth = $('catNewItemsList').getWidth();
    $$('.cat-item-resizable').each(function(el) {
        if(parentElWidth <= 870) {
            el.setStyle({'width':'50%'});
        }
        else if(parentElWidth > 870) {
            el.setStyle({'width':'33.3%'});
        }
    });
}

