// JavaScript Document
function showSubscribeWindow(articleUrl, newsletterId) {
	window.open(articleUrl+"?popup=true&newsletterId="+newsletterId, "_blank", "height=300,width=400,resizable=yes,top=100,left=100,menubar=no,status=no,location=no");
}

function showNewsletter(newsletterUrl) {
	window.open(newsletterUrl, 
				"_blank", "height=800,width=700,resizable=yes,top=100,left=100,menubar=no,status=no,location=no,scrollbars=yes");
}

function printArticle() {
	window.print();
}

function printit()
{
  
  if(navigator.appVersion.indexOf("MSIE 7") != -1)
  {
  //detects IE7 and uses this to print
     document.execCommand('print',false,null);
  }
  else
  {
  //uses this to print from any other browser
     print();
  }
}

function initLightbox() {
	//new Lightbox(); 
}


function showIngress(id, show)
{
	var elem = document.getElementById('ingress'+id);
	if(elem != null)
	{
		if(show)
		{
			elem.style.display = "";
		} else
		{
			elem.style.display = "none";
		}
	}
}

Event.observe(window, "load", function() {
	var ar = $$(".articleRow");
	if( ar != null ) {
		for (var index = 0; index < ar.length; index++) {
			var item = ar[index];
			var ce = item.childElements();
			if( ce != null ) {
				var maxH = 0;
				for( var idx2 = 0; idx2 < ce.length; idx2++ ) {
					if( !ce[idx2].hasClassName("clear") ) {
						maxH = Math.max(maxH, ce[idx2].getHeight());
						
					}
				}
				for( var idx2 = 0; idx2 < ce.length; idx2++ ) {
					if( !ce[idx2].hasClassName("clear") ) {
						ce[idx2].setStyle({height: maxH+"px"});
					}
				}
			}
		}
	}
});
