$(function() {
//faq page effect
	$("#faqcontent").accordion({
			active: false,
			navigation: true,
			collapsible: true,
			animated: 'none',
			autoHeight: false,
			icons:{'header': 'ui-icon-circle-plus', 'headerSelected': 'ui-icon-circle-minus'},
			change: function(event, ui) {
				var accordionindex=$("#faqcontent").accordion('option', 'active');
				var theid='#faq'+accordionindex;
				var faq = document.getElementById(theid);
				var $faqid = $(theid);
				var $scroll_wrapper = $('#scroll_wrapper');

				var scroll_wrapper = parseInt($scroll_wrapper.offset().top);
				var faq_top = parseInt($faqid.offset().top);
				var theheight=$(theid).height();

				// take position of the faq content and subtract the scroo_wrapper top position and 23px.  The 23px makes sure the question shows
				var scrolltopos=faq_top-scroll_wrapper-23;
				if(document.getElementById("scroll_wrapper").offsetHeight >384){$scroll_wrapper[0].scrollTo(scrolltopos);}
				$('#scroll_wrapper').jScrollPane(); // resize the scrollbar whenever a faq is expanded or collapsed.
				return false;
			} 
		}
	);
//auto scrollbar	
	$("#scroll_wrapper").jScrollPane({
			topCapHeight: 20,
			scrollbarWidth: 10,
			bottomCapHeight: 0,
			reinitialiseOnImageLoad: true
		}
	);
// more dropdown menu	
	$("li:has(#more)").hover(function() {
		$("#more_submenu").show();
	}, function() {
		$("#more_submenu").hide();
	});	
});

// function to handle the drop down secondary menus on the menu pages.
function activatemenu(parentid){
	// hide menu that is currently active.  change class for that menu
	if(activemenu != 0){
		$('#menucat'+activemenu).hide('blind');
		var e = document.getElementById('parent'+activemenu);
		e.className = 'notcurrent';
	}
	// show menu that user clicked on.  change class for that menu
	if (parentid!=activemenu) {
		var e = document.getElementById('parent'+parentid);
		if (parentid==activesecmenu) {e.className = 'currentparent';}
		else{e.className = 'current';}				
		$('#menucat'+parentid).show('blind');
		//update var that holds current menu id
		activemenu=parentid;
	}	
	else {
		activemenu=0;
	}
}
function ClearField(myFormField, startinValue){
	myField = document.getElementById(myFormField);
	if (myField.value==startinValue){
		myField.value="";
	}	
}