	/*
	* File: contact.js
	* Custom logic for the page: contact
	*/

	$(document).ready(function () {

		$(".tab_content").hide();
		$(".table_contact").hide();


		$("#contact_filter").change(function () {
			$(".tab_content").hide();
			var optionVal = $(this).val();
			if (optionVal != "")
			{
				$("#tab_" + optionVal).show();
			}
		});

		
		$("#contact_mail").click(function () {
			$("#table_contact_mail").toggle();
		});
		
		$("#contact_email").click(function () {
			$("#table_contact_email").toggle();
		});
		
		$("#contact_phone").click(function () {
			$("#table_contact_phone").toggle();
		});
		
		
		$("#contact_mail2").click(function () {
			$("#table_contact_mail2").toggle();
		});
		
		$("#contact_email2").click(function () {
			$("#table_contact_email2").toggle();
		});
		
		$("#contact_phone2").click(function () {
			$("#table_contact_phone2").toggle();
		});
		
		
		$("#contact_mail3").click(function () {
			$("#table_contact_mail3").toggle();
		});
		
		$("#contact_email3").click(function () {
			$("#table_contact_email3").toggle();
		});
		
		$("#contact_phone3").click(function () {
			$("#table_contact_phone3").toggle();
		});
		
		
		$(".link_acc").click(function () {
			$(".div_acc").hide();
			$("#div_" + $(this).attr("id")).show();
		});

	});
	
	
	function getDirections()
	{
		var f = document.getElementById('directions');
		var st = f.street.value;
		var zip = f.zipcode.value;
		var error;
		if(st == "")
		{
			error = true;
		}
		else if(zip == "")
		{
			error = true;
		}
		else
		{
			error = false;
			var addr = st+' '+zip;
		}
		if(error == false)
		{
			var url = 'http://maps.google.com/local?daddr=2+Connector+Rd,+Westborough,+MA+01581&saddr='+addr+'&f=li&hl=en&t=h';
			window.open(url,'','');
		}
		else
		{
			alert("In order to provide accurate directions it is required that you fill out the entire form");
		}
		
	}