  $(function(){	   		   
	$('#t a')
		.css( {backgroundPosition: "0 0"} )		
		.mouseover(function(){				
			$(this).stop().animate({backgroundPosition:"(0 -250px)"}, {duration:500})
		})
		.mouseout(function(){     				
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500})
		})
		
	$(".items img").click(function() {
	
		// calclulate large image's URL based on the thumbnail URL (flickr specific)
		var url = $(this).attr("src").replace("_t", "");
	
		// get handle to element that wraps the image and make it semitransparent
		var wrap = $("#image_wrap").fadeTo("medium", 0.5);
	
		// the large image from flickr
		var img = new Image();
	
		// call this function after it's loaded
		img.onload = function() {
	
			// make wrapper fully visible
			wrap.fadeTo("fast", 1);
	
			// change the image
			wrap.find("img").attr("src", url);
	
		};
	
		// begin loading the image from flickr
		img.src = url;

	});

	// create custom animation algorithm for jQuery called "bouncy" 
	$.easing.bouncy = function (x, t, b, c, d) { 
		var s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 
	} 
	 
	// create custom tooltip effect for jQuery Tooltip 
	$.tools.tooltip.addEffect("bouncy", 
	 
		// opening animation 
		function(done) { 
			this.getTip().animate({top: '+=15'}, 500, 'bouncy', done).show(); 
		}, 
	 
		// closing animation 
		function(done) { 
			this.getTip().animate({top: '-=15'}, 500, 'bouncy', function()  { 
				$(this).hide(); 
				done.call(); 
			}); 
		} 
	);

	$.fn.boxShadow = function(xOffset, yOffset, blurRadius, shadowColor) {
		if (!$.browser.msie) return;
		return this.each(function(){
			$(this).css({
				position:	"relative",
				zoom: 		1,
				zIndex:		"2"
			});
			$(this).parent().css({
					position:	"relative"
			});
			
			var div=document.createElement("div");
			$(this).parent().append(div);

			var _top, _left, _width, _height;
			if (blurRadius != 0) {
				$(div).css("filter", "progid:DXImageTransform.Microsoft.Blur(pixelRadius="+(blurRadius)+", enabled='true')");
				_top = 		yOffset-blurRadius-1;
				_left =		xOffset-blurRadius-1;
				_width =		$(this).outerWidth()+1;
				_height =	$(this).outerHeight()+1;
			} else {
				_top = 		yOffset;
				_left =		xOffset;
				_width = 	$(this).outerWidth();
				_height = 	$(this).outerHeight();
			}
			$(div).css({
				top: 			_top,
				left:			_left,
				width:		_width,
				height:		_height,
				background:	shadowColor,
				position:	"absolute",
				zIndex:		1
			});
			
	  });
	};

    $.fn.switchTarget = function (options) {
        var $options = $.extend({}, $.fn.switchTarget.defaults, options);
        var links = [];
        var targets =[];

        return this.each(function(i){
            var activateLink = function(link) {
                link.addClass($options.linkClass); 
                if ($options.linkSwap) {
                    $(links).show();
                    link.hide();
                }
            };

            var $e = $(this);
            var $t = $(this.hash);
            links.push(this);
            targets.push($t.get(0));
            if ($options.startHidden) {
                $(targets).hide();
            }
            if ((i + 1) === $options.linkSelected) {
                activateLink($e);
            }
            else {
                $t.hide();
            }

            $e.bind($options.activation, function() {
                if ($options.activation == 'mouseover') {
                    $e.click(function(){ return false; });
                }  
                if ($options.effect == 'sliding') {
                    if ($($t).is(":visible")) {                        
                        $($t).slideUp($options.speed);
                    }
                    else {
                        $(targets).not($t).slideUp($options.speed);
                        $t.slideDown($options.speed);
                    }
                }
                else {
                    $(targets).not($t).hide($options.speed);
                    $t.show($options.speed);
                }

                $(links).removeClass($options.linkClass);
                activateLink($e);
                return false;
            });
        });
    }

    $.fn.switchTarget.defaults =
    {
        linkSelected    : 1,
        linkClass       : 'selected',
        linkSwap        : false,
        effect          : 'basic', // alternative: 'sliding'
        speed           : '',
        startHidden     : false,
        activation      : 'click' // alternative: 'mouseover', 'dblclick'
    }

            $('.links').switchTarget({
                effect          : 'sliding',
                startHidden     : true,
                speed           : 'slow'
            });


})

