/* 	Work Link Javascript Library - Pro Version
	
	Clint Fountain - Copyright 2008 - All Rights Reserved
	
	Purpose: This library will automatically create links or overlays on user defined words found that exist
	in associated HTML documents.
	
	Legal Notice:
	
	This is a protected work. You may not sell, distribute, or create derivitive work based on this library.
		
	Owners of a license for this software are permitted to use this software on any web site that they personally own. 
	Licencees are not permitted to resell this software in any way, including combining this software into a larger product.
		
*/
if(window.WORDLINKS===undefined){window.WORDLINKS={};window.WORDLINKS.version="FULL";window.WORDLINKS.build="1.0";window.WORDLINKS.REQUEST={};window.WORDLINKS.LIST={};window.WORDLINKS.POPDIV={};window.WORDLINKS.useIframe=false;window.WORDLINKS.browserCheck=function(){var C,B,A,D;if(navigator.appName.substring(0,9)=="Microsoft"){C=navigator.appVersion.toLowerCase();B=C.indexOf("msie");A=parseFloat(C.substring(B+5,C.indexOf(";",B)));D=parseInt(A,10);if(D<=6){window.WORDLINKS.useIframe=true}}};window.WORDLINKS.browserCheck()}function WordLink(B){this.word="";this.id="";this.type="link";this.url="";this.overlay={};this.overlay.html=undefined;this.overlay.width=100;this.overlay.height=100;this.overlay.url=undefined;this.overlay.style=undefined;this.overlay.cssclass=undefined;this.overlay.position="above";this.overlay.yshift=0;this.overlay.xshift=0;this.attributes="";this.match={};this.match.conditions={tagName:["H1","H2","H3","H4","H5","H6","H7"],id:[],className:[]};this.match.type="exclude";this.match.method="exact";this.autostart=true;this.start=function(){window.WORDLINKS.parse([this])};if(B){if((typeof B=="object")&&(B.index===undefined)){for(var A in B){if(this[A]!==undefined){this[A]=B[A]}}}else{this.word=B}}this.id=this.word.replace(/[^A-Za-z0-9_\$]/ig,"_");window.WORDLINKS.LIST[this.id]=this}window.WORDLINKS.parse=function(C){function B(W){var D;if(!W.node){return false}D=W.node;var K=D.childNodes;for(var N in K){if(K[N].nodeType==3){if(K[N].parentNode.tagName=="A"){break}var T=false;var J="";if(K[N].data){J=String(K[N].data)}else{if(K[N].text){J=String(K[N].text)}else{break}}for(var S in C){if(typeof C=="object"){var Q=C[S].id;var I=C[S].word;var X=C[S].url;var U=C[S].overlay;var P=C[S].type;var O=C[S].match;var L=C[S].attributes;var H="";var V;if(O.method=="exact"){V=new RegExp("(?:\\b)("+I+")(?:\\b)","ig")}else{V=new RegExp("(?:\\b)(\\w*"+I+"\\w*)(?:\\b)","ig")}if(V.test(J)){var M=window.WORDLINKS.checkParentConditions({node:K[N],matchConditions:O.conditions});if(O.type=="exclude"){if(M){break}}else{if(O.type=="include"){if(!M){break}}else{break}}if(P=="link"){if(L){H=L}J=J.replace(V,'<a href="'+X+'" '+H+">$1</a>");T=true}else{if(P=="overlay"){if(!window.WORDLINKS.POPDIV[Q]){if(U.url&&!U.html){window.WORDLINKS.REQUEST.loadDocument(U.url,Q);do{}while(!window.WORDLINKS.REQUEST.LIST[Q].httpRequestObj.responseText.length);var E=/<body>([\S\s]*)<\/body>/igm;var G=E.exec(window.WORDLINKS.REQUEST.LIST[Q].httpRequestObj.responseText);if(G){C[S].overlay.html=G[1]}else{C[S].overlay.html=window.WORDLINKS.REQUEST.LIST[Q].httpRequestObj.responseText}}var R=new window.WORDLINKS.popDiv(Q);R.html=U.html;R.width=parseInt(U.width,10);R.height=parseInt(U.height,10);R.style=U.style;R.cssclass=U.cssclass;if(U.position=="above"){R.yshift=-(parseInt(U.height,10)+parseInt(U.yshift,10))}else{R.yshift=parseInt(U.yshift,10)}}if(L){H=L}J=J.replace(V,'<a href="'+X+'" onmouseover="WORDLINKS.POPDIV[\''+Q+"'].show();\" onmouseout=\"WORDLINKS.POPDIV['"+Q+"'].hide();\" "+H+">$1</a>");T=true}}}}}if(T===true){var F=document.createElement("span");F.innerHTML=J;D.replaceChild(F,K[N])}}else{if(K[N].childNodes){B({node:K[N]})}}}}var A=document.getElementsByTagName("body")[0];if(!C){C=window.WORDLINKS.LIST}B({node:A})};window.WORDLINKS.checkParentConditions=function(C){if(!C.node){return false}if(!C.matchConditions){return false}if(!C.matchConditions.className){C.matchConditions.className=[]}if(!C.matchConditions.tagName){C.matchConditions.tagName=[]}if(!C.matchConditions.id){C.matchConditions.id=[]}if((C.matchConditions.className.length===0)&&(C.matchConditions.id.length===0)&&(C.matchConditions.tagName.length===0)){return false}var E,B,D,A;E=true;B=C.node;do{if(!B.parentNode){E=false;break}if(C.matchConditions.id){if(B.parentNode.id){D=[];switch(typeof C.matchConditions.id){case"object":D=C.matchConditions.id;break;case"string":D.push(C.matchConditions.id);break}for(A=0;A<D.length;A++){if(D[A]==B.parentNode.id){return true}}}}if(C.matchConditions.tagName){if(B.parentNode.tagName){D=[];switch(typeof C.matchConditions.tagName){case"object":D=C.matchConditions.tagName;break;case"string":D.push(C.matchConditions.tagName);break}for(A=0;A<D.length;A++){if(D[A]==B.parentNode.tagName){return true}}}}if(C.matchConditions.className){if(B.parentNode.className){D=[];switch(typeof C.matchConditions.className){case"object":D=C.matchConditions.className;break;case"string":D.push(C.matchConditions.className);break}for(A=0;A<D.length;A++){if(D[A]==B.parentNode.className){return true}}}}if(B.parentNode){B=B.parentNode}else{E=false}}while(E===true);return false};window.WORDLINKS.popDiv=function(B){if(window.WORDLINKS.POPDIV[B]){return window.WORDLINKS.POPDIV[B]}this.id=B;this.divid=Math.round(Math.random()*10000000);this.width=0;this.height=0;this.xshift=0;this.yshift=0;this.html="";this.src="";this.position="absolute";this.cssclass="";this.element=undefined;this.elementIframe=undefined;this.state="off";this.scrolling="auto";this.style=undefined;if(!document.getElementById(this.divid)){var C=document.createElement("div");C.setAttribute("id",this.divid);document.body.appendChild(C)}if(window.WORDLINKS.useIframe&&!document.getElementById(this.divid+"Iframe")){var A=document.createElement("iframe");A.setAttribute("id",this.divid+"Iframe");A.setAttribute("scrolling","no");A.setAttribute("frameborder","0");A.setAttribute("src","BLOCKED SCRIPT'&lt;html&gt;&lt;/html&gt;';");A.style.position="absolute";A.style.border="none";A.style.filter="alpha(opacity=0)";A.style.display="none";A.style.zIndex="0";document.body.appendChild(A);this.elementIframe=document.getElementById(this.divid+"iFrame")}this.element=document.getElementById(this.divid);this.element.style.display="none";this.show=function(){this.build();if(this.elementIframe){this.elementIframe.style.display=""}this.element.style.display="";this.state="on"};this.hide=function(){if(this.elementIframe){this.elementIframe.style.display="none"}this.element.style.display="none";this.state="off"};this.destroy=function(){this.hide();delete WORDLINKS.POPDIV[this.id]};this.build=function(){this.writepop(this.width,this.height,this.xshift,this.yshift)};this.writepop=function(O,I,G,Q){O=parseInt(O,10);I=parseInt(I,10);G=parseInt(G,10);Q=parseInt(Q,10);var L=0;var K=0;var J=window.event;if(J.pageX||J.pageY){L=J.pageX;K=J.pageY}else{if(J.clientX||J.clientY){L=J.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;K=J.clientY+document.body.scrollTop+document.documentElement.scrollTop}}var N=L+G;var M=K+Q;var F=0,D=0;if(typeof window.innerWidth=="number"){F=window.innerWidth;D=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){F=document.documentElement.clientWidth;D=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){F=document.body.clientWidth;D=document.body.clientHeight}}}var E;if(!document.body.scrollTop){if(window.pageYOffset){E=window.pageYOffset}else{E=document.body.parentElement?document.body.parentElement.scrollTop:0}}else{E=document.body.scrollTop}if((N+O)-F>0){N=N-((N+O)-F);if(N<0){O=O+N;N=0}}if(N<0){N=0;if((N+O)-F>0){O=O-((N+O)-F)}}if(M<E){M=E;if((M+I)>(D+E)){I=I-((M+I)-(D+E))}}if((M+I)>(D+E)){M=M-((M+I)-(D+E));if(M<0){I=I+M;M=0}}if(this.position!==""){this.element.style.position=this.position}this.element.style.left=N;this.element.style.width=O;this.element.style.top=M;this.element.style.height=I;this.element.style.zIndex=100;this.element.innerHTML=this.html;if(this.cssclass!==""){this.element.className=this.cssclass}if(this.scrolling!==""){this.element.style.overflow="auto"}if(this.style&&(typeof this.style=="object")&&(this.style.index===undefined)){for(var P in this.style){if(typeof P=="string"){try{this.element.style[P]=this.style[P]}catch(H){}}}}if(this.elementIframe){this.elementIframe.style.display="";this.elementIframe.style.left=N;this.elementIframe.style.width=O;this.elementIframe.style.top=M;this.elementIframe.style.height=I}};window.WORDLINKS.POPDIV[this.id]=this};window.WORDLINKS.REQUEST.loadDocument=function(A,E){if(!window.WORDLINKS.REQUEST.LIST){window.WORDLINKS.REQUEST.LIST={}}window.WORDLINKS.REQUEST.LIST[E]={};window.WORDLINKS.REQUEST.LIST[E].url=A;window.WORDLINKS.REQUEST.LIST[E].name=E;window.WORDLINKS.REQUEST.LIST[E].httpRequestObj=false;if(window.XMLHttpRequest&&!window.ActiveXObject){try{window.WORDLINKS.REQUEST.LIST[E].httpRequestObj=new XMLHttpRequest()}catch(D){window.WORDLINKS.REQUEST.LIST[E].httpRequestObj=false}}else{if(window.ActiveXObject){try{window.WORDLINKS.REQUEST.LIST[E].httpRequestObj=new ActiveXObject("Msxml2.XMLHTTP")}catch(C){try{window.WORDLINKS.REQUEST.LIST[E].httpRequestObj=new ActiveXObject("Microsoft.XMLHTTP")}catch(B){window.WORDLINKS.REQUEST.LIST[E].httpRequestObj=false}}}}if(window.WORDLINKS.REQUEST.LIST[E].httpRequestObj){window.WORDLINKS.REQUEST.LIST[E].httpRequestObj.open("GET",A,true);window.WORDLINKS.REQUEST.LIST[E].httpRequestObj.send("")}};window.WORDLINKS.autoStart=function(){var B=[];for(var A in window.WORDLINKS.LIST){if(window.WORDLINKS.LIST[A].autostart===true){B.push(window.WORDLINKS.LIST[A])}}window.WORDLINKS.parse(B)};window.WORDLINKS.autoLoad=function(){if(typeof window.onload=="function"){var A=window.onload;window.onload=function(){window.WORDLINKS.autoStart();A()}}else{window.onload=window.WORDLINKS.autoStart}};window.WORDLINKS.autoLoad();