$(document).ready(function()
{
    $(".listTitle").click(function() {
        if($(this).hasClass("expanded")) {
            $(this).next('.listText').slideUp("medium");
        } else {
            $(this).next('.listText').slideToggle("medium");
        };
        $(this).toggleClass("expanded").toggleClass("collapsed");
	});
    
     $('.hasSubmenu').mouseover(function() {
        $(this).children('ul').show();
    });
    
    $('.hasSubmenu').mouseout(function() {
        $(this).children('ul').hide();
    });
    
	$("a[rel='lightbox']").colorbox({maxHeight: '90%', maxWidth: '90%'});
    
    $('.innerfade').innerfade({
		speed: 750,
		timeout: 5000,
		type: 'random'
	});
    
    $(".tooltip").tooltip({ 
        bodyHandler: function() { 
            return $($(this).attr("href")).html(); 
        }, 
        showURL: false 
    });
    
    $(".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");
		}
    });
    
    $.validator.messages.required = ""; 
    $("#contactForm").validate({});
});
