(function ($) {
    $.fn.cross = function (options) {
        return this.each(function (i) { 
            var $$ = $(this);            
            var target = $$.css('backgroundImage').replace(/^url|[\(\)'"]/g, '');
            $$.wrap('<span class="border" style="position: relative;"></span>')
                .parent()
                .prepend('<img>')
                .find(':first-child')
                .attr('src', target);
            if ($.browser.msie && $.browser.version < 8) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : "0"
                })
            } else if ($.browser.mozilla) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : this.offsetTop
                });
            } else if ($.browser.opera && $.browser.version < 9.5) {
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : '',
                    'top' : "0"
                });
            } else { // Safari
                $$.css({
                    'position' : 'absolute', 
                    'left' : 0,
                    'background' : ''
                });
            }
            $$.hover(function () {
                $$.stop().animate({
                    opacity: 0
                }, 300);
            }, function () {
                $$.stop().animate({
                    opacity: 1
                }, 300);
            });
        });
    };
    
})(jQuery);

$(window).bind('load', function () {
    $('img.fade').cross();
});

$(function() {
    $('#billboard-slideshow').cycle({
        fx:     'fade',
        speed:  '2500'
    });
}); 

$(document).ready(function() {
	$("ul#navigation li a").wrapInner("<span></span>");
	$("ul#navigation li a span").css({"opacity" : 0});
	$("ul#navigation li a").hover(function(){
		$(this).children("span").animate({"opacity" : 1}, 400);
	}, function(){
		$(this).children("span").animate({"opacity" : 0}, 200);
	});
});
