portal_url = '/';
function registerPloneFunction(func){
if (window.addEventListener) window.addEventListener("load",func,false);
else if (window.attachEvent) window.attachEvent("onload",func);
}
function getContentArea(){
node = document.getElementById('region-content')
if (! node) { node = document.getElementById('content') }
return node
}
function wrapNode(node, wrappertype, wrapperclass){
wrapper = document.createElement(wrappertype)
wrapper.className = wrapperclass;
innerNode = node.parentNode.replaceChild(wrapper,node);
wrapper.appendChild(innerNode)
}
function scanforlinks(){
if (! document.getElementsByTagName) { return false };
if (! document.getElementById) { return false };
contentarea = getContentArea()
if (! contentarea) { return false }
links = contentarea.getElementsByTagName('a');
for (i=0; i < links.length; i++) {
if ((links[i].getAttribute('href'))&&(links[i].className.indexOf('link-plain')==-1 )) {
var linkval = links[i].getAttribute('href')
if (linkval.toLowerCase().indexOf(window.location.protocol+'//'+window.location.host)==0) {
} else if (linkval.indexOf('http:') != 0) {
protocols = ['mailto', 'ftp', 'news', 'irc', 'h323', 'sip', 'callto', 'https']
for (p=0; p < protocols.length; p++) {
if (linkval.indexOf(protocols[p]+':') == 0) {
wrapNode(links[i], 'span', 'link-'+protocols[p])
} }  } else {
if ( links[i].getElementsByTagName('img').length == 0 ) {
wrapNode(links[i], 'span', 'link-external')
} } } } } 
registerPloneFunction(scanforlinks)
