	// Uses both the shortcut for $(document).ready()
	// and the argument to write failsafe jQuery code
	// using the $ alias, without relying on the global alias.
jQuery(function($) {
	// Your code using failsafe $ alias here...
	$('#rssIcon').click(function(){
		$(this).toggleClass( 'selected' );
		$('#rssMenu').slideToggle('fast');
		$('#shareMenu').hide('fast');
		$('#shareIcon').removeClass('selected');
		return false;
	});
	$('#closeRSS').click(function(){
		$('#rssMenu').slideToggle('fast');
		return false;
	});
	$('#shareIcon').click(function(){
		$(this).toggleClass( 'selected' );
		$('#shareMenu').slideToggle('fast');
		$('#rssMenu').hide('fast');
		return false;
	});
});

var yahooBuzzArticleId = 'cnnmoneycom521:http://' + location.hostname + location.pathname;
var yahooBuzzBadgeType = 'text';
var yahooBuzzShowBranding = false;

var cnnShareLinks = {
	myFeedDomain : '',
	storyPath : '',
	headline : '',
	description : '',
	clickURL : '',
	serviceURL : '',
	myFeedTitle : '',
	myFeedURL : '',

	init : function(seeTitle,seeURL) {
		this.myFeedTitle = seeTitle;
		this.myFeedURL = seeURL;
		this.myFeedDomain = 'http://' + location.hostname;
		this.storyPath = this.myFeedDomain + location.pathname;
		this.headline = document.title;
		if(document.getElementsByTagName('h1')[0])
			this.headline=document.getElementsByTagName('h1')[0].innerHTML;
		if(document.getElementsByTagName('h2')[0])
			this.description=document.getElementsByTagName('h2')[0].innerHTML;
		var feedTitle = document.getElementById('rssSubs')
		feedTitle.innerHTML = 'Subscribe to ' + this.myFeedTitle;
		var feedData = document.getElementById('feedLink')
		feedData.innerHTML = '<a href="http:\/\/' + this.myFeedURL + '"><img src="http:\/\/i.cdn.turner.com/cnn/.element/img/1.1/misc/xml_button.gif" alt="" width="28" height="13" border="0"></a> <b>feed:\/\/' + this.myFeedURL + '</b>';
	},
	
	click : function(cnnClick) {
		switch(cnnClick) { 
		case 'Digg' :
			this.clickURL = 'http://digg.com/submit?phase=2&url=http%3A//'+this.storyPath+'&title='+encodeURIComponent(this.headline)+'&bodytext='+encodeURIComponent(this.description)+'&media=news&topic=business_finance';
			break;
		case 'Facebook' : 
			this.clickURL = 'http://www.facebook.com/share.php?u='+this.storyPath;
			break;
		case 'Del' : 
			this.clickURL = 'http://del.icio.us/post?v=4&noui&jump=close&url='+this.storyPath+'&title='+encodeURIComponent(this.headline);
			break;
		case 'reddit' : 
			this.clickURL = 'http://reddit.com/submit?url='+this.storyPath+'&title='+encodeURIComponent(this.headline);
			break;
		case 'stumble' : 
			this.clickURL = 'http://www.stumbleupon.com/submit?url='+this.storyPath+'&title='+encodeURIComponent(this.headline);
			break;
		case 'myspace' : 
			this.clickURL = 'http://www.myspace.com/Modules/PostTo/Pages/?t='+encodeURIComponent(this.headline)+'&c='+encodeURIComponent(this.description)+'&u='+this.storyPath+'&title='+encodeURIComponent(this.headline);
			break;
		case 'mixxit' : 
			this.clickURL = 'http://www.mixx.com/submit/story?page_url='+this.storyPath+'&title='+encodeURIComponent(this.headline)+'&description='+encodeURIComponent(this.description);
			break;
			}
			if(this.clickURL == '') {
				return;
			}
			try {
				window.open(this.clickURL);
			}
			catch(e) {
			}
		},
	
	service : function(cnnService) {
		switch(cnnService) {
		case 'google':
			this.serviceURL = 'http://fusion.google.com/add?feedurl=';
			break;
		case 'aol':
			this.serviceURL = 'http://feeds.my.aol.com/add.jsp?url=';
			break;
		case 'msn':
			this.serviceURL = 'http://my.msn.com/addtomymsn.armx?id=rss&ut=';
			break;
		case 'yahoo':
			this.serviceURL = 'http://add.my.yahoo.com/rss?url=';
			break;
		case 'netvibes':
			this.serviceURL = 'http://www.netvibes.com/subscribe.php?url=';
			break;
		}
		var fullServiceURL	= this.serviceURL + 'http://' + this.myFeedURL;
		if(this.serviceURL == '') {
			return;
		}
		try {
			window.open(fullServiceURL);
		}
		catch(e) {
		}
	}

};

