function limitText(){
	if ($('PostBody').value.length > 255) {
		$('PostBody').value = $('PostBody').value.substring(0, 255);
	}else{
		$('PostCount').innerHTML = 255 - $('PostBody').value.length;
	}
}

function moveDiv(element,h){
	var elementH = element.getHeight();
	new Effect.Move(element, { x:element.x, y: -(h/18), mode: 'absolute', duration: 20, afterFinish: function() {
			element.setStyle({top: h + 'px'});
			moveDiv(element,h);
		}
	});
}
function makeDiv (id){
	var bodyH = $('body').getHeight();
	var html = '<div id="'+ id + '" style="top:' + bodyH  +  'px"></div>';
	$('main').insert(html);
	moveDiv($(id),bodyH);
}

function vote(id,type){
	new Ajax.Request('/vote/' + id + '/' + type, {
	  onSuccess: function(output) {
			var result = output.responseText.evalJSON();
			$("s"+type+id).innerHTML ="<span class='"+type+"'>"+type.capitalize()+"<i>("+result.vote+")</i></span>";
			pageTracker._trackPageview("/vote" );
	  }
	});	
}