function show(){
	$('div.information').css({ "display": "block" });
};

function hide(){
	$('div.information').css({ "display": "none" });
};

function submit_feedback_form()
{
	var rating = $('input[@name=rating]:checked').val();
	var email = $('input[@name=email]').val();
	var comments = $('textarea[@name=comments]').val();
	var params = {rating: rating, email: email, comments: comments};
	$.getJSON("/ajax/feedback/", params, function(json) {
		$('p.error').remove();
		if ('' != json.success) {
			$('form#feedback_form').css({display: 'none'});
			$('body').append(json.success);
			//setTimeout("tb_remove();", 5000);
		} else {
			if ('' != json.fielderrors.rating)
				$('div.line1').before('<p class="error">' + json.fielderrors.rating + '</p>');
			if ('' != json.fielderrors.email)
				$('div.line2').before('<p class="error">' + json.fielderrors.email + '</p>');
			if ('' != json.fielderrors.comments)
				$('div.line3').before('<p class="error">' + json.fielderrors.comments + '</p>');
//			$('input:text').hint();
//			$('textarea').hint();
		}		
	});
	return false;
}

$(document).ready(function(){
	$('input:text').hint();
	$('textarea').hint();
	$('a#information').hover(show, hide);
	
	$('form#feedback_form').submit(submit_feedback_form);
	
//	$('input#sendFeedback').click(submit_feedback_form)
});
