$(document).ready(function(){
    //////////////////////////////////////////////////////////////////////////////////
    $("input,textarea").each(function() {
        var default_value = this.value;
        $(this).focus(function() {
            if(this.value == default_value) {
                this.value = '';
            }
        });
        $(this).blur(function() {
            if(this.value == '') {
                this.value = default_value;
            }
        });
    });
    ///////////////////////////////////////////////////////////////////////////////
    $.accordian = function(items, first, options) {

        var active = first;
        var running = 0;

        var titles = options && options.titles || '.title';
        var contents = options && options.contents || '.content';
        var onClick = options && options.onClick || function(){};
        var onShow = options && options.onShow || function(){};
        var onHide = options && options.onHide || function(){};
        var showSpeed = options && options.showSpeed || '1800';
        var hideSpeed = options && options.hideSpeed || '1800';

        $(items).not(active).children(contents).hide();
        $(items).not(active).each(onHide);
        $(active).each(onShow);

        $(items).children(titles).click(function(e){

            var p = $(contents, this.parentNode);
            $(this.parentNode).each(onClick);

            if (running || !p.is(":hidden")) return false;
            running = 2;

            $(active).children(contents).not(':hidden').slideUp(hideSpeed, function(){
                --running;
            });
            p.slideDown(showSpeed, function(){
                --running;
            });

            $(active).each(onHide);
            active = '#' + $(this.parentNode)[0].id;
            $(active).each(onShow);
            return false;
        });
    };

    function simpleLog(message) {
        $('<div>' + message + '</div>').appendTo('#log');
    }

    $(function(){

        $.accordian('#list2 > div', '#item23', {
            titles:'.mytitle',
            contents:'.mycontent',
            onClick:function(){
                simpleLog(this.id + ' clicked')
            },
            onShow:function(){
                simpleLog(this.id + ' shown');
                $(this).removeClass('off').addClass('on');
            },
            onHide:function(){
                simpleLog(this.id + ' hidden');
                $(this).removeClass('on').addClass('off');
            },
            showSpeed:300,
            hideSpeed:550
        });

    });    
    ////////////////////////////////////////////////////////////////////////////////////    
    /*$('#menu ul li').last().css('background-image', 'none');*/
    $("#menu ul li").last().addClass('highlight');
    ///////////////////////////////////////////////////////////////////////////////////
$('#search_icon').click(function(){$(this).parent().submit();})
////////////////////////////////////////////////////////////////////////////////////
function mycarousel_initCallback(carousel)
    {
        // Disable autoscrolling if the user clicks the prev or next button.
        carousel.buttonNext.bind('click', function() {
            carousel.startAuto(1);
        });

        carousel.buttonPrev.bind('click', function() {
            carousel.startAuto(1);
        });

        // Pause autoscrolling if the user moves with the cursor over the clip.
        carousel.clip.hover(function() {
            carousel.stopAuto();
        }, function() {
            carousel.startAuto();
        });
    };

    jQuery(document).ready(function() {
        jQuery('#mycarousel').jcarousel({
            auto: 2,
            wrap: 'last',
            initCallback: mycarousel_initCallback
        });
    });
    /////////////////////////////////////////////////////////////////////////////////
});
