$(document).ready(function()
{
	$("a[rel='lightbox']").colorbox();
    
    $('.innerfade').innerfade({
		speed: 750,
		timeout: 5000,
		type: 'random'
	});
    
    $(".categoryQuestion").click(function() {
        if($(this).hasClass("expanded")) {
            $(this).next('.categoryAnswer').slideUp("medium");
        } else {
            $(this).next('.categoryAnswer').slideToggle("medium");
        };
        $(this).toggleClass("expanded").toggleClass("collapsed");
	});
    
    $('.hasSubmenu').mouseover(function() {
        $(this).children('ul').show();
    });
    
    $('.hasSubmenu').mouseout(function() {
        $(this).children('ul').hide();
    });
    
    $(".validateForm").validate({
        errorPlacement: function(error, element) {
			error.prependTo( element.parent().next() );
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
    });
});
