(function() {
var ds_namespace = '__dsns_', ds_plugin_name = 'KIMA_WidgetsV1';
window[ds_plugin_name] = function() {
		var Keywords = '50 Cent,Adam Putnam,Adam Sandler,Adam Smith,AFC,Akon,Al Franken,Alan Jackson,Alan Sillence,Alec Baldwin,Alfred Hitchcock,Alicia Keys,Alison Krauss,Amy Klobuchar,Amy Winehouse,Anderson Cooper,Angelina Jolie,Anna Nicole Smith,Antonio Banderas,Aretha Franklin,Arlen Specter,Arnold Schwarzenegger,Ashlee Simpson,Ashley Judd,Ashley Tisdale,Ashton Kutcher,Audrey Asistio,Audrey Hepburn,Avril Lavigne,Barack Obama,Barbara Boxer,Barbara Lee,Barbara Mikulski,Barney Frank,Barry Manilow,Bart Gordon,Baseball,Basketball,Ben Nelson,Ben Stiller,Bennie Thompson,Bernie Mac,Bette Midler,Beverly Perdue,Beyonce Knowles,Bill Cosby,Bill Maher,Bill Nelson,Bill Richardson,Bill Ritter,Billy Joel,Billy Ray Cyrus,Bjork,Bob Casey,Bob Corker,Bob Dylan,Bob Marley,Bob Newhart,Bob Riley,Bobby Brown,Bobby Jindal,Bobby Rush,Bowling,Boxing,Brad Henry,Brad Miller,Brad Paisley,Brad Pitt,Britney Spears,Brooke Burke,Bruce Lee,Bruce Springsteen,Busta Rhymes,Byron Dorgan,Cameron Diaz,Carl Levin,Carlos Gutierrez,Carmen Electra,Carol Burnett,Carrie Underwood,Cassie,Celine Dion,Channing Tatum,Charles Manson,Charlie Brown,Charlie Chaplin,Charlie Crist,Charlie Rangel,Charlie Sheen,Charlie Wilson,Charlize Theron,Chet Culver,Chevy Chase,Chris Brown,Chris Dodd,Chris Gregoire,Chris Lee,Chris Rock,Chris Smith,Chris Van Hollen,Christian Bale,Christie Brinkley,Christina Aguilera,Chuck Berry,Chuck Grassley,Chuck Schumer,Chuck Wicks,Ciara,Claire McCaskill,Clay Aiken,Cle Elum,Clint Eastwood,Commentaries,Condoleezza Rice,Consumer Reports,Courtney Love,Cowiche,Craig Ferguson,Cricket,Cycling,Dakota Fanning,Dane Cook,Daniel Inouye,Darius Rucker,Darrell Issa,Dave Edler,Dave Matthews,David Archuleta,David Beckham,David Bowie,David Letterman,David Price,David Robinson,David Vitter,Dean Martin,Debbie Stabenow,Demi Moore,Denise Richards,Dennis Kucinich,Dennis Quaid,Dennis Rodman,Denzel Washington,Deval Patrick,Diana Ross,Diane Lane,Dianne Feinstein,Dick Cheney,Dick Durbin,Dick Zais,Diddy,DMX,Doc Hastings,Dolly Parton,Don Young,Dr. Dre,Drew Barrymore,Drew Carey,Duke Ellington,Duncan Hunter,Easton,Ed Rendell,Eddie Murphy,Edolphus Towns,Elijah Cummings,Elizabeth Taylor,Ellen DeGeneres,Ellen Tauscher,Ellensburg,Elton John,Elvis Presley,Eminem,Emma Watson,Eric Cantor,Eric Clapton,Etta James,Eva Longoria,Evan Bayh,Faith Hill,Fergie,Football,Frank Lautenberg,Frank Lucas,Frank Sinatra,Fred Thompson,Garth Brooks,Gene Taylor,George Bush,George Clooney,George Harrison,George Jones,George Lopez,George Michael,George Miller,George Strait,Gerard Butler,Golf,Gordon Smith,Grandview,Granger,Greg Walden,Gwen Stefani,Gwyneth Paltrow,Gymnastics,Haley Barbour,Halle Berry,Hank Williams,Harold Ford,Harrah,Harrison Ford,Harry Reid,Hayden Panettiere,Heath Ledger,Heather Reese,Heather Wilson,Heidi Klum,Henry Waxman,Hilary Duff,Hilda Solis,Hillary Clinton,Hockey,Howard Stern,Hugh Jackman,Hulk Hogan,Ice Cube,Ike Skelton,Jack Benny,Jack Black,Jack Johnson,Jack Kevorkian,Jack Nicholson,Jack Reed,Jackson Browne,Jade Goody,James Brown,James Dean,James Franco,James Taylor,Jamie Foxx,Janet Jackson,Janet Napolitano,Janis Joplin,Jay Leno,Jay Rockefeller,Jay-Z,Jeff Sessions,Jennifer Aniston,Jennifer Garner,Jennifer Granholm,Jennifer Hudson,Jennifer Lopez,Jerry Lewis,Jerry Springer,Jesse Jackson,Jessica Alba,Jessica Biel,Jessica Simpson,Jim Bunning,Jim Carrey,Jim Doyle,Jim Gibbons,Jim Morrison,Jim Webb,Jimi Hendrix,Jimmy Buffett,Jimmy Fallon,Jimmy Kimmel,Joaquin Phoenix,Jodie Foster,Joe Biden,Joe Manchin,Joe Sestak,Joe Wilson,John Baldacci,John Boehner,John Conyers,John Cornyn,John Denver,John Dingell,John Edwards,John Hall,John Kerry,John Legend,John Lennon,John Lynch,John Mayer,John McCain,John Tierney,John Travolta,John Warner,John Wayne,Johnny Carson,Johnny Cash,Johnny Depp,Johnny Isakson,Jon Kyl,Jon Stewart,Jordan Steele,Jordin Sparks,Josh Groban,Josh Hartnett,Judy Garland,Julia Roberts,Justin Timberlake,Kanye West,Kate Hudson,Kate Moss,Kate Winslet,Katherine Heigl,Kathleen Sebelius,Kathy Ireland,Katie Couric,Katie Holmes,Keira Knightley,Keith Urban,Kellie Pickler,Kelly Clarkson,Kelly Ripa,Ken Salazar,Kenny Chesney,Kenny Rogers,Kevin Costner,Kevin McCarthy,Kid Rock,Kim Kardashian,King County,Kirsten Gillibrand,Kit Bond,Kitsap County,Kittitas,Kristen Stewart,Kurt Cobain,Kyle Trompeter,Lamar Alexander,Lamar Smith,Larry Craig,Lauren Conrad,LeAnn Rimes,Leonard Cohen,Leonardo DiCaprio,Lil\' Kim,Lil Wayne,Lily Allen,Lindsay Lohan,Lindsey Graham,Lionel Richie,Lisa Murkowski,LL Cool J,Louis Armstrong,Lucille Ball,Ludacris,Mabton,Madonna,Mandy Moore,Marc Anthony,Margaret Spellings,Maria Cantwell,Mariah Carey,Marie Osmond,Marilyn Monroe,Mariska Hargitay,Mark Begich,Mark Pryor,Mark Sanford,Mark Udall,Marsha Blackburn,Martin Lawrence,Martin O\'Malley,Martina McBride,Marvin Gaye,Mary J. Blige,Mary Landrieu,Mary Tyler Moore,Matt Damon,Max Baucus,Meg Ryan,Megan Fox,Mel Gibson,Mel Martinez,Melissa Wagner,Meryl Streep,Michael Chertoff,Michael Douglas,Michael Jackson,Michelle Williams,Mickey Rourke,Mike Beebe,Mike Crapo,Mike Doyle,Mike Huckabee,Mike Pence,Mike Thompson,Miley Cyrus,Miranda Lambert,Mitch Daniels,Mitch McConnell,Mitt Romney,MLB,MLS,Molly Kelleher,Morgan Freeman,Moxee,Naches,Nancy Pelosi,Naomi Campbell,NASCAR,Natalie Portman,Natasha Bedingfield,NBA,Neil Diamond,Neil Young,Nelly,Newslinks,Ne-Yo,NFC,NFL,NHL,Nicole Kidman,Nicole Richie,Norm Coleman,Norm Dicks,Norm Johnson,Olympia Snowe,Oprah Winfrey,Orlando Bloom,Orrin Hatch,Outlook,Ozzy Osbourne,Pamela Anderson,Paris Hilton,Parker,Pat Roberts,Patrick Leahy,Patrick Swayze,Patty Murray,Paul McCartney,Paul Newman,Paul Simon,Paula Abdul,Penelope Cruz,Pete Stark,PGA,Pierce County,Prosser,Queen Latifah,R. Kelly,Rachel Melnick,Rahm Emanuel,Randy Dorn,Randy Jackson,Ray Charles,Reba McEntire,Reese Witherspoon,Richard Gere,Richard Shelby,Rick Larsen,Rick Perry,Ricky Martin,Rob McKenna,Robert Byrd,Robin Thicke,Robin Williams,Rod Blagojevich,Rod Stewart,Rodeo,Ron Howard,Ron Paul,Ron Wyden,Ronald,Ronald Reagan,Roy Orbison,Rudy Giuliani,Russ Feingold,Ryan Reynolds,Ryan Seacrest,Sade,Sade Malloy,Salma Hayek,Sam Granato,Sam Reed,Samuel L. Jackson,Sandra Bullock,Sarah Jessica Parker,Sarah Palin,Sarah Silverman,Saxby Chambliss,Scarlett Johansson,Sean Connery,Sean Penn,Selah,Selena,Seth Rogen,Shaggy,Shakira,Shania Twain,Shaquille O\'Neal,Sharon Stone,Sherrod Brown,Sheryl Crow,Silvestre Reyes,Simon Cowell,Skagit County,Skiing,Snohomish County,Snoop Dogg,Snoqualmie Pass,Snowboarding,Soccer,Softball,Sonny Perdue,Sophia Loren,Stacy Lilienthal,Stephen Johnson,Steve Young,Stevie Wonder,Sunnyside,Susan Collins,Susan Lucci,Taylor Hicks,Taylor Swift,Ted Kennedy,Ted Stevens,Ted Strickland,Tennis,Thurston County,Tieton,Tiger Woods,Tim Burton,Tim Johnson,Tim Mahoney,Tim McGraw,Tim Pawlenty,Tina Turner,Toby Keith,Tom Coburn,Tom Cruise,Tom Hanks,Tom Harkin,Tom Petty,Tommy Lee,Toppenish,T-Pain,Trace Adkins,Trent Lott,Troy Barrett,Tyler Perry,Tyra Banks,Usher,Vin Diesel,Vince Gill,Volleyball,Walter Jones,Walter Reed,Wapato,Whatcom County,White Swan,Whitney Houston,Will Ferrell,Will Smith,WNBA,Woody Allen,Wrestling,WWE,Yakima,Zac Efron,Zillah,'.split(','); var qsHTML = '<div class="dsnsqs">\n\t<div class="title">\n\t\t<div class="text">Advanced Search</div>\n\t\t<div class="close">&times;</div><i></i>\n\t</div>\n\t<form action="http://search.kval.com">\n\t\t<input type="hidden" name="ct" value="r" />\n\t\t<label for="qscat_{id}">Category</label><select id="qscat_{id}" rel="20198">\n\t\t\t<option value="">( any category )</option>\n\t\t\t<option value="89000014">Local &amp; Regional</option>\n\t\t\t<option value="89000002">National &amp; World</option>\n\t\t\t<option value="89000030">Business</option>\n\t\t\t<option value="90000008">Economy</option>\n\t\t\t<option value="90000033">Consumer</option>\n\t\t\t<option value="112000001">Health</option>\n\t\t\t<option value="20249405">Sports</option>\n\t\t\t<option value="20249361">Entertainment</option>\n\t\t\t<option value="20249403">Programming</option>\n\t\t\t<option value="20249368">Inside KATU</option>\n\t\t\t<option value="20249412">Traffic</option>\n\t\t\t<option value="20249394">Outdoors</option>\n\t\t\t<option value="112000005">Weird</option>\n\t\t\t<option value="20249363">Home</option>\n\t\t\t<option value="112000002">Mind & Money</option>\n\t\t\t<option value="20249357">Blogs</option>\n\t\t\t<option value="112000004">Tech</option>\n\t\t\t<option value="20249373">News</option>\n\t\t\t<option value="20249416">Weather</option>\n\t\t\t<option value="90000001">YouNews</option>\n\t\t</select><i></i>\n\t\t<label for="qsfeat_{id}">When</label><select id="qsdate_{id}" rel="r.STRDAT">\n\t\t\t<option value="">( anytime )</option>\n\t\t\t<option value="0">Today</option>\n\t\t\t<option value="7">Past 7 Days</option>\n\t\t\t<option value="30">Past 30 Days</option>\n\t\t\t<option value="365">Past 12 Months</option>\n\t\t</select><i></i>\n\t\t<label for="qscity_{id}">City</label><select id="qscity_{id}" rel="361">\n\t\t\t<option value="">( any city )</option>\n\t\t\t<option value="102513" rel="2118">Portland</option>\n\t\t\t<option value="113204" rel="119">Vancouver</option>\n\t\t\t<option value="71809" rel="1575">Albany</option>\n\t\t\t<option value="105944" rel="183">Salem</option>\n\t\t\t<option value="97013" rel="">Mount Hood Parkdale</option>\n\t\t\t<option value="73349" rel="231">Banks</option>\n\t\t\t<option value="93503" rel="635">Longview</option>\n\t\t\t<option value="96573" rel="286">Monroe</option>\n\t\t</select><i></i>\n\t\t<label for="qscnty_{id}">County</label><select id="qscnty_{id}" rel="6">\n\t\t\t<option value="">( any county )</option>\n\t\t\t<option value="2118">Multnomah</option>\n\t\t\t<option value="119">Clark</option>\n\t\t\t<option value="183">Marion</option>\n\t\t\t<option value="2108">Clackamas</option>\n\t\t\t<option value="1575">Linn</option>\n\t\t\t<option value="231">Washington</option>\n\t\t\t<option value="635">Cowlitz</option>\n\t\t\t<option value="286">Benton</option>\n\t\t</select><i></i>\n\t\t<label for="qstext">Keywords</label><input class="qstext" name="q" /><i></i>\n\t\t<input type="submit" class="normalbutton" value="Search" /><i></i>\n\t</form>\n</div>';
		var plugin_name = ds_plugin_name;
		var Load = function() {
				if(typeof window[ds_namespace] == "object" && typeof window[ds_namespace].OnInit != "undefined") {
						if(window[ds_namespace].Initialized) {
								window[ds_plugin_name].Init(window[ds_namespace]);
								if(window[ds_namespace].IsReady)
										window[ds_plugin_name].Ready(window[ds_namespace]);
								else
										window[ds_namespace].OnReady.push(window[ds_plugin_name].Ready);
						}
						else {
								window[ds_namespace].OnInit.push(window[ds_plugin_name].Init);
						}
						return;
				} else {
						window[ds_namespace] = {};
				}
				if(typeof jQuery == "function")
						window[ds_plugin_name].other = jQuery;
				if(typeof jQuery == "function" && (jQuery.fn.jquery == '1.3.1' || jQuery.fn.jquery == '1.3.2')) {
						window[ds_plugin_name].$ = jQuery;
						window[ds_plugin_name].Init();
				}
				else
				{
						var el = document.createElement('SCRIPT');
						el.setAttribute('language', 'JavaScript');
						el.setAttribute('src', 'http://cdn.secondspace.com/fshr/1.2.0b/jQuery.js');
						document.getElementsByTagName('head')[0].appendChild(el);
						WaitForInit(1000);
				}
		}
				
		var WaitForInit = function(max) {
				if(typeof window[ds_namespace].$ != "function") {
						if (max > 0)
								setTimeout(function() { window[ds_plugin_name].WaitForInit(max - 1); }, 10);
						return;
				}
				window[ds_plugin_name].Init();
		}
		var WaitForReady = function(max) {
				if(!max) max = 100;
				if(typeof window[ds_plugin_name].FullyInitialized != 'bool') {
						if (max > 0)
								setTimeout(function() { window[ds_plugin_name].WaitForReady(max - 1); }, 10);
						return;
				}
				window[ds_plugin_name].Ready();
		}
		var WaitForBody = function(max) {
				if(!max) max = 100;
				try {
						document.body.className += ' dsnsjs';
				} catch (e) {
						if (max > 0)
								setTimeout(function() { window[ds_plugin_name].WaitForBody(max - 1); }, 10);
				}
		}
		
		var SetCookie = function(name, value, expires, domain, path) {
				if(!expires) expires = 'Wed, 1 Jan 2020 00:00:00 UTC';
				if(!path) path = '/';
				if(!domain && location.host.indexOf('.') != -1) { // default to topmost domain
						var a = location.host.split('.');
						domain = '.' + a[a.length-2] + '.'+ a[a.length-1];
				}
				document.cookie = name+'='+value+'; expires='+expires+'; domain='+domain+'; path='+path;
		}
		
		var GetCookie = function(name) { 
				var nameEQ = name + '=';
				var ca = document.cookie.split(';');
				for(var i=0;i < ca.length;i++) {
						var c = ca[i];
						while (c.charAt(0)==' ') c = c.substring(1,c.length);
						if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
				}
				return null;
		}
		
		var Init = function(host) {
				if(window[ds_plugin_name].Initialized) return;
				window[ds_plugin_name].Initialized = true;
				if(typeof $ == 'undefined')
				{
						if(host) // we're a plugin
								$ = window[ds_plugin_name].$ = host.$;
						else 
								$ = window[ds_namespace].$;
				}
				if(typeof $ == 'undefined')
						return;
				
				$.ajaxSetup({ cache: true });
				var IE = $.browser.msie;
				var IE6 = IE && /MSIE 6/.test(navigator.userAgent);
				var IE8 = IE && /MSIE 8/.test(navigator.userAgent);
				
				function Bind(sel, ev, func) {$(sel).live(ev, func);}
				function FullQuery(q) {var r = {};if(!q) q = CurrentSearch();if(!q) return new Array(); q = q.replace(/^\?/,'').replace(/\&$/,'');$.each(q.split('&'), function(){r[this.split('=')[0]] = this.split('=')[1];});return r;};
				function CurrentSearch() {var s = GetMetaData($('.searchquery'), location.search);if(!s || s == undefined)return false;return s;}
				function GetMetaData(el, fallback) {el = $(el);if(typeof fallback == 'undefined')fallback = false;if(el.length == 0)return fallback;var h = $.trim(el.html());if(h.slice(0, 4) == '<!--')h = h.slice(4);if(h.slice(-3) == '-->')h = h.slice(0, -3);return $.trim(h);}
				
				var Autocomplete = function(input) {
var cache = new Array();
var pending,popup,seeAllLink,list;
var options = {extraleft:0, extrawidth:0, maxheight:175, extratop:0, host:'BODY', match:'startword'}; // match:all, start, startword

function Render(data, q, c) {
	if(typeof data == 'undefined' || typeof data.suggest == 'undefined')
		return;

	list.empty();
	seeAllLink.css({ display: 'none' }).unbind();
	var html1 = new Array();
	var html2 = new Array();
	var html3 = new Array();
	var all = new RegExp(query, 'i');
	var start = new RegExp('^'+query, 'i');
	var startword = new RegExp(' '+query, 'i');
	var count = 0;
	var truncated = false;
	for(var i=0;i<data.suggest.length;i++) {
		var matched = false;
		var s = data.suggest[i].replace( all, function(q) { matched = true; return '<span class="match">' + q + '</span>' });
		if (matched) {
			// test if the cached data is valid
			var l = data.suggest[i].toLowerCase();
			if (typeof q != 'undefined' && typeof c != 'undefined' && l.indexOf(c) != l.indexOf(q))
				return false;
			if(start.test(l))
					html1.push('<li>' + s + '</li>');
			else if(startword.test(l) && options.match == 'startword')
					html2.push('<li>' + s + '</li>');
			else if(options.match == 'all')
					html3.push('<li>' + s + '</li>');
			else
				continue;
			count++;
			if (count > 100 && !seeAll) {
				truncated = true;
				break;
			}
		}			
	}
	if (html1.length + html2.length + html3.length == 0) {
		popup.css({ display: 'none' });
		return true;
	}
	list.append(html1.join('') + html2.join('') + html3.join(''));
	if (truncated) seeAllLink.css({ display: 'inline' }).click(function() { Complete(true); host.focus(); return false; });
	var o = host.offset();
	var d = {height:host.height(), width:host.outerWidth()};
	var top = o.top + d.height + options.extratop + 5;
	var left = o.left + options.extraleft;
	var width = d.width + options.extrawidth - 1;
	popup.css({height:'auto', overflowY:'auto', display:'block', top:top, left:left, width:width});
	if(list.height() > options.maxheight)
		popup.css({height:options.maxheight, overflowY:'scroll'});
	list.find('LI').hover(MouseOver, MouseOut).click(Click);
	popup.scrollTop(0);
	host.focus();
	$(document).click(BodyClick);
	return true;
}
function BodyClick(event) {							
	$(document).unbind('click', BodyClick);
	var target = $(event.target);
	if(target.parents('#AutoComplete_'+id).length == 0)
	{
		popup.css({display:'none'});
		return;
	}

	list = $('#AutoComplete_'+id);				
	if (list == null)
		return;

	var selected = list.find('.mouseover');
	if (selected.length == 0) return;
	host.val(selected.text()).focus();		 
}

function ScrollToView() {
	var selected = list.find('.selected');
	var pos = selected.position().top;
	var max = popup.height() - selected.outerHeight();
	if(pos > max)
		popup.scrollTop(popup.scrollTop() + pos - max);
	if(pos < 0)
		popup.scrollTop(popup.scrollTop() + pos);
}
function HandleKey(event) {
	var selected = list.find('.selected');
	var keycode = event.which;
	if(keycode == 9) {
		// if there's only one choice, select it
		if(selected.length > 0 && list.find('LI').length == 1) {
			popup.css({display:'none'});
			host.val(selected.text()+' ').focus();
			return false;
		}
		if(event.shiftKey)
			keycode = 38; // shift+tab = up
		else
			keycode = 40; // tab = down
	}
	switch(keycode) {
		case 13:	// return when item selected, get text
			if(selected.length == 0)
			{				
				return true;
			}
			popup.css({display:'none'});
			host.val(selected.text()).focus();
			return true;
		case 40: // down selects the one below
			if(selected.length == 0) {
				list.find('LI:first').addClass('selected');
				ScrollToView();
				return false;
			}
			var next = selected.removeClass('selected').next();
			if(next.length == 0)
				list.find('LI:first').addClass('selected');
			else
				next.addClass('selected');
			ScrollToView();
			return false;
		case 38: // up selects the one on top
			if(selected.length == 0) {
				list.find('LI:last').addClass('selected');
				ScrollToView();
				return false;
			}
			var prev = selected.removeClass('selected').prev();
			if(prev.length == 0)
				list.find('LI:last').addClass('selected');
			else
				prev.addClass('selected');
			ScrollToView();
			return false;
		case 16: // shift by itself
			return true;
		case 33: //page up
			popup.scrollTop(popup.scrollTop() - popup.height());
			return false;
		case 34: // page down
			popup.scrollTop(popup.scrollTop() + popup.height());
			return false;
		case 27: // esc: disable autocomplete
			popup.css({display:'none'});
			host.attr('autocomplete', 'on');
			host.attr('AutoCompleted', 'false');
			host.unbind('keydown', HandleKey);
			return false;
		default:
			setTimeout(function() {Complete();}, 10);
			return true;
	}
}

function Complete(forceSeeAll) {
	if(!host || !popup || !list) return;
	seeAll = false;
	if (forceSeeAll) seeAll = true;
	var v = host.val();
	if(v.length < 3) {
		popup.css({display:'none'});
		return;
	}
	
	query = v.toLowerCase();
	var p = host.val().substring(0,i);
	prefix = ''
	if(p.length > 0)
		prefix = '<span class="before">'+p+' </span>';

	// check if we have a cache for the the full length down to the first 3 letters
	// if we do, call render and see if it's a valid one
	var cacheKey = query +'';
	var data = false;
	for(var i=query.length;i>2;i--) {
		cacheKey = query.substring(0, i);
		data = cache[cacheKey];
		if (typeof data != 'undefined')
			if(Render(data, query, cacheKey))
				return;
	}
	cacheKey = query + ''; // revert to the full key
	var data = {suggest:new Array()};
	var r = new RegExp(query, 'i');
	data.suggest = $.grep(Keywords, function(n,i) {return r.test(n);} );
	cache[cacheKey] = data;
	Render(data);
	// call the web service
	/*
	var url = "/ws.aspx?key=SUGGEST&q=" + query;
	if (pending) return;
	pending = true;
	setTimeout(function() {pending = false;}, 2000);
	$.getJSON(url,
		function(data){
			cache[cacheKey] = data;
			pending = false;
			Render(data);
		}
	);
	*/
}
function MouseOver() {
	$(this).addClass('mouseover');
}
function MouseOut(event) {
	$(this).removeClass('mouseover');
}
function Click(event) {
	if(!host) return;
	popup.css({display:'none'});
	host.val($(this).text()+' ').focus();
}
function Resized(event) {
	if($(window).width() != savedWidth)
		setTimeout(function() {Complete();}, 10);
	savedWidth = $(window).width();
}
var savedWidth = $(window).width();
$(window).bind('resize', Resized);
			
var host = $(input);
// look for options
var temp = host.parent().html();
var start = temp.indexOf('<!-- autocompleted.options');
if(start > -1) {
	temp = temp.substring(start + 26, temp.indexOf('-->', start))+' ';
	var extraleft = temp.indexOf('extraleft:');
	if(extraleft > -1)
		try {options.extraleft = parseInt(temp.substring(extraleft + 10, temp.indexOf(' ', extraleft + 10)));} catch(err) {}
	var extrawidth = temp.indexOf('extrawidth:');
	if(extrawidth > -1)
		try {options.extrawidth = parseInt(temp.substring(extrawidth + 11, temp.indexOf(' ', extrawidth + 11)));} catch(err) {}
	var extratop = temp.indexOf('extratop:');
	if(extratop > -1)
		try {options.extratop = parseInt(temp.substring(extratop + 9, temp.indexOf(' ', extratop + 9)));} catch(err) {}
	var maxheight = temp.indexOf('maxheight:');
	if(maxheight > -1)
		try {options.maxheight = parseInt(temp.substring(maxheight + 10, temp.indexOf(' ', maxheight + 10)));} catch(err) {}
	var achost = temp.indexOf('host:');
	if(achost > -1)
		try {options.host = temp.substring(achost + 5, temp.indexOf(' ', achost + 5));} catch(err) {}
	var match = temp.indexOf('match:');
	if(match > -1)
		try {options.match = temp.substring(match + 6, temp.indexOf(' ', match + 6));} catch(err) {}
}
var id = (''+Math.random()).substr(2);
var popupid = '__dsns_autocomplete_'+id;
if(host.data('dsnsAutoCompleted') == 'false')
	return;

if(host.data('dsnsAutoCompleted') == 'true') {
	popup = $('#'+popupid);
	seeAllLink = popup.find('A[href$=#all]');
	list = popup.find('UL');
	return;
}

host.attr('autocomplete', 'off');
host.data('dsnsAutoCompleted', 'true');
host.keydown(HandleKey);
var tmp = $(options.host);
if(tmp.length == 0)
	tmp = $('#loaderhost');
if(tmp.length == 0)
	tmp = $('BODY');
if($('#'+popupid).length == 0)
	tmp.append('<div id="'+popupid+'" class="dsnsAutoComplete"><ul></ul><a href="#all" class="dsnsAutoCompleteSeeAll">See all...</a></div>');

popup = $('#'+popupid);
seeAllLink = popup.find('A[href$=#all]');
list = popup.find('UL');
};    
				
				var Ready = function(host) {
						if(window[ds_plugin_name].IsReady) return;
						window[ds_plugin_name].IsReady = true;
						if(typeof $ == 'undefined')
						{
								if(host) // we're a plugin
										$ = window[ds_plugin_name].$ = host.$;
								else 
										$ = window[ds_namespace].$;
						}
						if(typeof $ == 'undefined')
								return;
						var boxes = $('.autocompleted');
if(IE)
	$(function(){boxes.each(function() {Autocomplete($(this));});});
else
	boxes.each(function() {
		Autocomplete($(this));
	}); $('#advancedsearch, #header .advanced A, #search .advanced A').click(function() {
	var me = $(this);
	var id = me.data('dsns_quicksearch');
	if(!me.data('dsns_quicksearch')) {
		id = (''+Math.random()).substr(2);
		me.data('dsns_quicksearch', id);
	}
	
	var popupid = '__dsns_quicksearch_'+id;
	var popup = $('#'+popupid);

	var tmp = $('#loaderhost');
	if(tmp.length == 0)
		tmp = $('body');
			
	var created = false;
	if(popup.length == 0) {
		popup = $('<div id="'+popupid+'" class="dsnsQuickSearch"></div>').appendTo(tmp);
		popup.html(qsHTML.replace(/\{id\}/ig, id));
		created = true;
	}
	var pos = me.position();
	popup.css({display:'block', top: pos.top + me.height(), left: -1000});
	popup.css({left:$('#header').width() - 50});
	if(!created) return false;
	
	function BodyClick(event) {							
		var target = $(event.target);
		if (!(target.parents().index(popup) >= 0 || target[0] == popup[0] || target[0].tagName == 'HTML')) {
			popup.css({display:'none'});
			return;
		}
	}
	$(document).mousedown(BodyClick);
	
	function Resized(event) {
		if($(window).width() != savedWidth)
			popup.css({display:'none'});
		savedWidth = $(window).width();
	}
	var savedWidth = $(window).width();
	$(window).bind('resize', Resized);
	
	popup.find('.close').click(function() {
		popup.css({display:'none'});
	});
	
	$('#qscity_' + id).bind('change', function() {
		var me = $(this);
		var city = me.find('OPTION:selected');
		var v = city.val();
		if(v && v.length > 0)
			$('#qscnty_' + id).attr('disabled', true).find('option[value="'+city.attr('rel')+'"]').attr('selected', 'selected');
		else
			$('#qscnty_' + id).attr('disabled', false);
	});
	
	popup.find('FORM').bind('submit', function() {
		var type = '', q = '', date = '';
		var me = $(this);
		q = me.find('.qstext').val();
		
		var cat = $('#qscat_' + id +' OPTION:selected').val();
		if(cat && cat.length > 0)
			type += $('#qscat_'+id).attr('rel') + ',' + cat + ';';
			
		var feat = $('#qsfeat_' + id +' OPTION:selected').val();
		if(feat && feat.length > 0)
			type += $('#qsfeat_'+id).attr('rel') + ',' + feat + ';';
		
		var city = $('#qscity_' + id +' OPTION:selected').val();
		if(city && city.length > 0)
			type += $('#qscity_'+id).attr('rel') + ',' + city + ';';
			
		var cnty = $('#qscnty_' + id +' OPTION:selected').val();
		if(cnty && cnty.length > 0)
			type += $('#qscnty_'+id).attr('rel') + ',' + cnty + ';';
		
		var date = $('#qsdate_' + id +' OPTION:selected').val();
		if(date && date.length > 0) {
			var d = new Date();
			d.setDate(d.getDate() - parseInt(date));
			var day = d.getDate();
			if(day < 10) day = '0'+day;
			var month = d.getMonth() + 1;
			if(month < 10) month = '0'+month;
			date = $('#qsdate_'+id).attr('rel') + '=' + month + '%2f' + day + '%2f' + d.getFullYear() + '%2c';
		}
		
		if(type.length > 0)
			type = type.substr(0, type.length - 1);
		
		var url = '/default.aspx?ct=r';
		if(q && q.length > 0)
			url += '&q="'+q+'"';
		if(type && type.length > 0)
			url += '&type='+type;
		if(date && date.length > 0)
			url += '&'+date;
		window.location = url;
		return false;
	});
	
	return false;
}); 

				}
				window[ds_plugin_name].Ready = Ready;
				window[ds_plugin_name].FullyInitialized = true;
				if(host)
						host.OnReady.push(window[ds_plugin_name].Ready);
				else
						$(function(){window[ds_plugin_name].Ready();});
		}
		Ready = false;
		
		return {
				Load: Load,
				WaitForInit: WaitForInit,
				Init: Init,
				WaitForReady: WaitForReady,
				WaitForBody: WaitForBody,
				Ready: Ready,
				GetCookie: GetCookie,
				SetCookie: SetCookie
		};
}();
window[ds_plugin_name].WaitForBody();
window[ds_plugin_name].Load();
var l = window.location.href.substr(7);
if(l.match(/[0-9]+\.html$/ig)) setTimeout(function() {(new Image()).src='http://search.komonews.com/ws.aspx?key=MLT&rand='+(Math.random()*5)+'&u='+escape(l);}, 10000);
})();
if(typeof window['__dsns_'] == 'undefined') window['__dsns_'] = {};
window['__dsns_'].GetCookie = window['KIMA_WidgetsV1'].GetCookie;
window['__dsns_'].SetCookie = window['KIMA_WidgetsV1'].SetCookie;