// Since not all browsers support the same bookmark API ;-)
function CreateBookmark() 
{
	var title = document.title;
	var url = location.href;
	
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
}

function toggleSize(div_id)
{
	var article_div = document.getElementById(div_id);
		
	switch(article_div.className)
	{
		case 'area_article_text_default':
			article_div.className = 'area_article_text_big';
			break;
			
		case 'area_article_text_big':
			article_div.className = 'area_article_text_bigger';
			break;
			
		case 'area_article_text_bigger':
		default:
			article_div.className = 'area_article_text_default';
	}
}

function makeCompatibleBookmark()
{
	var text = document.getElementById('bookmark_text');	
	if(window.opera && window.print) 
	{ 
		text.href = location.href;
		text.rel = 'sidebar';
	}
	else if((window.sidebar) || (window.external))
		text.href= 'javascript:CreateBookmark()';
	else
		text.href = 'javascript:bookmark()';
}

function tool_share_url(encode)
{ 
	if(encode == null)
		encode = true;
	
	if(encode)
		return encodeURIComponent(location.href);
	else
		return location.href;
}
function tool_share_title()
{
	var title = document.title.substr(0,document.title.indexOf('|') - 1);
	return encodeURIComponent(title);
} 


function facebook_share()
{	
	window.open('http://www.facebook.com/sharer.php?u='+tool_share_url()+'&t='+tool_share_title(),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

function digg_share()
{
	window.open('http://digg.com/submit?phase=2&url='+tool_share_url()+'&title='+tool_share_title());
	return false;
}

function stumble_share()
{
	window.open('http://www.stumbleupon.com/submit?url='+tool_share_url()+'&title='+tool_share_title());
	return false;
}

function delicious_share()
{
	window.open('http://del.icio.us/post?url='+tool_share_url()+'&title='+tool_share_title());
	return false;
}

function technorati_share()
{
	window.open('http://technorati.com/faves?add='+tool_share_url(false));
	return false;
}
function live_share()
{
	window.open('https://favorites.live.com/quickadd.aspx?url='+tool_share_url()+'&title='+tool_share_title());
	return false;
}

