
	var ttWidgetInstanceNamingPrefix="TTWgtIns_";
	if (typeof howManyTTWidgets=="undefined") var howManyTTWidgets=0;
	howManyTTWidgets++;

	if (howManyTTWidgets==1) { //since this could be included multiple times on a page, only output the object def once per page
		var allTTWidgets=new Array();
		function TTwidget() {
			this.TTwgtObjectRef;
			this.TTwgtFeedID;
			this.TTwgtCacheLength;
			this.TTwgtPartner;
			this.TTwgtJs_addr;
			this.TTwgtCss_addr;
			this.TTwgtParameters;
			this.TTwgtUserParameters;
			this.TTwgtCallbackParameters;
			this.xmlSource;
			this.feed;

			this.outputContainer=function() {
				var headTag = document.getElementsByTagName("HEAD")[0];

				//add div to the document
				document.write('<div id="'+this.TTwgtObjectRef+'" class="ttWidget_'+this.TTwgtFeedID+'"></div>');
				this.widgetContainer = document.getElementById(this.TTwgtObjectRef);
			}

			this.outputCSS=function() {
				var headTag = document.getElementsByTagName("HEAD")[0];

				//add stylesheet to the document, but since there could be multiple widgets of the same types on the same page, don't relink to same stylesheet additional times
				var allLinkTags = document.getElementsByTagName("link");
				var continueToCSS=true;
				for (var x=0; x < allLinkTags.length; x++) {
					if (allLinkTags[x].href.indexOf(this.TTwgtCss_addr)!="-1") {
						continueToCSS=false;
						break;
					}
				}

				if (continueToCSS==true) {
					this.newCSS=document.createElement("link");
					this.newCSS.setAttribute("rel", "stylesheet");
					this.newCSS.setAttribute("type", "text/css");
					this.newCSS.setAttribute("href", this.TTwgtCss_addr);
					headTag.appendChild(this.newCSS);
				}
			}

			this.outputScriptTag=function() {
				var headTag = document.getElementsByTagName("HEAD")[0];

				newScriptTag=document.createElement("script");
				newScriptTag.setAttribute("id", this.TTwgtObjectRef+"_founder");
				newScriptTag.setAttribute("src", "http://widgets.techtarget.com/generateJS.php?objectRef="+this.TTwgtObjectRef+"&howManyTTWidgets="+howManyTTWidgets+"&jsPath="+encodeURIComponent(this.TTwgtJs_addr));
				newScriptTag.setAttribute("type", "text/javascript");

				headTag.appendChild(newScriptTag);
			}

			this.callBackFunction=function() {
				var headTag = document.getElementsByTagName("HEAD")[0];

				if (this.TTwgtCallbackParameters.cache_length!="" && typeof this.TTwgtCallbackParameters.cache_length!="undefined") this.TTwgtCacheLength=this.TTwgtCallbackParameters.cache_length;

				var url_base = "http://widgets.techtarget.com/generateWidget.php";
				var url = "";

				url += "?feedID="+this.TTwgtFeedID;
				url += "&objectRef="+this.TTwgtObjectRef;
				url += "&ttWidgetDisplayObjectName="+this.TTwgtCallbackParameters.ttWidgetDisplayObjectName;
				url += "&json_object_name="+encodeURIComponent(this.TTwgtCallbackParameters.json_object_name);
				url += "&callback="+encodeURIComponent(this.TTwgtCallbackParameters.call_when_complete);
				url += "&cache_length="+encodeURIComponent(this.TTwgtCacheLength);

				if (this.TTwgtCallbackParameters.url_encoded==true) {
					url += "&xml_addr="+this.TTwgtCallbackParameters.xml_url;
				} else {
					url += "&xml_addr="+encodeURIComponent(this.TTwgtCallbackParameters.xml_url);
				}

				url=url_base+url;

				var allScriptTags = document.getElementsByTagName("script");
				for (var x=0; x < allScriptTags.length; x++) {
					if (allScriptTags[x].id == this.TTwgtObjectRef+"_callbackScript_"+encodeURIComponent(this.TTwgtCallbackParameters.json_object_name)) {
						headTag.removeChild(allScriptTags[x]);
					}
				}

				newScriptTag=document.createElement("script");
				newScriptTag.setAttribute("id", this.TTwgtObjectRef+"_callbackScript_"+encodeURIComponent(this.TTwgtCallbackParameters.json_object_name));
				newScriptTag.setAttribute("src", url);
				newScriptTag.setAttribute("type", "text/javascript");
				headTag.appendChild(newScriptTag);
			}
		}
	}

	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'=new TTwidget();');

	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtObjectRef="'+ttWidgetInstanceNamingPrefix+howManyTTWidgets+'";');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtFeedID="3";');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtCacheLength="0";');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtPartner=location.hostname;');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtJs_addr="http://media.techtarget.com/widgets/referral_search/ttAjaxSearchWidget.js";');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtCss_addr="http://media.techtarget.com/widgets/referral_search/ttAjaxSearchWidget.css";');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtParameters="";');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtUserParameters={\"feedID\" : \"3\"};');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.TTwgtCallbackParameters="";');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.xmlSource="";');
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+'.feed=1;');

	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+".outputContainer();");
	
	eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+".outputCSS();");
		eval(ttWidgetInstanceNamingPrefix+howManyTTWidgets+".outputScriptTag();");

	