(function() {
var ds_namespace = '__dsns_', ds_plugin_name = 'ABC6_WidgetsV1';
window[ds_plugin_name] = function() {
	var Keywords = 'ABC6 Raw,Acushnet,Allan Fung,Allison Alexander,Arlen Specter,Assonet,Attleboro,Barack Obama,Barney Frank,Barrington,Baseball,Basketball,Block Island,Bowling,Boxing,Bristol,Carolina,Central Falls,Charlestown,Chepachet,Clayville,Community,Contests,Cooking Fresh,Coventry,Cranston,Cumberland,Dartmouth,David Cicilline,Deval Patrick,Don Carcieri,Don Coyne,Doreen Scanlon,East Greenwich,Easton,Elizabeth Roberts,Erica Ricci,Fairhaven,Fall River,Football,Frank Caprio,Fred Campagna,Glendale,Golf,Hillary Clinton,Hockey,Hopkinton,Jack Reed,Jamestown,Jim Corbin,Jim Langevin,Joe Biden,John Deluca,John Guice,John Kerry,John Lynch,John McCain,Johnston,Julie Ruditzky,Ken Bell,Lincoln,Lincoln Chafee,Little Compton,Malini Basu,Mansfield,Martha Coakley,Matt Lagor,Middletown,Mitt Romney,Narragansett,New Bedford,Newport,North Kingstown,North Smithfield,Parker Gavigan,Patrick Lynch,Patrick Murphy,Pawtucket,Portsmouth,Providence,Raynham,Rehoboth,Sarah Palin,Scott Lang,Seekonk,Shaquille O\'Neal,Sheldon Whitehouse,Smart Woman,Smithfield,Soccer,Softball,Somerset,Steve Cascione,Susan Menard,Swansea,Taunton,Ted Kennedy,Tennis,Tiger Woods,Tiverton,Tom Langford,Volleyball,Wakefield,Warren,Warwick,Web Extra,West Greenwich,Westerly,Westport,Woonsocket,Wrestling,'.split(','); var qsHTML = '<div class="dsnsqs"></div>'; var lfHTML = '<div id="dsnspickcommunity">\n\t<div class="title">Select your community</div>\n\t<ul></ul>\n</div>\n\n<div id="dsnslocalnews"><!--\n\t<div class="title"><a href="http://community_link/">community_name News</a></div>\n\t<a class="pickcommunity" href="#pickcommunity">Change your community</a>\n\t<ul>\n\t\t<li class="first"><a href="http://first_link/"><div class="localimg"><img src="http://the_image/" alt="first_title"/></div>first_title</a></li>\n\t\t<li class="second"><a href="http://second_link/">second_title</a></li>\n\t\t<li class="third"><a href="http://third_link/">third_title</a></li>\n\t\t<li class="fourth"><a href="http://fourth_link/">fourth_title</a></li>\n\t\t<li class="fifth"><a href="http://fifth_link/">fifth_title</a></li>\n\t</ul>\n--></div>\n<div class="bottom_links" id="dsnslocallinks"><!--<ul>\n\t<li><a href="http://community_link/" class="morenews">More community_name News</a><br /></li>\n\t<li><a href="http://community_link/forum/69" class="morenews rantsandraves">community_name Rants &amp; Raves</a></li>\n\t</ul>--></div>\n<div id="dsnsOverlay">&nbsp;</div>\n<div id="dsnsLfPopup">\n\t<div class="topHead">\n\t\t<h1>Choose your neighborhood</h1>\n\t\t<div class="subHead">Tell us where you live and get your community headlines along with your local, breaking news.</div>\n\t\t<div class="closeButton"><a href="#close">close window</a></div>\n\t</div>\n\t<div class="mainHoodContent">\n\t\t<div class="introText">Choose the neighborhood closest to you. If you don\'t see your neighborhood, <a href="http://www.abc6.com/about">let us know</a>! We\'ll be adding more neighborhoods soon!</div>\n\t\t<div class="box">\n\t\t\t<!-- <h3>City of Seattle</h3> -->\n\t\t\t<div class="column">\n\t\t\t\t<ul>\n\t\t\t\t\t<li><a href="#bristol" title="Warwick News">Bristol</a></li>\n\t\t\t\t\t<li><a href="#cranston" title="Cranston News">Cranston</a></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="box">\n\t\t\t<!-- <h3>East</h3> -->\n\t\t\t<div class="column">\n\t\t\t\t<ul>\n\t\t\t\t\t<li><a href="#eastgreenwich" title="East Greenwich News">East Greenwich</a></li>\n<!--\t\t\t\t\t<li><a href="#eastside" title="East Side News">East Side</a></li> -->\n\t\t\t\t\t<li><a href="#newport" title="Newport News">Newport</a></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="box">\n\t\t\t<!-- <h3>South</h3> -->\n\t\t\t<div class="column">\n\t\t\t\t<ul>\n\t\t\t\t\t<li><a href="#providence" title="Providence News">Providence</a></li>\n\t\t\t\t\t<li><a href="#narragansett" title="Narragansett News">Narragansett</a></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class="box">\n\t\t\t<!-- <h3>North</h3> -->\n\t\t\t<div class="column">\n\t\t\t\t<ul>\n\t\t\t\t\t<li><a href="#smithhill" title="Smith Hill News">Smith Hill</a></li>\n\t\t\t\t\t<li><a href="#soeastmass" title="South East Massachusetts News">South East Massachusetts</a></li>\n\t\t\t\t\t<li><a href="#warwick" title="Warwick News">Warwick</a></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div class="popupBottom">\n\t\t<div class="logo">ABC6.com</div>\n\t</div>\n</div>'; var lbHTML = '<div class="sponsor">\n\t<span class="title">Community Sponsor</span><br/>\n\t<a href="{link}"><img src="{img}" /></a><br/>\n\t<a class="name" href="{link}">{title}</a>\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/news/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(init_host) {
		if(window[ds_plugin_name].Initialized) return;
		window[ds_plugin_name].Initialized = true;
		if(typeof $ == 'undefined' || window[ds_namespace].$)
		{
			if(init_host) // we're a plugin
				$ = window[ds_plugin_name].$ = init_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 host = $(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');
	if(selected.length == 0) return;
	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);
			
// look for options
var temp = host.parent().html();
var start = -1;
if(temp) 
	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 localFeeds = new Array({"t":"Warwick", "u":"http://warwick.abc6.com", "k":"warwick", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"WARWICK: Investigation of Deadly Fire Underway", "n":"34426"},{"t":"Mixed Results on Blue Cross Rate Hike Approval", "n":"34425"},{"t":"Family Member Remembers Those Who Died in Warwick Fire", "n":"34416"},{"t":"Meat-Cutting Contest in Warwick, Contest Steaks Going to RI Food Bank", "n":"34411"},{"t":"Federal Stimulus Grant to Fund 600 New RI Library Computers", "n":"34410"} ]},{"t":"Cranston", "u":"http://cranston.abc6.com", "k":"cranston", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"Mixed Results on Blue Cross Rate Hike Approval", "n":"34425"},{"t":"Police Arrest Suspect in Cranston Store Robbery, Stabbing", "n":"34420"},{"t":"Federal Stimulus Grant to Fund 600 New RI Library Computers", "n":"34410"},{"t":"Clerk Stabbed in Cranston Robbery", "n":"34404"},{"t":"HEIST HAPPY RI?: Rash of Recent Bank Robberies Hits State", "n":"34398"} ]},{"t":"South Eastern Massachusetts", "u":"http://soeastmass.abc6.com", "k":"soeastmass", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"Head-on Crash in Seekonk After Driver Crosses Center Line", "n":"34427"},{"t":"Suspect Arrested in Home Robbery of Elderly Tiverton Woman", "n":"34417"},{"t":"NSTAR Commercial and Industrial Customers to See Price Cut", "n":"34409"},{"t":"Northeast Region High Speed Rail Project Gets $1B (Time Change)", "n":"34407"},{"t":"UMASS Hockey Loses at Fitchburg State 3-1", "n":"34387"} ]},{"t":"Newport", "u":"http://newport.abc6.com", "k":"newport", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"Mixed Results on Blue Cross Rate Hike Approval", "n":"34425"},{"t":"Suspect Arrested in Home Robbery of Elderly Tiverton Woman", "n":"34417"},{"t":"SCAM: Family Bail Calls Targeting Seniors", "n":"34415"},{"t":"Federal Stimulus Grant to Fund 600 New RI Library Computers", "n":"34410"},{"t":"HEIST HAPPY RI?: Rash of Recent Bank Robberies Hits State", "n":"34398"} ]},{"t":"Bristol", "u":"http://bristol.abc6.com", "k":"bristol", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"Mixed Results on Blue Cross Rate Hike Approval", "n":"34425"},{"t":"Suspect Arrested in Home Robbery of Elderly Tiverton Woman", "n":"34417"},{"t":"SCAM: Family Bail Calls Targeting Seniors", "n":"34415"},{"t":"Federal Stimulus Grant to Fund 600 New RI Library Computers", "n":"34410"},{"t":"HEIST HAPPY RI?: Rash of Recent Bank Robberies Hits State", "n":"34398"} ]},{"t":"East Greenwich", "u":"http://eastgreenwich.abc6.com", "k":"eastgreenwich", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"Mixed Results on Blue Cross Rate Hike Approval", "n":"34425"},{"t":"Federal Stimulus Grant to Fund 600 New RI Library Computers", "n":"34410"},{"t":"HEIST HAPPY RI?: Rash of Recent Bank Robberies Hits State", "n":"34398"},{"t":"Mixed NECAP Results Show Need to Accelerate State Reforms and Progress", "n":"34349"},{"t":"ED TARBOX: Pedal Fix Training Set, Some Cars Already Repaired", "n":"34347"} ]},{"t":"Providence", "u":"http://providence.abc6.com", "k":"providence", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"Mixed Results on Blue Cross Rate Hike Approval", "n":"34425"},{"t":"Abandoned Pup Survives Hit and Run, Now Looking for a Home", "n":"34418"},{"t":"Federal Stimulus Grant to Fund 600 New RI Library Computers", "n":"34410"},{"t":"Police Searching for Missing Woman", "n":"34405"},{"t":"Clerk Stabbed in Cranston Robbery", "n":"34404"} ]},{"t":"East Side", "u":"http://eastside.abc6.com", "k":"eastside", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"NFL&#039;s Championship Weekend Doesn&#039;t Disappoint", "n":"http://abc6.com/node/34174"} ]},{"t":"Smith Hill", "u":"http://smithhill.abc6.com", "k":"smithhill", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"Mixed Results on Blue Cross Rate Hike Approval", "n":"34425"},{"t":"3 RI Governor Candidates Promise to Sign Gay Marriage Bill", "n":"34419"},{"t":"Raptakis Proposes Ban on Closed Primaries", "n":"34363"},{"t":"Sasse Stepping Down from Depts of Admin., Revenue", "n":"34362"},{"t":"RI Leading Ladies Gather at State House to Kick Off American Heart Month", "n":"34361"} ]},{"t":"Narragansett", "u":"http://narragansett.abc6.com", "k":"narragansett", "lp":"/node/", "ip":"/sites/abc6.com/files/imagecache/story_image_widget/",  "i": [ {"t":"Mixed Results on Blue Cross Rate Hike Approval", "n":"34425"},{"t":"Banned Chemicals Network Proposed", "n":"34414"},{"t":"Federal Stimulus Grant to Fund 600 New RI Library Computers", "n":"34410"},{"t":"Mixed NECAP Results Show Need to Accelerate State Reforms and Progress", "n":"34349"},{"t":"ED TARBOX: Pedal Fix Training Set, Some Cars Already Repaired", "n":"34347"} ]}); var host = window.location.host.replace('search.', 'www.').replace('.test.datasphere', '').replace('.regisweb', '').replace('dev.', '');
