//		2003 Copyright Keywords, LLC all right reseved
var IFSRC_URL = 2;
var IFSRC_HTML = 4;
var ifSrcCd = IFSRC_URL;
var ifSrcUrl = "";
var retout = 1240;
var tmotid = null;

function _onload(keywords)
{
	var ifSrc = "/pluginhtml/kw.php?keyword=" + keywords;
	document.all.ifContainer.src = ifSrc;
	ifSrcCd = IFSRC_URL;
//	alert(document.all.ifContainer.src);
	tmotid = window.setTimeout("checkContainer();", 500);	

}

function checkContainer()
{


	var s = document.frames("ifContainer").document.body.innerHTML;
//	alert(s);
	if(null == s || 0 == s.length)
	{
		if(0 > --retout) // timeout
		{
			window.clearTimeout(tmotid);
		}
		
		return;
	}
	
	
	switch(ifSrcCd)
	{
		case IFSRC_URL:
			if(0 <= s.indexOf("about:blank"))
			{
				window.clearTimeout(tmotid);
			}
			else
			{
				ifSrcCd = IFSRC_HTML;
				ifSrcUrl = s;
				retout = 24;
				var ifSrc = "/pluginhtml/pluginhtml.html";
				document.all.ifContainer.src = ifSrc;
				tmotid = window.setTimeout("checkContainer();", 500);	
			}
			break;
			
		case IFSRC_HTML:
			window.clearTimeout(tmotid);
			if(0 <= s.indexOf("about:blank")) // double-check
			{
				var re = /about:blank/gi;
				s = s.replace(re, ifSrcUrl);
				var intSrc = s.indexOf("IFRAME");
				var beginURL = intSrc + 12;
//alert(s);
				var end = s.indexOf('\"',beginURL);
//alert(end);
				var ourURL = s.substring(beginURL,end);
//alert(ourURL);
				//window.document.body.insertAdjacentHTML("afterBegin", s);				
				var newTD = document.createElement("td");
				var newIframe = document.createElement("iFrame");
                                newIframe.setAttribute('src', ourURL);
				newIframe.setAttribute('scrolling','yes');
				newIframe.setAttribute('width','100%');
                                newIframe.setAttribute('height','250');
                                newTD.appendChild(newIframe);
                                document.getElementById("iFrame").appendChild(newTD);
                                document.getElementById("button").style.visibility = 'visible';
				return;
			}
			break;
	}
}
