// Share component (share with addthis, add to bookmark)
var ShareMe = 
{
	openAddThis: function(excludes, more)
	{
		if(excludes) addthis_exclude = excludes;
		try
		{			
			return addthis_open(document.body, (more ? 'more' : 'email'), '[URL]', '[TITLE]');
		}catch(e){};
	},

	getAddThisURL: function(name)
	{		
		var bookmark = 'http://www.addthis.com/bookmark.php?pub=xiaoyin&v=250&source=tbx-250&tt=0&content=&lng=en';
		bookmark += '&url=' + encodeURIComponent(document.location.href) + '&s=' + name;
		if(typeof(addthis_title) != 'undefined') bookmark += '&title=' + encodeURIComponent(addthis_title);		
		else bookmark += '&title=' + encodeURIComponent(document.title);
		if(typeof(addthis_desc) != 'undefined') bookmark += '&description=' + encodeURIComponent(addthis_desc);		
		return bookmark;
	},

	//bookmark (the page must be from a web server, not directly from a local file system)
	addToBookmark: function()
	{
		try
		{
			var title = document.title;
			var url = document.location.href;
			if(window.sidebar)
			{
				window.sidebar.addPanel(title, url, '');
			}else if(window.external)
			{
				window.external.AddFavorite(url, title);
			}else
			{
				alert('To bookmark this page, click Bookmarks | Add bookmark or press Ctrl/Command + D.');
			}
		}catch(e){};
	}
}

//deal with the issue with mouse wheel doesn't work when wmode is specified in non-IE browsers.
var FlashMouseWheel = 
{
	_swf: null,	
	init: function(swfRef)
	{
		//IE works, so ingore it
		if(!(document.attachEvent))
		{			
			this._swf = swfRef;
			window.addEventListener("DOMMouseScroll", this.handleMouseWheel, false);
		}
	},

	handleMouseWheel: function(evt)
	{
		if (FlashMouseWheel._swf)
		{
            var o = {x: evt.screenX, y: evt.screenY, delta: evt.detail,
					ctrlKey: evt.ctrlKey, altKey: evt.altKey, shiftKey: evt.shiftKey};
			if(undefined!=FlashMouseWheel._swf.handleMouseWheel) FlashMouseWheel._swf.handleMouseWheel(o);	
        }
	}
}

