function send_feedback_submit() {
	text = jQuery('#feedback_text').val();
	subject = jQuery('select[name=feedback_subject] > option:selected').val();
	email = jQuery('#feedback_mail').val();
	
	jQuery('#feedback_text, select[name=feedback_subject]').removeClass('error');
	
	if (text.length > 0 && subject) {
		jQuery("#TB_AjaxMSG").animate({ top: '0px' }, 500);
			
		jQuery.ajax({
			type: "POST",
			url: jQuery('#send_feeback_area > input#feedback_URL').val(),
			data: {
				'message': text,
				'subject': subject,
				'email': email
			},
			success: function(response){
				tb_remove();
				jQuery('#sys_msg').remove();
				jQuery('<div />').attr({id: 'sys_msg'}).insertBefore('#search_wrapper').html('');
				jQuery('<div/>').addClass('success').text(jQuery('#send_feeback_area > input#feedback_ConfirmText').val()).appendTo('#sys_msg');
				jQuery('#sys_msg').fadeIn();
				scrollTo(0,0);
			}
		});
	} else {
		if(text.length < 1) jQuery('#feedback_text').addClass('error');
		if(!subject) jQuery('select[name=feedback_subject]').addClass('error');
			
		jQuery("#TB_AjaxMSG").html("Please fill in all required fields.").show().animate({ top: '47px' }, 500);
	}
}

jQuery().ready(function() {
				
			jQuery('#send_feedback_btn, .send_feedback_teaser').click(function() {		
				jQuery('#feedback_text').removeClass('error').text('');
				jQuery('#feedback_mail').val("");	
				tb_show('Send Feedback', '#TB_inline?a=1&height=auto&inlineId=send_feedback_wrapper');
				if(jQuery(this).attr('title')) {
					jQuery('.tb_tile_text').html(jQuery(this).attr('title'));					
				}
				if(jQuery(this).attr('rel')) {
					text = jQuery(this).attr('rel').split("||")[0];
					label = jQuery(this).attr('rel').split("||")[1];
					jQuery('.fb_text').html(text + "<br/><br />");
					jQuery('.fb_feedback_label').text(label);
				}
    			return false; 								
			});
			
			jQuery('#tb_feedback_submit_btn').click(function() {
				send_feedback_submit();
				return false;
			});
				
			jQuery('#tb_feedback_cancel_btn').click(function() {
				tb_remove();
				return false;
			});	
});