pkg('mdv.servicemenu');

mdv.servicemenu.Share = function() {
	
	var nodes = {};
	
	function init(root) {
		nodes.root = root;
		nodes.popOut = $('#sharePopOut', nodes.root);
		nodes.btnEmail = $('.btnEmail', nodes.root);
		
		nodes.btnEmail.bind('click', onClickBtnEmail);
		
		// Yay hurray IE
		// We can't use the css only hover solution because
		// 1. IE doesn't render all the buttons
		// 2. Pop out loses :hover state on iframe
		nodes.root.bind('mouseenter', function() {
			nodes.popOut.css({display: 'block'});
		});
		
		nodes.root.bind('mouseleave', function() {
			nodes.popOut.css({display: 'none'});
		});
	}
	
	function onClickBtnEmail(event) {
		event.preventDefault();
		
		var popUp = new SharePopUp(window.location+"");
		popUp.show();
	}
	
	init.apply(this, arguments);
}