var GetLocationFromGoogleLoader = function(callback) {
	var AjaxGeoLocation = (function() {
		var loading = false;
		var loadGoogleLoader = function() {
			if (!hasGoogleLoader() && !loading) { loading = true; var s = document.createElement('script'); s.src = 'http://www.google.com/jsapi?callback=_google_loader_apiLoaded'; s.type = "text/javascript"; document.getElementsByTagName('head')[0].appendChild(s); }
		};
		var queue = [];
		var addLocationQueue = function(callback) { queue.push(callback); }
		var runLocationQueue = function() {
			if (hasGoogleLoader()) while (queue.length > 0) { var call = queue.pop(); call(); }
		}

		window['_google_loader_apiLoaded'] = function() { runLocationQueue(); }
		var hasGoogleLoader = function() { return (window['google'] && google['loader']); }
		var checkGoogleLoader = function(callback) { if (hasGoogleLoader()) return true; addLocationQueue(callback); loadGoogleLoader(); return false; };
		loadGoogleLoader();
		return { shim: true, type: "ClientLocation", lastPosition: null,
			getCurrentPosition: function(successCallback) {
				var self = this;
				if (!checkGoogleLoader(function() { self.getCurrentPosition(successCallback); })) return;
				if (google.loader.ClientLocation) {
					var cl = google.loader.ClientLocation;
					var position = { latitude: cl.latitude, longitude: cl.longitude, altitude: null, accuracy: 43000, altitudeAccuracy: null, heading: null, velocity: null, timestamp: new Date(),
						address: { city: cl.address.city, country: cl.address.country, country_code: cl.address.country_code, region: cl.address.region }
					};
					successCallback(position);
					this.lastPosition = position;
				} else {
					successCallback(false);
				}
			}
		};
	})();
	AjaxGeoLocation.getCurrentPosition(function(pos) { if (pos) callback(pos.address.city.toLowerCase()); else callback(false); });
}

