$(document).ready(function() {
	//$("#white_overlay").fadeOut(1000);					//fade site in lol
	//$("#gov_links_slider").slideToggle(1);					//on ready hide top-links
	
	$("#gov_link").click(function() {						//on click
		$("#gov_links_slider").slideToggle('slow');			//show top-links
		return false;										//return false for no href
	});
		
	$.passeyTab("#recent_news_container");					//apply passeyTab to recent_news_container box
	$.passeyTab("#where_to");								//apply passeyTab to where_to box
	$.passeyTab("#goals_and_objectives");					//apply passeyTab to /mura goals box
	$.passeyTab("#bod");									//apply passeyTab to hot bod section
	$.passeyTab("#minutes");								//apply passeyTab to board minutes
	
	$("#sliderDiv").slideThis("a.sliderLink");				//animate banner ads according to sliderDiv links
	
	$("#newsletter_email").click(function() {				//removes text in newsletter input field 
		$("#newsletter_email").val("");						//after click
	});
	
	$("#search_txt").click(function() {						//removes text in search input field after click
		$("#search_txt").val("");
	});
	
	$("#bus_search").click(function() {						//removes text in business search field
		$("#bus_search").val("");							//after click
	});
	
	$('#timeline_holder a').Tooltip({						//tooltip settings for the timeline
		track: true, 										//tooltip follows mouse
		delay: '0',											//delay speed
		showURL: false,										//don't show url
		top: -19,											//top margin of tooltip
		left: 7												//left margin of tooltip
	});
	$('#hows_it_made a').Tooltip({						//tooltip settings for'hows it made?'
		track: true, 										//tooltip follows mouse
		delay: '0',											//delay speed
		showURL: false,										//don't show url
		top: -19,											//top margin of tooltip
		left: 7												//left margin of tooltip
	});
	
	$('#interactive_map a').Tooltip({						//tooltip settings for the interactive map
		track: true, 										//tooltip follows mouse
		delay: '0',											//delay speed
		showURL: false,										//don't show url
		top: -19,											//top margin of tooltip
		left: 7												//left margin of tooltip
	});
	
	$('#press_downloads a').Tooltip({						//tooltip settings for the press section
		track: true, 										//tooltip follows mouse
		delay: '0',											//delay speed
		showURL: false,										//don't show url
		top: -19,											//top margin of tooltip
		left: 7												//left margin of tooltip
	});
		
	$("#contact_form").submit(function() {									//if contact form is submitted
		$("#callback").empty();												//empty callback div to prepare for response
		$.ajax({															//jQuery ajax call
			type: "POST",													//ajax type
 			url: "http://www.downtownmedford.com/ajax/contact.php",			//ajax url
 			data: 	'f_name='+$("#element_1_1").val()+						//ajax data
 					'&l_name='+$("#element_1_2").val()+
					'&a_code='+$("#element_2_1").val()+
					'&phone1='+$("#element_2_2").val()+
					'&phone2='+$("#element_2_3").val()+
					'&email='+$("#element_3").val()+
					'&inquiry='+$("#element_4").val()+
					'&newsletter='+$("#element_5").val(),
  			cache: false,													//deny browser cache
  			success: function(html){										//if data sent successfully
    			$("#callback").append(html);								//append response to callback
  			}
		});
		$("#element_1_1").val("");											//reset form values to null
		$("#element_1_2").val("");
		$("#element_2_1").val("");
		$("#element_2_2").val("");
		$("#element_2_3").val("");
		$("#element_3").val("");
		$("#element_4").val("");
		return false;														//no page reset
	});
	
	$("#bug_holder").submit(function() {									//if bug form is submitted
		$("#callback").empty();												//empty callback div to prepare for response
		$.ajax({															//jQuery ajax call
			type: "POST",													//ajax type
 			url: "http://www.downtownmedford.com/ajax/bug.php",				//ajax url
 			data: 	'bug_input='+$("#bug_input").val()+						//ajax data
 					'&bug_text='+$("#bug_text").val(),
  			cache: false,													//deny browser cache
  			success: function(html){										//if data sent successfully
    			$("#callback").append(html);								//append response to callback
  			}
		});
		$("#bug_input").val("");											//reset form values to null
		$("#bug_text").val("");
		return false;														//no page reset
	});
	
	$("#committee_application").submit(function() {									//if bug form is submitted
		$("#callback").empty();														//empty callback div to prepare for response
		$.ajax({																	//jQuery ajax call
			type: "POST",															//ajax type
 			url: "http://www.downtownmedford.com/ajax/form_committee.php",			//ajax url
 			data: 	'app_bus='+$("#app_bus").val()+									//ajax data
 					'&app_bus_address='+$("#app_bus_address").val()+
 					'&app_bus_phone='+$("#app_bus_phone").val()+
 					'&app_name='+$("#app_name").val()+
 					'&app_address='+$("#app_address").val()+
 					'&app_phone='+$("#app_phone").val()+
 					'&app_committee='+$("#app_committee").val()+
 					'&app_residency='+$("#app_residency").val()+
 					'&app_ward='+$("#app_ward").val()+
 					'&app_quest_1='+$("#app_quest_1").val()+
 					'&app_quest_2='+$("#app_quest_2").val()+
 					'&app_quest_3='+$("#app_quest_3").val()+
 					'&app_quest_4='+$("#app_quest_4").val()+
 					'&app_quest_5='+$("#app_quest_5").val()+
 					'&app_voter='+$("#app_voter").val(),
  			cache: false,															//deny browser cache
  			success: function(html){												//if data sent successfully
    			$("#callback").append(html);										//append response to callback
  			}
		});
		$("#app_bus").val("");	
		$("#app_bus_address").val("");	
		$("#app_bus_phone").val("");	
		$("#app_name").val("");	
		$("#app_address").val("");	
		$("#app_phone").val("");	
		$("#app_committee").val("");	
		$("#app_residency").val("");	
		$("#app_ward").val("");	
		$("#app_quest_1").val("");	
		$("#app_quest_2").val("");	
		$("#app_quest_3").val("");	
		$("#app_quest_4").val("");
		$("#app_quest_5").val("");	
		$("#app_voter").val("");	
		return false;												//reset vars
	});		
	
	$("#tooltip").hide();													//hide the tooltip that automatically adds to the DOM
	
}); 