function reloadPosts(){
	var c = Math.floor(Math.random()*11);
	window.location = $("#refreshUrl").val()+"?c="+c+"#firstPost";
}

$(document).ready(function(){
	var underage = Tremor.Util.GetCookie('underage');
	if(underage=='true'){
		$("#reviewSorry").css({'display':'block'});
		$("#reviewForm").css({'display':'none'});
	}
	
	var url = location.href;
	if(url.indexOf('#') != -1){
		$("#reviewThanks").css({'display':'block'});
		$("#reviewForm").css({'display':'none'});
	}
	if(url.indexOf('#reviews') != -1){
		$("#reviewThanks").css({'display':'none'});
		$("#reviewForm").css({'display':'block'});
	}
	
	$("#errors").html('&nbsp;');
	
	
	$("#btn_submit").click(function(){
		var contentId = $("#contentId").val();
		var fname = $("#fname").val();
		var age = $("#age").val();
		var message = $("#message").val();
		var release = $("#release:checked").length;
		
		if((fname!='') && (age!='') && (message!='')){
			//check the age
			if(age=='17-'){
				$("#reviewSorry").css({'display':'block'});
				$("#reviewForm").css({'display':'none'});
				Tremor.Util.SetCookie('underage', 'true');
				//window.location = 'reactions.html';
			}
			//above age...submit ajax
			else{
				Tremor.Ajax.Call("mo","SubmitCommentAndRelease",{contentId:contentId,message:message,firstName:fname,release:release}, {sync:true, onSuccess:function(resp){reloadPosts();}});
				TrackPage('prox','reviews_thanks');

			}
		}
		
		return false;
		
	});

});