	$(document).ready(function() {
		
		twitterSetup();
		//setInterval("twitterSetup();",300000);
		
		////////////////////////////////////////////////////////////////
		//////////////NewsFeedFormatCode////////////////////////////////
		////////////////////////////////////////////////////////////////
		var newsDiv = $('div.svSyndLocal');
		$(newsDiv).find('h3').remove();
		$(newsDiv).find('dt.releaseDate').remove();
		$(newsDiv).find('dt').each(function(){
			if ($(this).text().length > 75) {
				$(this).find('a').text($(this).text().substr(0, 75) + '...');
			}
			if($(this).html().toLowerCase().indexOf('class 1')<0)
			$(this).replaceWith("<li>" + $(this).html() + "</li>");
			else
			$(this).replaceWith("<li class='recall'>" + $(this).html() + "</li>");
		});
		$(newsDiv).each(function(){
			$(this).replaceWith("<ul>" + $(this).html() + "</ul>");
		});

		////////////////////////////////////////////////////////////////
		//////////////SURVEY CODE///////////////////////////////////////
		////////////////////////////////////////////////////////////////
		SurveyOn = true;
		var surveyDivs = $("#surveyStars div.surveyStar");
		for(i=1;i<=surveyDivs.length;i++){
			var thisSurveyDiv = surveyDivs[i-1];
			$(thisSurveyDiv).css("background-image","url(../../../../default/images/widgets/widgets_survey_"+i+".gif)").mouseover(
				function(){
					if(SurveyOn){
						var thisSurveyDivID = $(this).attr('value');
						for (j = 1; j <= surveyDivs.length; j++) {
							var thisInnerSurveyDiv = surveyDivs[j-1];
							if($(thisInnerSurveyDiv).attr('value')<=thisSurveyDivID)
								$(thisInnerSurveyDiv).css("background-image","url(../../../../default/images/widgets/widgets_survey_"+j+"mo.gif)");
							else
								$(thisInnerSurveyDiv).css("background-image","url(../../../../default/images/widgets/widgets_survey_"+j+".gif)");
						}
					}
				}).click(function(){
				if(SurveyOn) {
					SurveyOn = false;
					var thisSurveyDivID = $(this).attr('value');
					var thisIPAddress = $("#surveyIPAddress").val();
					var thisUserAgent = $("#surveyUserAgent").val();
					var thisSurveyID = $("#surveyID").val();
					for (l = 1; l <= thisSurveyDivID; l++) {
						var thisInnerSurveyDiv = surveyDivs[l-1];
						$(thisInnerSurveyDiv).css("background-image","url(../../../../default/images/widgets/widgets_survey_"+l+"md.gif)");
					}
					$("#surveyStars div.surveyStar").css("cursor","default");
					$(".surveyThankYou").show();
					$.get("/default/components/remoteProxy.cfc?method=updateSurvey&SurveyID="+thisSurveyID+"&Response="+thisSurveyDivID+"&IPAddress="+thisIPAddress+"&UserAgent="+thisUserAgent);
				}
			});
		}
		$("#surveyStars").mouseleave(function(){
			if(SurveyOn){
				clearSurvey();
			}
		});
		$("span.resetSurvey").click(function(){
			clearSurvey();
		});
		
		function clearSurvey(){
			$(".surveyThankYou").hide();
			SurveyOn = true;
			for (k = 1; k <= surveyDivs.length; k++) {
				var thisInnerSurveyDiv = surveyDivs[k-1];
				$(thisInnerSurveyDiv).css("background-image","url(../../../../default/images/widgets/widgets_survey_"+k+".gif)");
			}
		}
		////////////////////////////////////////////////////////////////
		//////////////END SURVEY CODE///////////////////////////////////
		////////////////////////////////////////////////////////////////
	});
	
	function twitterSetup(){
		$(".twitterfeed").html("<ul></ul>");
		$.getJSON("/default/components/remoteProxy.cfc?method=getLowesTweetTimeline",function(json){
			for(i=0;i<json.length;i++){
				var thisItem = json[i];
				if(thisItem.substr(0,1)=='@'){
					thisItem = 	'<span style="color:#00A164">'+thisItem.substr(0,thisItem.indexOf(' '))+'</span>'+thisItem.substr(thisItem.indexOf(' '));
				}
				$(".twitterfeed ul").append("<li><p>"+thisItem+"</p></li>");
			}
			$(".twitterfeed").jCarouselLite({auto: 5000,speed: 500,vertical: true,visible: 1});
		});
	};