$(document).ready(function() {
	
		$(".header_prijava").fancybox({
			'width'				: 480,
			'height'			: 365,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe',
			'titleShow'			: false,
			'overlayColor'		: '#000',
			'padding'			: 0
		});
		
		$(".oglasi_opis").fancybox({
			'width'				: 480,
			'height'			: 365,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe',
			'titleShow'			: false,
			'overlayColor'		: '#000',
			'padding'			: 0
		});
	
		$(".gallery_img").fancybox({
			'autoScale'			: true,
			'cyclic'			: true,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'image',
			'autoDimensions'	: true,
			'titleShow'			: true,
			'titlePosition'		: 'over',
			'overlayColor'		: '#000'
		});
		
		$(".video_pregled").click(function() {
			$.fancybox({
					'padding'		: 0,
					'autoScale'		: false,
					'transitionIn'	: 'none',
					'transitionOut'	: 'none',
					'title'			: this.title,
					'titleShow'		: false,
					'width'		: 480,
					'height'		: 390,
					'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
					'type'			: 'swf',
					'swf'			: {
						 'wmode'		: 'transparent',
						'allowfullscreen'	: 'true'
					}
				});
		
			return false;
		});
		
		/*$(".video_pregled").fancybox({
			'width'				: 640,
			'height'			: 390,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe',
			'titleShow'			: false,
			'overlayColor'		: '#000',
			'padding'			: 0
		});*/

		
});

/*function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}*/

function preostalo_znakova(broj_znakova){
	$(document).ready(function(){  
	  $('#textarea_1_1').maxlength({   
	    //events: [], // Array of events to be triggerd    
	    maxCharacters: broj_znakova, // Characters limit   
	    status: false // True to show status indicator bewlow the element    
	   // statusClass: "status", // The class on the status div  
	    //statusText: "character left", // The status text  
	    //notificationClass: "notification",	// Will be added when maxlength is reached  
	    //showAlert: false, // True to show a regular alert message    
	    //alertText: "You have typed too many characters.", // Text in alert message   
	    //slider: false // True Use counter slider    
	  }); 
	  $('#textarea_2_1').maxlength({    
	    maxCharacters: broj_znakova, // Characters limit   
	    status: false // True to show status indicator bewlow the element     
	  }); 
	  $('#textarea_3_1').maxlength({    
	    maxCharacters: broj_znakova, // Characters limit   
	    status: false // True to show status indicator bewlow the element     
	  }); 
	  $('#textarea_4_1').maxlength({    
	    maxCharacters: broj_znakova, // Characters limit   
	    status: false // True to show status indicator bewlow the element     
	  }); 
	});
}
