

	var menu = new Object();
	var contactUsForm = document.getElementById('contact-us-anchor');
	//contactUs.Form = $(document.getElementById('contact-us'));
	

	/* ***
	Gets the Select Index Value and Text of select fields
	*** */
	menu.getSelectedIndex = function (id) {
		thisIndex = document.getElementById(id).selectedIndex;
		thisValue = document.getElementById(id).options[thisIndex].value;
		thisText = document.getElementById(id).options[thisIndex].text;
		return [thisValue,thisText];
	}
	/* ** */
	
	menu.showForm = function(x) {
		var id = x.id;
		id = id.replace(/-anchor/,'');
		id = $(document.getElementById(id));
		$(id).children(".flyout-menu").slideDown({duration:300});
	}
	
	menu.hideForm = function(i) {
		var id=typeof(i)=='string'?i:this.id;
		id = id.replace(/-anchor/,'');
		id = $(document.getElementById(id));
		$(id).children(".flyout-menu").slideUp({duration:300});
	}
	
	menu.Empty = function() {
		//	hoverIntent requires an over event method
		//	this is left empty intentionally since we want onClick instead
	}
	
	menu.sendContactForm = function() {
		your_name = document.getElementById('your_name').value;
		your_email = document.getElementById('your_email').value;
		message = document.getElementById('your_message').value;
		contact = menu.getSelectedIndex('contactName');
		contactName = contact[1];
		contactEmail = contact[0];
		
		url = config.jsLibrary + '/Ajax/Send_Contact_Form.php';

		if (your_name =='') {
			alert("Please tell us your name");
			//menu.showForm('contact-us-anchor');
		} else if (your_email == '' ) {
			alert("You need to enter an email address");
			//menu.showForm('contact-us-anchor');
		} else if (message == '') {
			alert("Please enter a short email message");
			//menu.showForm('contact-us-anchor');
		} else if (contactEmail == '') {
			alert("Please select a contact to send this email to");
		} else {
			$.post( url, {
				your_name: your_name,
				your_email: your_email,
				your_message: message,
				contactName: contactName,
				contactEmail: contactEmail,
				___:encodeURIComponent(Math.random())
			},function(event,data){
				alert('Your message has been sent to ' + event + '.  They will contact you shortly');
			});
		}
	}

    
$(document).ready(function() {
    
	$('#download-forms-anchor').click(function() { menu.showForm(this); });
	//$('#contact-us-anchor').click(function() { menu.showForm(this); });
	$('#external-links-anchor').click(function() { menu.showForm(this); });
	$('#administrative-services').click(function() { menu.showForm(this); });
	$('#business-insurance').click(function() { menu.showForm(this); });
	
	$("#download-forms,#external-links,#administrative-services,#business-insurance").hoverIntent({
		sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
		interval: 50,   // number = milliseconds for onMouseOver polling interval
		over: menu.Empty,     // function = onMouseOver callback (required)
		delay: 300,
		timeout: 300,   // number = milliseconds delay before onMouseOut
		out: menu.hideForm // function = onMouseOut callback (required)
	});
	$("<?php echo $idList; ?>").hoverIntent({
		sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
		interval: 50,   // number = milliseconds for onMouseOver polling interval
		over: menu.Empty,     // function = onMouseOver callback (required)
		delay: 300,
		timeout: 300,   // number = milliseconds delay before onMouseOut
		out: menu.hideForm // function = onMouseOut callback (required)
	});
    
	$('div.rounded').corner();
	//$('#contactName').selectbox();
 
});
	
	$('LI.middle> UL').hide();
	$('LI.middle> h5').click(function() {
		$(this).next('ul').slideToggle('fast')
		.siblings('ul:visible').slideUp('fast');
	});
	/*
		$(this).toggleClass('highlight').siblings('h5.highlight').toggleClass('highlight');
		$(this).next('ul').slideToggle('fast').siblings('ul:visible').slideUp('fast');
	});*/
