
		$(document).ready(function(){

			$('form').each(function(){
				$(this).validate();
			});
			$('.clear-value').inputClear();
			$('.no-history').inputAutocompleteOff();
			$('.ext').attr('target','_blank');
			
			$('.commentinput').focus(
				function(){
					$(this).attr('rows','5');
					$(this).css('height','100px');
			});	
			$('.commentinput').blur(
				function(){
					if ($(this).val()=='' || $(this).val()=='Odpovedať') {
						$(this).attr('rows','1');	
						$(this).css('height','18px');
					}
			});	
			
			$('.commentform-hidelabels').hide(0);
			$('.commentform').click(function(){
				
				$(this).find('.commentform-hidelabels').show();
				
			})
			$('a.vote-like').click(function(){
				var $this = $(this);
				$.post('?ajax=like',
				{
					'id':$(this).parent().parent().attr('rel'),
					'action':'vote',
					'kategoria':$(this).attr('rel'),
					'like':1	
				},
				function(response) {
					if (response.status == 0) {
						alert('Už ste hlasovali');
					}
					else if (response.status == 1){
						var rel = $this.attr('rel');
						var id = $this.parent().parent().attr('rel');
						$this.parent().parent().parent().load('?ajax=like&action=refresh&kategoria='+(rel)+'&id='+(id));
					}
				},"json");
			});
			$('a.vote-dislike').click(function(){
				var $this = $(this);
				$.post('?ajax=like',
				{
					'id':$(this).parent().parent().attr('rel'),
					'action':'vote',
					'kategoria':$(this).attr('rel'),
					'like':0
				},
				function(response) {
					if (response.status == 0) {
						alert('Už ste hlasovali');
					}
					else if (response.status == 1){
						var votes = $this.find('vote').text();
						$this.find('vote').text(parseInt(votes)+1);
					}
				},"json");
			});
		

		});

