

function highlightWord(node,word,whatArEl) {
	// Iterate into this nodes childNodes
	if (node.hasChildNodes) {
		var hi_cn;
		for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) highlightWord(node.childNodes[hi_cn],word,whatArEl);
	}
	
	// And do this node itself
	if (node.nodeType == 3) { // text node
		tempNodeVal = node.nodeValue.toLowerCase();
		//alert(word);
		tempWordVal = word.toLowerCase();
		if (tempNodeVal.indexOf(tempWordVal) != -1) {
			pn = node.parentNode;
			if (pn.className != "dynAdInfoWordStyle") {
				//if (arWords[whatArEl][3] < intMaxHighlihgtsPerWord){
					// word has not already been highlighted!
					nv = node.nodeValue;
					ni = tempNodeVal.indexOf(tempWordVal);
					// Create a load of replacement nodes
					before = document.createTextNode(nv.substr(0,ni));
					docWordVal = nv.substr(ni,word.length);
					after = document.createTextNode(nv.substr(ni+word.length));
					hiwordtext = document.createTextNode(docWordVal);
					hiword = document.createElement("span");
					hiword.onmouseover = new Function("showDynInfoAdLayer(event,"+whatArEl+");");
					hiword.className = "dynAdInfoWordStyle";
					hiword.appendChild(hiwordtext);
					pn.insertBefore(before,node);
					pn.insertBefore(hiword,node);
					pn.insertBefore(after,node);
					pn.removeChild(node);

				//	arWords[whatArEl][3]++;
				//}
			}
		}
	}
}

function gimpHighlightWords(){
	for (w=0;w<arWords.length;w++) highlightWord(document.getElementsByTagName("body")[0],arWords[w][0],w);
}

function showDynInfoAdLayer(e,whatArEl) {

	content=''
		+'<table border=0 cellpadding=1 cellspacing=0 bgcolor="#000000"><tr><td>'
		+'<table width='+intLayerWith+' border=0 cellpadding=3 cellspacing=0 bgcolor="#ffea22"><tr><td bgcolor="#8D8D78">'
		+'<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>'
		+'<td><font color="#ffffff" size="2" face=tahoma><b>'+arWords[whatArEl][1]+'</b></font></td>'
		+'<td align="right"><a href="JavaScript:hideDynInfoAdLayer();"><font color="#ffffff" size="1" face=tahoma><b>[close]</font></a></td>'
		+'</tr></table></td><tr>'
		+'<td bgcolor="#F5F5DC"><font color="#4F4F3F" size="2" face=tahoma>'+arWords[whatArEl][2]+'</font></td>'
		+'</tr></table></td></tr></table>';
	document.all("dynAdInfoLayer").innerHTML = content;
	if (e) {
		x = e.clientX;
		y = e.clientY + document.body.scrollTop;
		if (x > (intWindowWidth - intLayerBuffer - intLayerWith)){
			x = intWindowWidth - intLayerBuffer - intLayerWith;
		}
	}
	dynAdInfoLayer.style.posLeft = x;
	dynAdInfoLayer.style.posTop = y;
	dynAdInfoLayer.style.visibility = 'visible';
}

function hideDynInfoAdLayer() {
	dynAdInfoLayer.style.visibility = 'hidden';
}


if (document.all){
	// initiate vars and start the ball rolling, but only for IE
	intLayerWith = 250;
	intLayerBuffer = 20;
	intMaxHighlihgtsPerWord = 5;
	intWindowWidth = document.body.clientWidth;
	strGenericTitle = 'GoldenPalace.com';
	strGenericText = '<a href="http://banner.goldenpalace.com/cgi-bin/redir.cgi?id=N&member=seeding&profile=context1" target="_blank"><b><font color="#000000">Golden Palace Online Casino</font></b></a> is dedicated to making your gaming experience as exciting and rewarding as possible. We combine cutting-edge software, 24-hr. live support, and the most advanced security measures available to provide the thrill of Las Vegas from the comfort and safety of your own home.';
	$i=0;

	arWords = new Array();
	// custom words
	arWords[$i++] = new Array('blackjack','Blackjack','<a href="http://banner.goldenpalace.com/cgi-bin/redir.cgi?id=N&member=seeding&profile=context1" target="_blank"><b><font color="#000000">GoldenPalace.com</font></b></a> has the best backjack on the net.  Every week there are winners walking away from our blackjack game with thousands of dollars... you could be next!',0);
	arWords[$i++] = new Array('slots','Slots','<a href="http://banner.goldenpalace.com/cgi-bin/redir.cgi?id=N&member=seeding&profile=context1" target="_blank"><b><font color="#000000">GoldenPalace.com</font></b></a> offers a wide range of slot machines and progressive slots to ensure you will always find a game that suits your mood, and your personality.  Be sure to take advantage of their generous sign-up bonus offers, and frequent player bonuses.',0);
	arWords[$i++] = new Array('video poker','Video Poker','<a href="http://banner.goldenpalace.com/cgi-bin/redir.cgi?id=N&member=seeding&profile=context1" target="_blank"><b><font color="#000000">GoldenPalace.com</font></b></a> is pleased to present the finest online video poker suite, including Deuces and Jokers, Deuces wild, Double joker, Jacks or Better, Tens or Better, and their Slapstick progressive video poker.',0);
	arWords[$i++] = new Array('roulette','Roulette','<a href="http://banner.goldenpalace.com/cgi-bin/redir.cgi?id=N&member=seeding&profile=context1" target="_blank"><b><font color="#000000">GoldenPalace.com</font></b></a> is happy to offer you an exciting and fun roulette game for free or real play.',0);
	arWords[$i++] = new Array('craps','Craps','One of gambling\'s most loved games has met the net with the introduction of <a href="http://banner.goldenpalace.com/cgi-bin/redir.cgi?id=N&member=seeding&profile=context1" target="_blank"><b><font color="#000000">GoldenPalace.com</font></b></a>\'s latest suite of games! Craps is quite possibly the most entertaining casino game there is, and online craps lives up to that glowing reputation!',0);
	// generic words
	arWords[$i++] = new Array('casino',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('wager',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('bet',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('las vegas',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('vegas',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('bingo',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('keno',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('gamble',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('dealer',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('bonus',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('comp',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('gambling',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('casinos',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('casino',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('poker',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('betting',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('slot machines',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('gaming',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('baccarat',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('sportsbook',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('bonuses',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('slot machine',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('bets',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('wagering',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('pai gow',strGenericTitle,strGenericText,0);
	arWords[$i++] = new Array('videopoker',strGenericTitle,strGenericText,0);



	document.write('<style type="text/css">');
	document.write('.dynAdInfoLayerStyle{position:absolute;visibility:hidden;}');
	// document.write('.dynAdInfoWordStyle{background-color:yellow;}');
	document.write('.dynAdInfoWordStyle{border-bottom: 1px dashed;}');
	document.write('</style>');
	document.write('<span id="dynAdInfoLayer" class="dynAdInfoLayerStyle"></span>');
	window.onload = gimpHighlightWords;
}
