jQuery().ready(function() {
	//$().jSnow();
	
	$('.main-menu #brand-selector').mouseenter(function() {
		$('a:first', $(this)).addClass('selected');
		$('ul', $(this)).css('display', 'block');
	}).mouseleave(function() {
		$('a:first', $(this)).removeClass('selected');
		$('ul', $(this)).css('display', 'none');
		Cufon.replace('.main-menu li a', {
			fontFamily: 'Helen Bg',
			fontSize: '16px',
			hover: true
		});
	});
	
	if ($('.right-content .photo img').length) {
		$('.right-content .photo').cycle({
			delay:  4000
		});
	}
	
	$('#smallImages ul li img').click(function() {
		$('#bigImage img').attr('src', $(this).attr('src').toString().replace('thumb_124x83_', 'thumb_386x252_'));
	});
	
	(function(){
	    $.validity.outputs.generousauto = {
	        start:function(){ 
	        	//$('form.validity input, form.validity select, form.validity textarea').removeClass('invalid');
	        },
	        end:function(results) {
	        	if (!results.valid) {
	        		$('.flash_messages').show('slow');
	        	} else {
	        			
	        	}
	        },
	        raise:function($obj, msg){
	        	$obj.addClass('invalid');
	        },
	        raiseAggregate:function($obj, msg){ 
	        }
	    }
	})();
	
	$.validity.setup({ 
		outputMode: "generousauto",
		scrollTo: false
	});
	$('#club_form form').validity(function() {
		$('#names, #cellular, #new_car_model, #vin, #captcha').require();
		$('#email').require().match("email");
//		if ($("#financing_y").attr("checked")) {
//			$('#credit_first_installment').require();
//			$('#credit_expiry_date').require();
//		}
		$("#cellular").assert(
			($('#cellular').val().length)
		);
	});	
	
	$('#online_request').validity(function() {
		$('#first_lastname, #repair_date, #telephone, #vin, #captcha, #phone_call_agreement:checked').require();
		$('#email').match("email");
		$(".checkboxes input[type=checkbox]").assert(
			($(".checkboxes input[type=checkbox]:checked").length)
		);
	});	
	
}); 

