/* Add an extra div for drop shadow */
Event.observe(document,'dom:loaded',function() {
    $$('#container div.box').each(function(child) {
        if(child.hasClassName('external')) return;
        var shade = new Element('div');
        shade.addClassName('shade');
        shade.style.top = (-1 + child.positionedOffset().top) + 'px';
        shade.style.left = (-1 + child.positionedOffset().left) + 'px';
        shade.style.width = (2 +child.clientWidth) +'px';
        shade.style.height = (2+child.clientHeight) +'px';

        child.insert({before: shade});
    });

    $$('a').each(function(link) {
        if(link.hasClassName('external')) {
            // new window
            link.observe('click',function(evt) {
                var _blank = window.open(link.getAttribute('href'), '_blank');
                _blank.focus();
                Event.stop(evt);
                return false;
            }.bindAsEventListener(link));
        } else {
            // track cross domain
            link.observe('click',function(evt) {
                if(!window._gaq) return true;
                window._gaq.push(['_link', link.getAttribute('href')]);
                Event.stop(evt);
                return false;
            }.bindAsEventListener(link));
        }
    });
});
if(Prototype.Browser.IE) {
Event.observe(document,'dom:loaded',function() {
    $$('#container div.box').each(function(el) {
        if(el.hasClassName('external')) return;
        el.style.position='relative';
        sharedStyle = 'background-image: url(/media/images/corners.gif); width: 6px; height: 6px; position: absolute; z-index: 10px; font-size: 1px; line-height: 1;';
        el.insert({top: new Element('div',{style: sharedStyle + 'background-position: left top; top: -1px; left: -1px;'})});
        el.insert({top: new Element('div',{style: sharedStyle + 'background-position: right top; top: -1px; right: -1px;'})});
        el.insert({top: new Element('div',{style: sharedStyle + 'background-position: left bottom; bottom: -1px; left: -1px;'})});
        el.insert({top: new Element('div',{style: sharedStyle + 'background-position: right bottom; bottom: -1px; right: -1px;'})});
    });
    $$('#container div.cta').each(function(el) {
        if(el.hasClassName('external')) return;

        sharedStyle = 'background-image: url(/media/images/corners-cta.gif); width: 6px; height: 6px; position: absolute; z-index: 10px; font-size: 1px; line-height: 1;';
        el.insert({top: new Element('div',{style: sharedStyle + 'background-position: left top; top: -4px; left: -4px;'})});
        el.insert({top: new Element('div',{style: sharedStyle + 'background-position: right top; top: -4px; right: -4px;'})});
        el.insert({top: new Element('div',{style: sharedStyle + 'background-position: left bottom; bottom: -4px; left: -4px;'})});
        el.insert({top: new Element('div',{style: sharedStyle + 'background-position: right bottom; bottom: -4px; right: -4px;'})});
    });
});
}
