jQuery(function () {
	Cufon.now();
	
    jQuery('#submit').click(function () {
        jQuery.ajax({ 
			url: targetUrl, 
			data: jQuery('#lead').serialize(),
			crossDomain: true,
			dataType: "jsonp",
			success: function (data) {
				if (data.success === true) {
					jQuery('#lead').hide(); jQuery('#lead-confirmation').show();
					if (_gaq) {
						_gaq.push(['_trackEvent', 'Forms', jQuery('#event-name').val(), jQuery('#event-label').val()]);
					}
				}
				else {
					jQuery('#validation_summary').html('');
					var errorHtml = '<ul>';
					jQuery(data.errors).each(function (index, value) { errorHtml += '<li>' + value + '</li>'; });
					errorHtml += '</ul>';
					jQuery('#validation_summary').html(errorHtml);
					jQuery('#validation_summary').show();
				}
			}
        }); 
		
		return false;
    });
	
	
	jQuery("#text-9 :text").bind('focus blur', function(e) {
		e.type == 'blur' && this.value == '' ? jQuery(this).prev('label').show() : jQuery(this).prev('label').hide();
	});
	jQuery('#text-9 label[for]').click(function() {
		$(this).next('input, textarea').focus();
	});
	
	
});