var CommunityFromCity = function(city) {
var cities = {'seattle':'ballard', 'eugene':'downtowneugene', 'portland':'beaverton', 'bakersfield':'central', 'boise':'boisebench'};
	return cities[city] || city;
}
var GetLocationFromAdManager = function(callback) {
	var loc = window['__dsns_'].GetCookie('dsnsloc');
	if (loc) callback(CommunityFromCity(loc));
	else callback(false);
}

var GetLocationFromCookie = function(callback) {
	var loc = window['__dsns_'].GetCookie('dsnscomm');
	if (loc) callback(loc);
	else callback(false);
}
var adHider = false;
var HideFlash = function() {
	$('object, embed, iframe').each(function() {
		var me = $(this);
		if(me.data('hiddenflash')) return;
		if(me.css('visibility') == 'visible') {
			me.data('hiddenflash', true);
			me.css({visibility:'hidden'});
		}
	});
}
var ShowFlash = function() {
	$('object, embed, iframe').each(function() {
		var me = $(this);
		if(me.data('hiddenflash'))
			me.css({visibility:'visible'});
			me.data('hiddenflash', false);
	});
}

var AddOverlay = function() {
	var mask = $('#dsnsOverlay');
	if(mask.length == 0 || mask.is(':visible'))
		return;
	var w = $(window).width();
	var h = $(window).height();
	var dw = $(document).width();
	var dh = $(document).height();
	if(dh>h)h=dh;
	if(dw>w)w=dw;
	if(IE6 || IE8) w -= 22;
	if(IE6) $('SELECT').css({visibility:'hidden'});
	mask.css({position:'absolute', opacity:.0, backgroundColor:'#333', top:0, left:0, width:w, height:h,display:'block', zIndex:19999, opacity:.4});
	HideFlash();
	adHider = setInterval(function() {HideFlash();}, 500);
	return this;
}
var RemoveOverlay = function(outto) {
	clearInterval(adHider);
	if(outto) {
		var pos = outto.position();
		if(pos.left + pos.top == 0) pos = outto.offset();
		$('#dsnsOverlay').css({height:$(window).height(), backgroundColor:'#5B8CBE'}).animate({opacity:.0, top:pos.top, left:pos.left, width:outto.width(), height:outto.height()}, 500, function() {$(this).hide();ShowFlash();if(IE6) $('SELECT').css({visibility:'visible'});});
	}
	else
		$('#dsnsOverlay').animate({opacity:.0}, 300, function() {$(this).hide();ShowFlash();if(IE6) $('SELECT').css({visibility:'visible'});});
	return this;
}
function RenderFeed(source) {
	$('#dsnslocalnews, #dsnslocallinks').hide().find('*').show();
	var newshtml = dsnsLFHTMLTemplates.news + '';
	var linkshtml = dsnsLFHTMLTemplates.links + '';
	newshtml = newshtml.replace(/community_name/ig, source.t);
	newshtml = newshtml.replace(/http:\/\/community_link/ig, source.u);
	linkshtml = linkshtml.replace(/community_name/ig, source.t);
	linkshtml = linkshtml.replace(/http:\/\/community_link/ig, source.u);
	var img = source.i[0].i;

	if (!img || img.length < 1) {
		img = false;
		newshtml = newshtml.replace(/http:\/\/the_image./ig, 'http://cdn.secondspace.com/fshr/blank.gif');
	} else {
		newshtml = newshtml.replace(/http:\/\/the_image./ig, source.u + source.ip + source.i[0].i);
	}

	newshtml = newshtml.replace(/http:\/\/first_link./ig, source.u + source.lp + source.i[0].n);
	newshtml = newshtml.replace(/first_title/ig, source.i[0].t);

	if (source.i.length > 1) {
		newshtml = newshtml.replace(/http:\/\/second_link./ig, source.u + source.lp + source.i[1].n);
		newshtml = newshtml.replace(/second_title/ig, source.i[1].t);
	}
	if (source.i.length > 2) {
		newshtml = newshtml.replace(/http:\/\/third_link./ig, source.u + source.lp + source.i[2].n);
		newshtml = newshtml.replace(/third_title/ig, source.i[2].t);
	}
	if (source.i.length > 3) {
		newshtml = newshtml.replace(/http:\/\/fourth_link./ig, source.u + source.lp + source.i[3].n);
		newshtml = newshtml.replace(/fourth_title/ig, source.i[3].t);
	}
	if (source.i.length > 4) {
		newshtml = newshtml.replace(/http:\/\/fifth_link./ig, source.u + source.lp + source.i[4].n);
		newshtml = newshtml.replace(/fifth_title/ig, source.i[4].t);
	}

	$('#dsnslocalnews').html(newshtml);
	$('#dsnslocallinks').html(linkshtml);
	if (source.i.length < 2) $('#dsnslocalnews .second').hide();
	if (source.i.length < 3) $('#dsnslocalnews .third').hide();
	if (source.i.length < 4) $('#dsnslocalnews .fourth').hide();
	if (source.i.length < 5) $('#dsnslocalnews .fifth').hide();
	if(img) $('#dsnslocalnews .localimg').show();
	$('#dsnslocalnews, #dsnslocallinks').show();
}
function GetDefault() {
	var cities = {'www.katu.com':'portland', 'www.kval.com':'eugene', 'www.komonews.com':'seattle', 'www.kionrightnow.com':'monterey', 'www.kcba.com':'monterey', 'www.myfox11.com':'santabarbara', 'www.kcoy.com':'santabarbara', 'www.abc6.com':'warwick', 'www.bakersfieldnow.com':'bakersfield', 'www.kboi2.com':'boise'};
	var pick = cities[host];
	if(pick) return CommunityFromCity(pick);
	return CommunityFromCity('seattle');
}
var dsnsLFHTMLTemplates = {news:'', links:''};
function ShowFeeds(picked) {
	var defcom = GetDefault();
	if (!picked)
		picked = defcom;
	
	var com = false, dcom = false;;
	var communityList = new Array();

	function feedSort(a, b) {
		var A = a.t.charAt(0), B = b.t.charAt(0);
		return A > B ? 1 : A < B ? -1 : 0;
	}
	localFeeds.sort(feedSort);

	if(/debugfeeds/ig.test(window.location.href))
	{
		$.each(localFeeds, function(i, c) {
			if (c.i.length == 0)
				c.i.push({"t":"No News Yet", "n":"0", "i":false});
		});
		window['dsnsTemp'] = {localFeeds:localFeeds, defcom:defcom};
	}
	
	$.each(localFeeds, function(i, c) {
		if (c.i.length == 0) return true;
		communityList.push('<li><a href="#pick' + i + '">' + c.t + '</a></li>');
		if (c.k == picked) com = c;
		if (c.k == defcom) dcom = c;
	});
	if (!com) com = dcom;
	if (!com || communityList.length == 0) {
		$('#dsnslocal').show();
		return;
	}

	$('#dsnslocal').hide().html(lfHTML);
	dsnsLFHTMLTemplates.news = GetMetaData($('#dsnslocalnews'));
	dsnsLFHTMLTemplates.links = GetMetaData($('#dsnslocallinks'));
	if($('#fin_maincontainer').length > 0) { // new layout
		if($('#dsnslocalnews2').length > 0) dsnsLFHTMLTemplates.news = GetMetaData($('#dsnslocalnews2'));
		if($('#dsnslocallinks2').length > 0) dsnsLFHTMLTemplates.links = GetMetaData($('#dsnslocallinks2'));
	}
	RenderFeed(com);


	$('#dsnspickcommunity').hide().find('UL').html(communityList.join(''));
	$('#dsnspickcommunity UL LI A').live('click', function() {
		$('#dsnspickcommunity').hide();
		var sel = localFeeds[parseInt(/[0-9]+$/.exec($(this).attr('href')))];
		RenderFeed(sel);
		window['__dsns_'].SetCookie('dsnscomm', sel.k);
		return false;
	});
	$('#dsnslocalnews').find('a[href$="pickcommunity"]').live('click', function() {
		setTimeout(function() {ShowPicker();}, 100);
		return false;
	});
	$('#dsnslocal').show();

	var autoPopup = false;
	if(host == 'www.komonews.com' || 
		 host == 'www.kionrightnow.com'	||
		 host == 'www.kcba.com'	||
		 host == 'www.kcoy.com'	||
		 host == 'www.myfo11.com') autoPopup = true;
	if(autoPopup) {
		var c1 = window['__dsns_'].GetCookie('dsnsloc');
		var c2 = window['__dsns_'].GetCookie('dsnscomm');
		var c3 = window['__dsns_'].GetCookie('dsnslfpop');
		var date = new Date();
		if((c1 && !c2 && !c3) || c3 && c3 != '1')
		{
			try {
				if(date.getTime() > parseInt(c3))
				{
					date.setTime(date.getTime()+(30*24*60*60*1000));
					window['__dsns_'].SetCookie('dsnslfpop', '1', date.toGMTString());
					setTimeout(function() {ShowPicker();}, 100);
				}
			} catch(e) {}
		}
		if(!c2 && !c1 && !c3) {
				date.setTime(date.getTime()+(3*24*60*60*1000));
				window['__dsns_'].SetCookie('dsnslfpop', date.getTime());
		}
	}
}
var HidePicker = function(outto) {
	RemoveOverlay(outto);
	$('#dsnsLfPopup').hide();
	if(IE) $('BODY').css({position:''});
}

