(function (A) {
	A.fn.rssLinks = function (B) {
		return this.each(function () {
			var E = A(this);
			var G = A.extend({},
			A.fn.rssLinks.defaults, B);
			var F = A(G.target || A(this).attr("target"));
			var C = [];
			
			if ((this.tagName.toLowerCase() == "a" && typeof(A(this).attr("href")) != "undefined") && (typeof(A(this).attr("rel")) != "undefined"))
			{
			    G.url = G.url || this.tagName.toLowerCase() == "a" ? A(this).attr("href").split("#")[0] : A(this).attr("rel");
			    G.url = G.url.replace("http://", "").replace("http%3A//", "");
			    for (var D = 0;			D < G.services.length;			D++) {
				    C[D] = '<a href="' + G.serviceList[G.services[D]].pattern + '" name="' + G.services[D] + '"><img src="' + G.serviceList[G.services[D]].image + '" alt="Add to ' + G.services[D] + '" /></a>';
				    C[D] = C[D].replace(/\{url\}/gi, escape(unescape(G.url)))
			    }
			    C = A(C.join(""));
			    F[G.insertionType](C);
			    if (G.wrapper) {
				    C.each(function () {
					    A(this).wrap(G.wrapper)
				    })
			    }
			    if (G.taggingPattern && s && s.t) {
				    C.each(function () {
					    A(this).click(function () {
						    s.t(this, "o", G.taggingPattern.replace(/\{name\}/gi, E.attr("name")).replace(/\{service\}/gi, A(this).attr("name")))
					    })
				    })
			    }
			}
		})
	};
	A.fn.rssLinks.defaults = {
		target: false,
		url: false,
		wrapper: false,
		insertionType: "html",
		taggingPattern: "snow:rss feeds:{name}:{service}",
		services: ["MyYahoo", "MyAOL", "Google", "WindowsLive"],
		serviceList: {
			MyYahoo: {
				pattern: "http://us.rd.yahoo.com/my/atm/*http://add.my.yahoo.com/rss?url=http%3A//{url}",
				image: "/vailresorts/sites/snow/assets/img/rss/rss_yahoo.gif"
			},
			MyAOL: {
				pattern: "http://feeds.my.aol.com/?url=http%3A//{url}",
				image: "/vailresorts/sites/snow/assets/img/rss/rss_aol.gif"
			},
			Google: {
				pattern: "http://fusion.google.com/add?source=atgs&feedurl=http%3A//{url}",
				image: "/vailresorts/sites/snow/assets/img/rss/rss_google.gif"
			},
			WindowsLive: {
				pattern: "http://www.live.com/?add=http://{url}",
				image: "/vailresorts/sites/snow/assets/img/rss/rss_windows.gif"
			}
		}
	}
})(jQuery);