// divaLINK.js v1.0.0 Copyright 2007-2008 divaHTML : E Michael Brandt. All rights reserved.;
gDivaLINK.init=function(){var _1,newvals,ih,Tnodes;if(gDivaLINK.obj=="All"){_1=document.getElementsByTagName("body")[0];}else{_1=document.getElementById(gDivaLINK.obj);if(!_1){return;}}if(gDivaLINK.doURL){Tnodes=gDivaLINK.getBareTextNodes(_1);for(var i=0,len=Tnodes.length;i<len;i++){ih=Tnodes[i].nodeValue;if(ih.search(/\w{3,}/)!=-1){newvals=gDivaLINK.findm("urls",ih);if(newvals){gDivaLINK.linkm(Tnodes[i],newvals,"urls");}}}}if(gDivaLINK.doMail){Tnodes=gDivaLINK.getBareTextNodes(_1);for(var i=0,len=Tnodes.length;i<len;i++){ih=Tnodes[i].nodeValue;if(ih.search(/\w@\w/)!=-1){newvals=gDivaLINK.findm("mail",ih);if(newvals){gDivaLINK.linkm(Tnodes[i],newvals,"mail");}}}}};gDivaLINK.linkm=function(_4,_5,_6){var d=document,str,themailtxt;var _8=targetNode=_4;var n=_5.length-1;var _a=gDivaLINK.subject;var pn=top.location.pathname;if(_a){_a="?subject="+_a.replace("@site@",top.location.hostname).replace("@path@",pn.substring(0,pn.lastIndexOf("/"))+"/").replace("@page@",pn.substr(pn.lastIndexOf("/")+1));}for(var i=n;i>-1;i--){str=_5[i];if(i%2==1){_8=d.createElement("a");if(_6=="urls"){_8.setAttribute("href",(str.indexOf("http://")==-1?"http://":"")+str);if(gDivaLINK.rel){_8.setAttribute("rel",gDivaLINK.rel);}if(gDivaLINK.wbr){gDivaLINK.wbrm(str,_8);}else{_8.appendChild(d.createTextNode(str));}}else{_8.setAttribute("href","mailto:"+str+_a);if(!gDivaLINK.mailtxt&&gDivaLINK.wbr){gDivaLINK.wbrm(str,_8);}else{_8.appendChild(d.createTextNode((gDivaLINK.mailtxt)?gDivaLINK.mailtxt:str));}}_4.parentNode.insertBefore(_8,targetNode);}else{if(str!=""){_8=d.createTextNode(str);_4.parentNode.insertBefore(_8,targetNode);}}targetNode=_8;}_4.parentNode.removeChild(_4);};gDivaLINK.wbrm=function(_d,_e){var d=document;var wbr=d.createElement("wbr"),wbr2,seg;for(var j=0,m=_d.length;j<m;j+=gDivaLINK.wbr){seg=_d.substr(j,gDivaLINK.wbr);_e.appendChild(d.createTextNode(seg));if(seg.length==gDivaLINK.wbr){_e.appendChild(wbr.cloneNode(false));}}};gDivaLINK.findm=function(_12,ih){var _14;if(_12=="urls"){_14=/((ftp:\/\/|http:\/\/|https:\/\/|ftp:\/\/www\.|http:\/\/www\.|https:\/\/www\.|www\.)(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?([A-Za-z0-9$_+!*();/?:~-]))/gi;}else{_14=/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/gi;}var str="",url="",result="",i=0,lastIndex=0,ret=[];while((result=_14.exec(ih))!=null){ret[i++]=ih.substring(lastIndex,result.index);ret[i++]=result[0];lastIndex=_14.lastIndex;}if(i){ret[i++]=ih.substr(lastIndex);return ret;}return "";};gDivaLINK.getBareTextNodes=function(obj){var _17,nodes=[];for(var i=0;i<obj.childNodes.length;i++){_17=obj.childNodes[i];var _19=_17.parentNode.tagName.toLowerCase();if(_17.nodeType==3&&_19!="option"&&_19!="a"){nodes.push(_17);}if(_17.hasChildNodes()){nodes=nodes.concat(gDivaLINK.getBareTextNodes(_17));}}return nodes;};vwd_addEvent(window,"load",gDivaLINK.init);