var ShowPicker = function() {
	if(IE && $('#fin_maincontainer').length > 0 && $('#footer').length == 0) {
		setTimeout(function() {ShowPicker();}, 500);
		return;
	}
	if(!window['__dsns_'].GetCookie('dsnsloc')) {
		var date = new Date();
		date.setTime(date.getTime()+(30*24*60*60*1000));
		window['__dsns_'].SetCookie('dsnslfpop', '1', date.toGMTString());
	}
	/*
	if($('.fin_storydescription').length > 0 && $('BODY > #dsnsOverlay').length == 0)
	{
		$('#dsnsOverlay').appendTo($('BODY')).hide();
		$('#dsnsLfPopup').appendTo($('BODY'));
	}
	else if($('BODY > #dsnsOverlay').length == 0 && $('#header').length == 1 && $('#header #dsnsOverlay').length == 0)
	{
		$('#dsnsOverlay').appendTo($('#header')).hide();
		$('#dsnsLfPopup').appendTo($('#header'));
	} 
	else 
	*/
	if($('#header #dsnsOverlay').length == 0 && $('BODY > #dsnsOverlay').length == 0)
	{
		$('#dsnsOverlay').prependTo($('BODY')).hide();
		$('#dsnsLfPopup').prependTo($('BODY'));
	}
		
	setTimeout(function() {AddOverlay();$('#dsnsLfPopup A').css({color:''});}, 10);
	var p = $('#dsnsLfPopup');
	p.css({left:-1000,top:-1000}).show();
	var ww = $(window).width();
	var wh = $(window).height();
	var dl = $(document).scrollLeft();
	var dt = $(document).scrollTop();
	var ew = p.width();
	var eh = p.height();
	var left = (ww - ew) / 2 + dl;
	var top = (wh - eh) / 2 + dt;
	if(top < 10) top = 10;
	if(left < 10) left = 10;
	p.css({left:left,top:top});
	if(!p.data('bound')) {
		p.data('bound', true);
		p.find('A[href$=close], .closeButton').click(function() {
			HidePicker();
			return false;
		});
		p.find('.column A').click(function() {
			var n = $(this).attr('href');
			n = n.substr(n.indexOf('#')+1);
			var com = false;
				
			$.each(localFeeds, function(i, c) {
				if (c.k == n) {
					com = c;
					return false;
				}
			});
			if(com) {
				window['__dsns_'].SetCookie('dsnscomm', com.k);
				if(typeof window['__dsns_'].selectBusinesses	== 'function')
					window['__dsns_'].selectBusinesses();
				RenderFeed(com);
				HidePicker($('#dsnslocal'));
			} else
				HidePicker();
			return false;
		});
	}
}

