
if(typeof jQuery == "undefined")
	document.write('<script type="text/javascript" src="http://api.wthashtag.com/js/jquery-latest.js"></script>');;

checkConfig();

var str = '';
str += '<script type="text/javascript" src="http://api.wthashtag.com/widget/stream.js"></script>';
str += '<link rel="stylesheet" href="http://api.wthashtag.com/widget/stream.css" />';
str += '<div id="streamWrapper" style="width: '+wth.width+'px;">';
str += '	<div id="stream-actions">';
str += '		<span id="hashtag" title="Click to change" onclick="switchTag(\'false\');">#'+wth.hashtag+'</span>';
str += '		<span id="taginputs">';
str += '			# <input type="text" id="newhashtag" value="" />';
str += '			<input type="submit" value="Switch" onclick="switchTag(\'true\');" />';
str += '		</span>';
str += '		<span id="pauseStream">Real-Time mode (<a href="javascript:;" onclick="pauseStream();">Pause</a>)</span>';
str += '		<span id="resumeStream">Stream Paused (<a href="javascript:;" onclick="resumeStream();">Resume</a>)</span>';
str += '	</div>';
str += '	<div id="description"></div>';
str += '	<div id="tweets" class="wthstream" lang="en" title="%23'+wth.hashtag+'" style="height: '+wth.smallHeight+'px;"></div>';
str += '	<div class="visualClear"></div>';
str += '	<div id="tweets-below-widget">';
str += '	<table width="100%" cellpadding="0" cellspacing="0"><tr valign="middle">'
str += '		<td id="embedthis" width="33%"><a href="http://wthashtag.com/WTH:Widgets">Get Your Widget</a></td>';
str += '		<td width="33%" align="center">';
str += '			<h3><a id="moretweets" onclick="tweetBox(\'large\');">More</a></h3>';
str += '			<h3><a id="lesstweets" onclick="tweetBox(\'small\');" style="display:none">Less</a></h3>';
str += '		</td>';
str += '		<td id="poweredby"><a href="http://api.wthashtag.com/"><img src="http://api.wthashtag.com/widget/pwrd_by_wth.png" /></a></td>';
str += '	</tr></table>';
str += '	</div>';
str += '</div>';

document.write(str);

function checkConfig()
{
	if(!wth.hashtag)
		wth.hashtag = "twitter";
	
	if(!wth.width)
		wth.width = 600;
		
	if(!wth.refreshRate || wth.refreshRate < 3000)
		wth.refreshRate = 5000;
	
	if(!wth.autostart)
		wth.autostart = true;
	
	if(!wth.smallHeight)
		wth.smallHeight = 450;
	
	if(!wth.largeHeight)
		wth.largeHeight = 900;
	
	if(!wth.linkto)
		wth.linkto = "wth";
	
	if(!wth.description)
		wth.description = false;
	
	return wth;
}