$(document).ready(function(){
	$("a.external").attr("target","_blank");
	$(".reset").bind("focus",function(){ $(this).val(''); });
  	
	// Format the dates original format dd-Mon-yyyy
	$(".js_date").each(function(){
		var date_array = explode("-",$(this).html());
		$(this).html(date('F d, Y',strtotime(date_array[1] + " " + date_array[0] + ", " + date_array[2])));
	});
	
	if(jQuery.browser.msie){
		/* Apply actions for IE */
		/* Apply actions for IE 6 */
		var msie_version = parseInt(jQuery.browser.version);
		if(msie_version == 6){
			$("ul#navigation li").hover(function(){											
				$(this).children('ul:first').addClass("msiefix");
				//$("ul#main-nav li.home_nav ul").bgiframe();
			}, function(){
				$(this).children('ul:first').removeClass("msiefix");
			});
		}
	}
	//Apply Drop Down Styles for IE 6
	if(jQuery.browser.msie){
			
		//Apply Drop Down Styles for IE 6
		var msie_version = (parseInt(jQuery.browser.version));
		
		if(msie_version == 6){
			$(".nav_about").hover(function(){
				$(this).children('ul:first').addClass("msiefix");
				//$("ul#main-nav li.home_nav ul").bgiframe();
			}, function(){
				$(this).children('ul:first').removeClass("msiefix");}
			);
			$(".nav_services").hover(function(){
				$(this).children('ul:first').addClass("msiefix");
				//$("ul#main-nav li.home_nav ul").bgiframe();
			}, function(){
				$(this).children('ul:first').removeClass("msiefix");}
			);
		}
	}
	
	if($('#County').size()){
	//$('#County').bind('load',function(){
		$.ajax({
			   type: "GET",
			   url: "http://wtrpc.stantonstreet.com/ajax.php?method=getCountyDropDown",
			 //data: "method=getCountyDropDown",
			   crossDomain: "true",
			   async: false,
			   cache: false,
			   success: function(html){
				   text = str_replace("[:","<",trim(strip_tags(html.responseText)));
				   text = str_replace(":]",">",trim(text));
				   $("#County").html(text);
			   }
		});
	//});
	}
	
	$('#County').bind('change',function(){
    	county = $('#County').val();
		$.ajax({
				type: "GET",
			   url: "http://wtrpc.stantonstreet.com/ajax.php?method=getRepresentativesSenators&county=" + urlencode(county),
			   //data: "method=getRepresentativesSenators&county=" + county,
			   crossDomain: "true",
			   async: false,
			   cache: false,
			   success: function(html){
				   text = str_replace("[:","<",trim(strip_tags(html.responseText)));
				   text = str_replace(":]",">",trim(text));
				   $("#recipients").html(text);
			   }
		});
		
		 
	});

	
	
});
