function verify(msg){
    return confirm(msg);
    }
    
// for toggling show/hide

$(document).ready(function(){
		$('.showhide').toggle();
   		$('a.showhide_button').click(function(){
			$('.showhide').toggle('slow');
		});
		$('a.showhide_link').click(function(){
			$('.showhide').toggle('slow');
   		});
	});
	
// checking radio buttons with link
function radio(id) {
    document.getElementById(id).checked = 1; 
}
  
// start followup question hidden
function hideFollowup(question_id) {
	var answer = $("input[name='answer["+question_id+"][answer]']:checked").val(); // get value of radio button
	if (answer > 3 || answer == null || answer == 0)
		{
		$(".followup" + question_id).fadeTo("fast", 0.0);
	    $(".followup" + question_id).hide();
		}
	// else just leave shown
  };

// toggle followup questions on survey based on response
function followup(question_id,answer) {
	if (answer > 3 || answer == 0) {
	$(".followup" + question_id).fadeTo("slow", 0.0);
    $(".followup" + question_id).slideUp("fast");
	}
	else {
	$(".followup" + question_id).slideDown("fast");
	$(".followup" + question_id).fadeTo("slow", 1.0);
	}
	if (answer !== null) { $('#survey_question'+question_id).removeClass('unanswered'); }
  };

// usefull for clearing input field on calendar, etc - pass element id then desired text
function changeText2(id,text){
	document.getElementById(id).innerHTML = text;
}
function changeInput2(id,text){
	document.getElementById(id).value = text;
}

// accordian menu
function initMenus() {
$('ul.menu ul').hide();
$.each($('ul.menu'), function(){
var cookie = $.cookie(this.id);
if(cookie === null || String(cookie).length < 1) {
$('#' + this.id + '.expandfirst ul:first').show();
}
else {
$('#' + this.id + ' .' + cookie).next().show();
}
});
$('ul.menu li a').click(
function() {
var checkElement = $(this).next();
var parent = this.parentNode.parentNode.id;
if($('#' + parent).hasClass('noaccordion')) {
if((String(parent).length > 0) && (String(this.className).length > 0)) {
if($(this).next().is(':visible')) {
$.cookie(parent, null);
}
else {
$.cookie(parent, this.className);
}
$(this).next().slideToggle('normal');
}
}
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
if($('#' + parent).hasClass('collapsible')) {
$('#' + parent + ' ul:visible').slideUp('normal');
}
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#' + parent + ' ul:visible').slideUp('normal');
if((String(parent).length > 0) && (String(this.className).length > 0)) {
$.cookie(parent, this.className);
}
checkElement.slideDown('normal');
return false;
}
}
);
}