(function($) {
		$.fn.customFadeIn = function(speed, callback) {
			$(this).fadeIn(speed, function() {
				if(!$.support.opacity)
					$(this).get(0).style.removeAttribute('filter');
				if(callback != undefined)
					callback();
			});
		};
		$.fn.customFadeOut = function(speed, callback) {
			$(this).fadeOut(speed, function() {
				if(!$.support.opacity)
					$(this).get(0).style.removeAttribute('filter');
				if(callback != undefined)
					callback();
			});
		};
		$.fn.customFadeTo = function(speed,to,callback) {
			return this.animate({opacity: to}, speed, function() {
				if (to == 1 && jQuery.browser.msie)
					this.style.removeAttribute('filter');
				if (jQuery.isFunction(callback))
					callback();
			});
		};
	})(jQuery);
$(function(){
	//opacity
	opacity($('a.opacity'));
	//pagetop
	$("#pagetop a, #pagetop-all a").click(function(){
		$('html,body').animate({ scrollTop: 0 }, 'slow', 'swing');
		return false;
	});
	externalLink();
});


//opacity for link hover
function opacity(target) {
	$(target).hover(function(){
		$(this).customFadeTo(150,0.7);
	},function(){
		$(this).customFadeTo(150,1);
	});
}
/* external link action */
function externalLink() {
	$("a[href*='http://']:not([href*='undergarden.com'])").unbind('click');
	$("a[href*='http://']:not([href*='undergarden.com'])").click(function(){
		window.open(this.href);
		return false;
	});
}
