jQuery.noConflict();

jQuery(document).ready(function($) {

    $(document).ready(function() {
        // frontpage slider
        $("#banner").slideshow(
			{
			    duration: 5000,
			    fadeInSpeed: 1000,
			    fadeOutSpeed: 1000
			}
		);

        // empty on focus and blur function for the search field
        $('.input_txt').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;
                }
            });
        });
    });
});

(function($) {
    $.fn.slideshow = function(option) {
        var config = {
            current: 0, 		// current selected index
            max: 0, 		// how many 
            duration: 2000, 	// speed between animation
            fadeInSpeed: "fast", //
            fadeOutSpeed: "fast", //
            fadeInSpeed: "fast", //
            fadeOutSpeed: "fast", //
            easing: null, 	// not in use
            callback: null		// not in use
        }
        config = $.extend(config, option);
        var self = this,
				timer = null;

        $(self).find(".text").hide().eq(0).fadeIn(0);
        $(self).find(".img img").hide().eq(0).fadeIn(0);

        config.current = 0;
        config.max = self.find("div.text").length;

        doAnimate = function(current, next) {
            $(self).find(".text").eq(current).fadeOut(config.fadeOutSpeed);
            $(self).find(".text").eq(next).fadeIn(config.fadeInSpeed);

            $(self).find(".img img").eq(current).fadeOut(config.fadeOutSpeed);
            $(self).find(".img img").eq(next).fadeIn(config.fadeInSpeed);
        }

        start = function() {
            timer = setTimeout(function() {
                var next = config.current + 1;
                if (next >= config.max) {
                    next = 0;
                }
                doAnimate(config.current, next);
                config.current = next;
                start();
            }, config.duration);
        }

        start();
        return self;

    };
})(jQuery);