// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

// External links
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors .length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
			anchor.title = (anchor.title != "") ? anchor.title+" (opens in a new window)" : "opens in a new window";
			anchor.className = (anchor.className != '') ? anchor.className+' external' : 'external';
		}
	}
}
window.onload = externalLinks;

function previewContent(frm, actn) {
	prev_actn = frm.action;
	frm.target = "_blank";
	frm.action = actn;
	frm.submit();
	frm.target = "";

	// reset action once window has been opened
	frm.action = prev_actn;
}