function rateStory(story_id,value)
{
	$.ajax({
			type: "POST",
			url: "index_ajax.php",
			data: "mode=rateStory&story_id="+story_id+'&value='+value,
			success: function(msg){
				drawLikeDislike(story_id);
			}
	});
}

function drawLikeDislike(story_id)
{
	$.ajax({
			type: "POST",
			url: "index_ajax.php",
			data: "mode=drawLikeDislike&story_id="+story_id,
			success: function(msg){
				storyDiv=$('#story_rate_'+story_id);
				if(storyDiv.length != 0)
				{
					storyDiv.html(msg); 
				}
			}
	});
}

function rateStudy(study_id,value)
{
	$.ajax({
			type: "POST",
			url: "index_ajax.php",
			data: "mode=rateStudy&study_id="+study_id+'&value='+value,
			success: function(msg){
				drawLikeDislikeTed(study_id);
			}
	});
}

function drawLikeDislikeTed(study_id)
{
	$.ajax({
			type: "POST",
			url: "index_ajax.php",
			data: "mode=drawLikeDislikeTed&study_id="+study_id,
			success: function(msg){
				studyDiv=$('#study_rate_'+study_id);
				if(studyDiv.length != 0)
				{
					studyDiv.html(msg); 
				}
			}
	});
}

function saveCrazyFactor(story_id,value)
{
	$.ajax({
			type: "POST",
			url: "index_ajax.php",
			data: "mode=saveCrazyFactor&story_id="+story_id+'&value='+value,
			success: function(msg){
				drawCrazyFactorBox(story_id);
			}
	});	
}

function drawCrazyFactorBox(story_id)
{
	$.ajax({
			type: "POST",
			url: "index_ajax.php",
			data: "mode=drawCrazyFactorBox&story_id="+story_id,
			success: function(msg){
				storyCFDiv=$('#story_cf_'+story_id);
				if(storyCFDiv.length != 0)
				{
					storyCFDiv.html(msg); 
				}
			}
	});	
}

function postThisPoll(pollId)
{
	formElement=$('#poll'+pollId);
	data=formElement.serialize();
	$.ajax({
			type: "POST",
			url: "poll_post_ajax.php",
			data: data,
			success: function(msg){
				$('#poll_msg'+pollId).html(msg);
			}
	});	
}