function _loadVote(url) {
	var time = (new Date()).getTime();
	var id = $('#fid').val();

	$('#vote').load('/vote?r='+time+'&id='+id+url,function() {
		if(url != '') {
			location.reload();
			return;
		}

		$('#votePlus').bind('click',function() {
			$('.clickRemove').hide();
			$('#voteTitle').text('Czekaj...');
			_loadVote('&cl=PLUS');
		});
		$('#voteMinus').bind('click',function() {
			$('.clickRemove').hide();
			$('#voteTitle').text('Czekaj...');
			_loadVote('&cl=MINUS');
		});
	});
}

$(function() {

	var im = new Image();
	im.onload = function() {
		var w = parseInt($('#img').width());
		var h = parseInt($('#img').height());

		var wh = Math.floor((w+h)/2);

		$('#loader').hide();
		$('#img').fadeIn('slow');
		$('#imgSize').text('('+w+'x'+h+' px)');

		if(wh > 600) {
			$('#min_600x600').show();
		}

		if(wh > 200) {
			$('#min_200x200').show();
		}
	};

	im.src = $('#full').val();


	$('#img').attr('src',$('#full').val());
	

	_loadVote('');

	$('input[@type=text]').bind('click',function() {
		this.select();
	});

	$('input[@type=text]').bind('blur',function() {
		var cp = this.value;
		this.value = '';
		this.value = cp;
	});
});