var localReady = function() {	
	var max = 100;
	if ($('#dsnslocal').length == 0 || typeof window['__dsns_'] != 'object') {
		if(max-- > 0)
			setTimeout(function() { localReady(); }, 100);
		return;
	}
	GetLocationFromCookie(function(city) {
		if (city) ShowFeeds(city);
		else GetLocationFromAdManager(function(city) {
			if (city) ShowFeeds(city);
			else GetLocationFromGoogleLoader(function(city) {
				if (city) ShowFeeds(CommunityFromCity(city));
				else ShowFeeds(false);
			});
		});
	});
}
localReady(); var localBusiness = new Array({'k':'warwick', 'u':'/abc6/lb/warwick.js'},{'k':'cranston', 'u':'/abc6/lb/cranston.js'},{'k':'soeastmass', 'u':'/abc6/lb/soeastmass.js'},{'k':'newport', 'u':'/abc6/lb/newport.js'},{'k':'bristol', 'u':'/abc6/lb/bristol.js'},{'k':'eastgreenwich', 'u':'/abc6/lb/eastgreenwich.js'},{'k':'providence', 'u':'/abc6/lb/providence.js'},{'k':'eastside', 'u':'/abc6/lb/eastside.js'},{'k':'smithhill', 'u':'/abc6/lb/smithhill.js'},{'k':'narragansett', 'u':'/abc6/lb/narragansett.js'}); var bizReady = function() {	
	var max = 100;
	if ($('#dsnslocalbiz').length == 0 || typeof window['__dsns_'] != 'object') {
		if(max-- > 0)
			setTimeout(function() { bizReady (); }, 100);
		return;
	}
	window['__dsns_'].localBusinesses = new Array();
	var FindBiz = function(key) {
		if(typeof window['__dsns_'].localBusinesses != 'object') return false;
		var f = false;
		$.each(window['__dsns_'].localBusinesses, function(i,b)	{
			if(b.k == key) f = b;
			return (f == false);
		});
		return f;
	}
	var FindBizOnCDN = function(key, callback) {
		var found = false;
		if(key) $.each(localBusiness, function(n,v) {
			if(v.k == key) {
				$.getScript('http://content.secondspace.com'+v.u, callback);
				found = true;
				return false;
			}
		});
		if(!found) callback();
	}
	var RenderBiz = function(b) {
		if(!b) return;
		var r = Math.floor(Math.random()*b.i.length);
		var x = b.i[r];
		$('#dsnslocalbiz').html(lbHTML.replace(/\{title\}/ig, x.t).replace(/\{link\}/ig, b.u+b.lp+x.n+'?utm_source=homepage_widget&utm_medium=referral&utm_campaign=na').replace(/\{img\}/ig, b.u+b.ip+x.i));
	}
	window['__dsns_'].selectBusinesses = function() {
		var c = window['__dsns_'].GetCookie('dsnscomm');
		var b = FindBiz(c);
		if(b) {
			RenderBiz(b);
			return;
		}
		FindBizOnCDN(c, function() {
			b = FindBiz(c);
			if(!b) b = FindBiz('providence');
			if(!b) {
				FindBizOnCDN('providence', function() {
					b = FindBiz('providence');
					RenderBiz(b);
				});
				return;
			}
			RenderBiz(b);
		});
	}
	window['__dsns_'].selectBusinesses();
}
bizReady();
		
		var Ready = function(ready_host) {
			if(window[ds_plugin_name].IsReady) return;
			window[ds_plugin_name].IsReady = true;
			if(typeof $ == 'undefined' || window[ds_namespace].$)
			{
				if(ready_host) // we're a plugin
					$ = window[ds_plugin_name].$ = ready_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));
	});
if($('#dsnslocalbiz').length == 0) $('#dsnslocallinks').css({height:'auto'}); $('#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(me.attr('id') == 'advancedsearch') popup.css({top:220, left:380, marginTop:0});
	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 = 'http://'+window.location.host.replace('www', 'search')+'/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(init_host)
			init_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 pid = /([0-9]+)\.html$/ig.exec(window.location.href);
if(pid) setTimeout(function() {(new Image()).src='http://search.abc6.com/ws.aspx?key=MLT&DSC=ABC6&rand='+(Math.random()*5)+'&pid='+pid[1];}, 10000);

})();
if(typeof window['__dsns_'] == 'undefined') window['__dsns_'] = {};
window['__dsns_'].GetCookie = window['ABC6_WidgetsV1'].GetCookie;
window['__dsns_'].SetCookie = window['ABC6_WidgetsV1'].SetCookie;