//Share buttons
//when window width is wide enough, float on the left.
//when window width is narrow, show inline share buttons.
//attach behaviors to Share buttons (floating when screen is wide enough, inline for narrower screen
var ShareBar = {
	MIN_WIN_WIDTH: 1153,
	PARKED_TOP: 89, //mainArea y position + 15px margin
	FLOAT_BAR_WIDTH: 80,
	shareBar: null,
	shareTable: null,
	init:function() {
		this.shareBar = document.getElementById('shareBar');
		this.shareTable = document.getElementById('shareTable');
		EventConnector.connect (window, "onresize", this, this.show);
		EventConnector.connect (window, "onscroll", this, this.reposition);
		this.show();
	},
	show:function() {
		var winwidth = (window.innerWidth || document.body.clientWidth);
		if(winwidth<this.MIN_WIN_WIDTH) {
			this.shareBar.style.display="none";
			this.shareTable.style.display="block";
		}
		else {
		this.shareBar.style.display="block";
		this.reposition();
		this.shareTable.style.display="none";
		}
	},
	reposition:function() {
	var winscroll = UIHelper.getScrollXY();
	if(winscroll[1] > this.PARKED_TOP){
		this.shareBar.className = 'float';
	}
	else {
		this.shareBar.className = 'parked';
	}
	if(this.shareBar.className == 'parked')
	{
		this.shareBar.style.left = "";
		this.shareBar.style.top = "";
		return;
	}
	var sbpos = getElementPosition(document.getElementById('mainContent'));
	this.shareBar.style.left = sbpos.x-this.FLOAT_BAR_WIDTH+"px";
	}
}
 

