// javascript to open all external links in POTUS pages in a new window
//Created by M. Galloway on 8/17/10

// get all anchor tags in document
var plinks = document.getElementsByTagName("a");
var ptxt = '';

for (plink in plinks)
{
	// if anchor tags have href attribute, grab it
	if (plinks[plink].href) // so not undefined
	{
		ptxt = plinks[plink].href;
	}

	//if href attribute is an external link (not in ipl.org)...
	if (ptxt.indexOf("ipl.org") == -1)
	{
		//document.write(ptxt+'<br />'); //debugging
		
		//set the target attribute so link opens in new window
		plinks[plink].target="_blank";
	}
	
}
