/*************  AUTHOR ****************
Sheela V Surisetty 
Web Developer/Designer 
surisettysh@gmail.com 
Phone: 315-212-7004
**************************************/

$(document).ready(function(){
//alert("in maps_home");
//var emailAdd = areplace(/ /g,'');

var dateArray = new Array('', '1/20/2010', '1/21/2010', '1/22/2010', '1/23/2010', '1/19/2010', '1/25/2010', '1/26/2010', '1/27/2010', '1/28/2010', '1/29/2010','1/30/2010', '1/31/2010', '2/1/2010', '2/2/2010', '2/3/2010', '2/4/2010', '2/5/2010', '2/6/2010', '2/7/2010', '2/8/2010', '2/9/2010', '2/10/2010', '2/11/2010', '2/12/2010', '2/13/2010', '2/14/2010', '2/15/2010', '2/16/2010'); 

	var countyArray = new Array('', 'Washington', 'St Francois', 'Perry', 'Cape Girardeau', 'Bollinger', 'Scott', 'Mississippi', 'New Madrid', 'Pemiscot', 'Dunklin', 'Stoddard', 'Wayne', 'Madison', 'Iron', 'Reynolds', 'Shannon', 'Carter', 'Butler', 'Ripley', 'Oregon', 'Howell', 'Ozark', 'Taney', 'Douglas', 'Wright', 'Texas', 'Dent', 'Phelps'); 


	var countyArray1 = new Array('', 'Washington', 'Francois', 'Perry', 'CapeGirardeau', 'Bollinger', 'Scott', 'Mississippi', 'NewMadrid', 'Pemiscot', 'Dunklin', 'Stoddard', 'Wayne', 'Madison', 'Iron', 'Reynolds', 'Shannon', 'Carter', 'Butler', 'Ripley', 'Oregon', 'Howell', 'Ozark', 'Taney', 'Douglas', 'Wright', 'Texas', 'Dent', 'Phelps'); 

	var weekDayArray = new Array('', 'Wed', 'Thurs','Fri', 'Sat', 'Sun', 'Mon', 'Tues', 'Wed', 'Thurs','Fri', 'Sat', 'Sun', 'Mon', 'Tues', 'Wed', 'Thurs','Fri', 'Sat', 'Sun', 'Mon', 'Tues', 'Wed', 'Thurs','Fri', 'Sat', 'Sun', 'Mon', 'Tues');

var countyNewsFileDir = "http://www.sowersforcongress.com/boots/";
//var countyNewsFileDir = "media/News/countyNews/";

var month = currentDate.getMonth()+ 1; //javascript months start from 0
var day = currentDate.getDate();
var year = currentDate.getFullYear();
var todayStr = month + "/" + day + "/" + year;
var str = "";
	var str_date1;
	var  str_county_name1;
	var str_title1;
	var str_summary1;
	var str_desc1;

var cnt = [];

$("#mapContent").append('<form name="form1" method="post">');
$(countyArray1).each(function(i,countyName){
if(i>0)
{
	$.get(countyNewsFileDir + countyName,function(countyNewsArray){
	cnt[i] = "#countyNews" + i;
		//alert(cnt[i]);

	$("#mapContent").append( '<div id=countyNews' + i + ' style="position: relative; background: #fff; color: #000; overflow: auto; display: block; left: 0%;  margin-left: 0px; /* IE */  margin-top: 13px; border: 3px solid #003d20; height: 300px; width: 533px; padding-left: 10px; padding-right: 10px; display: none; overflow: auto; ">'  + '<br>' + '<a class="button2">Back to the Map</a>' );
	
	//alert(countyNewsArray);
	if(countyNewsArray == "")
	{
		$(cnt[i]).append("<h2>Coming Soon!!!</h2>");
	}
	else
	{
	//$(cnt[i]).append(countyNewsArray);
	   $(cnt[i]).append("<h2>" + "Day " + i + ": " + countyArray[i] + " County" + "</h2>");
	   $(cnt[i]).append("<p><div class='countyNewsDate'>Updated: " + dateArray[i] + "</div></p>");
	   contentSections = countyNewsArray.split("\n");
	   $(contentSections).each(function(j,contentPara)
	   {
		   $(cnt[i]).append("<p>");
			$(cnt[i]).append(contentPara);
			$(cnt[i]).append("</p>");   
	   });
		$(cnt[i]).append("<br><hr><br>");
	}

	});//get from text file ends here
	
}//if file found condition ends 
	 					   $("#mapContent").append("</div>");
							 });// each countyArray ends
//$("#mapContent").append('</form>');

});//document.ready fn ends
