/**
 * Uses JQuery and the Interface Plugin
 * Only tested with JQuery 1.1.3.1 and Interface 1.2
 *
 * @author Mario Volke <mario.volke@webholics.de>
 * @copyright 2007 Mario Volke
 */

$(document).ready(
    function() {
        // delete first list bullet of the navigation
        $('div#head ul li:last-child').addClass('first');
        
        // smooth anchor scrolling
        $('a[@href^="#"]').click(
            function() {
                var splits = this.href.split('#');
                var target = '#' + splits[1];
                $(target).ScrollTo(600);
                return false;
            }
        );
        
        // mark all '&' in headlines to style them in css
        $('h1, h2, h3, h4, h5, h6, h1 *, h2 *, h3 *, h4 *, h5 *, h6 *').contains('&').each(
            function() {
                // is node a text node
                if(this.childNodes.length == 1) {
                    var splits = this.firstChild.data.split('&');
                    var html = splits[0];

                    for(var i = 1; i < splits.length; i++) {
                        html += '<span class="ampersand">&amp;</span>';
                        html += splits[i];
                    }

                    $(this).empty().append(html);
                }
            }
        );
    }
);
