window.onload = function() {
	if (!document.getElementByTagName) {
		return false;
	}
	var external = document.getElementByTagName("a");
	for (var i=0; i < external.length; i++) {
		if (external[i].getAttribute("rel") == "external") {
			external[i].onclick = function() {
				openExternal(this.getAttribute("href"));
				return false;
			}
		}
	}
}
function openExternal(linkURL) {
	window.open(linkURL,'external','resizable=yes,scrollbars=yes')
}

function PrintArticle(path) {
	success = window.print();
	document.getElementById('graphicprintreplace').src = "http://www.yankeemagazine.com/print" + path;
}

function CommentArticle(path) {
	$.scrollTo('#CommentForm',{speed:1000});
}

function ShareArticle() {
	var link = $('#sharelink').offset();
	
	sharebox = $('#sharingwrapper');
	sharebox.css('left',(link.left - 160) + 'px');
	sharebox.css('top',(link.top + 3) + 'px');
	sharebox.show();
}

function CloseShareBox() {
	$('#sharingwrapper').hide();
}

function ShareClick(service,node,url) {
	logurl = "http://www.yankeemagazine.com/cms/sharelog.php?node=" + node + "&service=" + service;
	$('#graphicsharereplace').src = logurl;
	window.open(url);
}

function make_popover_subscription() {
	tb_show('SUBSCRIBE', '#TB_inline?height=490&amp;width=500&inlineId=SubFormPopOver', null);
	// urchinTracker("/subscribe/popover/open");
}

function ShowPopOverSubForm(sourcecode) {
	var inpage = new Kable.Subscribe();
	inpage.MakeForm('popover-kable-form','popover-form.html','popoverform',sourcecode,true);
	// urchinTracker("/subscribe/popover/open");
}

function close_popover_subscription() {
	tb_remove();
	// urchinTracker("/subscribe/popover/close");
}