		$(document).ready(function(){
				
				
			// links around the site
			if( $("#openx_link_left").length && $("#openx_link_right").length ){
				
				// window resize event
				$(window).resize(function() {
					  
					adjust_links_size();
				  
				});
				
				adjust_links_size();

			}
			
			

			// ie zanimljivosti
			/*if( $(".zanimljivosti_right").length ){
				
				img_width = 0;
				if( $(".zanimljivosti_right IMG").length ){ img_width = $(".zanimljivosti_right IMG").width(); }
			
				if( $(".zanimljivosti_right IMG").length && !img_width ){ img_width = 175; }
				//$(".zanimljivosti_right").width(img_width);
			}*/

			// lightbox
			$(".lightbox").lightbox();
			
			// google maps show address	
			if( $("#id_google_map_address").length == 1 ){

				// google maps
				initialize();
				
				showAddress($("#id_google_map_address").val()); 
				
			}
			
			// remove div if no banner
			// if( $("#adresar2_yellow_box").height() == 0 ){ $("#adresar2_yellow_box").remove(); }
			if( $("#adresar2_yellow_box").height() == 0  ){ $("#adresar2_yellow_box").height(60); }
			
			
			function adresar2_dropmenu_expand( real_height ){
				
				$(".sublist").css('display', 'block');
				$(".sublist").css('height', '0px');
			
				if( $(".sublist").height() >= 0 ){
					$(".sublist").animate({
						
						height: real_height
						
					}, 300 , function(){
						
						$("#category_dropdown").bind("mouseenter",function(event){
						
							$("#category_dropdown").unbind("mouseenter");
							
							adresar2_dropmenu_expand( real_height );
							
							
						});
							
					});							
				}
				
			}
			
			// adresar drop menu
			animate_drop_menu = 0;
			if( animate_drop_menu  ){
				
				if( $(".sublist").length == 1 ){
					
					real_height =  $(".sublist").height();
					
					$(".sublist").css('display', 'none');	
					
					$("#category_dropdown").bind("mouseenter",function(event){
					
						$("#category_dropdown").unbind("mouseenter");
						
						adresar2_dropmenu_expand( real_height );
						
						
					}).bind("mouseleave",function(event){
					
						$(".sublist").animate({
							
							height: '0px'
							
						}, 300, function(){
							$(".sublist").css('display', 'none');
						});
						
		
					
					
					});

					
				}
				
			}

			
			// tabs lijekovi
			// tabs_lijekovi();
			
			// naslovnica - zanimljivosti / clanci switcher
			naslovnica_zanimljivosti_clanci();
			
			// naslovnica - izdvajamo switcher
			naslovnica_izdvajamo_switcher();
			
			// naslovnica - izracun kalorija
			naslovnica_izracun_kalorija();
			
			// kalendar 
			calendar_switcher();
			
			// adresar drop list switcher
			adresar_switcher();
			
			// adresar2 tabs switcher
			adresar2_tabs_switcher();
			
			// adresar2 non premium banner bottom
			adresar2_nonpremium_banner_bottom(); 
			
			// adresar tabs switcher
			// adresar_tabs_switcher();
			
			// adresar tools popup
			adresar_tools_popup();
			
			// share button
			add_share_button();
			
			// admin clanci select all
			admin_clanci_select_all();
			
			// napr. pretraga select all
			adv_site_search_check_all();
			
			// adresar prijava premium check
			adresar_prijava_premium_check();
			
			// naslovnica - bmi kalkulator
			$('A#calc_bmi').facebox();
			
			// add tag button - submit form			
			$("A.opt_add_tag").click(function () { $("#form_add_tags").submit(); return false; });	

			// add comment button - submit form
			$("#form_add_comment A.opt_com").click(function () { $("#form_add_comment").submit(); return false; });

			// anketa
			$("DIV#survey_submit A").click(function () { $("DIV#survey_submit A").hide(); $("#form_survey").submit(); return false; });	
		    $('#form_survey').ajaxForm({ target: '#survey_results', 
				success: function() { 
					
		            	$('#survey_results').fadeIn('slow'); 
	
						bar_widths = new Array();
						$('DIV.vote_result_bar').each( function(val){
							
							bar_widths[val] = this.offsetWidth;
							
						} )
						
						for( i = 0; i < bar_widths.length; i++ ){
							
							element = $('DIV.vote_result_bar').eq(i);
							element.css('width', '0px');
							
							$('DIV.vote_result_bar').eq(i).animate({ 
						        width: bar_widths[i] + 'px'
						      }, 1500 );
							
						}

				
		    }  }); 
	
			
			// ajax form
			$("#myForm INPUT").click(function () { $("#myForm").submit(); });				
	
		    // bind form using ajaxForm 
		    $('#myForm').ajaxForm({ target: '#a_moguce_bolesti' }); 			   		

			// videoplayer
			if( document.getElementById("player") ){
				
				$f("player", "/js/videoplayer/flowplayer-3.0.5.swf", { 

				} );			
				
			};
			
			
			// povecaj slova
			$("a.t_more").click(function(){
				
				current_font_size = parseFloat( $("DIV.text_content p").css('fontSize') );

				if( current_font_size == 12 ) current_font_size = '130%';
				else if( current_font_size < 100 ) current_font_size = '100%';
				else { current_font_size = parseFloat(current_font_size) + 20 + '%' }
				
				$("DIV.text_content p , DIV.text_content h4, DIV.text_content h3, DIV.text_content ul").not('UL#clanak_tools_list').css('fontSize', current_font_size);
				
				return false;
				
			});
			

			// smanji slova
			$("a.t_less").click(function(){
				
				current_font_size = parseFloat( $("DIV.text_content p").css('fontSize') );

				if( current_font_size < 30 ) current_font_size = '100%';
				
				current_font_size = parseFloat(current_font_size) - 10 + '%'
				
				$("DIV.text_content p , DIV.text_content h4, DIV.text_content h3, DIV.text_content ul").not('UL#clanak_tools_list').css('fontSize', current_font_size);
				
				return false;
				
			});
			
			// print
			//$("a.t_print").click(function(){ window.print(); return false; });
			// print
			$('a.t_print[href*="print.php"]')
			.attr('href', "/print.php?print_page=" + document.location.href)
			.popupWindow({ 
				centerBrowser:1 ,
				height:500, 
				width:600, 
				scrollbars: 1
			}); 
			
			$('a.t_print[href="#"]').click(function(){ 
				
				window.print(); 
				return false;
				
			});
			
			// komentari link
			$("a.t_com").attr("href","#komentari");
			
			// scroll to top
			$('a[href^=#top]').click(function(){
				$('html, body').animate({scrollTop:0}, 'slow');
			});

			// preporuci sadrzaj
			title = document.title;
			title = title.split('| ');
			// $("a.t_rec").attr("href","/ajax/preporuci.php?url=" + document.location + "&title=" + escape(title[(title.length)-1]) );
			$("a.t_rec").attr("href","/ajax/preporuci.php?url=" + document.location + "&title=" + escape(title[0]) );
			$('a.t_rec').facebox();
			
			// invalid content report
			$("a#report_invalid_content").attr("href","/ajax/invalid_content_report.php?url=" + document.location + "&title=" + escape(title[0]) );
			$('a#report_invalid_content').facebox();
			
			// naslovnica pomoc - adresar
			/*$('.adr_help').click(function(){
		     	jQuery.facebox({ ajax: '/ajax/pomoc-adresar.php' })			
			});*/
			//facebox('/ajax/pomoc-adresar.php');
			$('a.adr_help').facebox();

			// rating form
            $('#rating-form').ajaxForm({ target: '#rating-results' }); 
	
			// add a "rel" attrib if Opera 7+
			if(window.opera) {
				if ($("a.jqbookmark").attr("rel") != ""){ // don't overwrite the rel attrib if already set
					$("a.jqbookmark").attr("rel","sidebar");
				}
			}
		
			$("a.jqbookmark").click(function(event){
				event.preventDefault(); // prevent the anchor tag from sending the user off to the link
				var url = this.href;
				//var title = this.title;
				var title = document.title;
		
				if (window.sidebar) { // Mozilla Firefox Bookmark
					window.sidebar.addPanel(title, url,"");
				} else if( window.external ) { // IE Favorite
					window.external.AddFavorite( url, title);
				} else if(window.opera) { // Opera 7+
					return false; // do nothing - the rel="sidebar" should do the trick
				} else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)
					 alert('Unfortunately, this browser does not support the requested action,'
					 + ' please bookmark this page manually.');
				}
		
			});
			
			// fix img tags that dont have alt or title
		 	/*$("img:not([title])").each(function() {
		  		if($(this).attr("alt") != '') $(this).attr("title", $(this).attr("alt"))
		  		else $(this).attr("title", $(this).attr("src"))
		  	});*/
		  	
		  	$('a.a_facebox').facebox();
		  	
		  	
		  	// new content - rjecnik
		  	$("A#new_content_rjecnik").click(function(){
		  		
		  		// do submit ?
		  		var do_submit = 1;
		  		
		  		// check form
		  		pojam_objasnjenje_content = tinyMCE.get('pojam_objasnjenje').getContent();
		  		
				if( document.forms['new_content_form'].pojam_naziv.value == "" ){ $('INPUT[name=pojam_naziv]').addClass('i_error'); do_submit = 0; }
				if( pojam_objasnjenje_content == "" ){ $('#wrap_pojam_objasnjenje').addClass('i_error'); do_submit = 0; }
		  		
		  		// submit form
		  		if( do_submit ){ $("#new_content_form").submit(); }
		  		
		  		return false;
		  		
		  	});
		  	
		  	
		  	// new content - video
		  	$("A#new_content_video").click(function(){
		  		
		  		// do submit ?
		  		var do_submit = 1;
		  		
		  		// check form
		  		pojam_objasnjenje_content = tinyMCE.get('video_tekst').getContent();
		  		
				if( document.forms['new_content_form'].video_naslov.value == "" ){ $('INPUT[name=video_naslov]').addClass('i_error'); do_submit = 0; }
				if( document.forms['new_content_form'].video_m.value == "" ){ $('INPUT[name=video_m]').addClass('i_error'); do_submit = 0; }
				if( document.forms['new_content_form'].video_s.value == "" ){ $('INPUT[name=video_s]').addClass('i_error'); do_submit = 0; }
				if( document.forms['new_content_form'].video_youtube.value == "" ){ $('INPUT[name=video_youtube]').addClass('i_error'); do_submit = 0; }
				if( document.forms['new_content_form'].video_screenshot.value == "" ){ $('INPUT[name=video_screenshot]').addClass('i_error'); do_submit = 0; }
				if( $("INPUT[name=kategorije[]]:checked").length == 0 ){ $(".video_error_cat").addClass('i_error'); }
				
				
				if( pojam_objasnjenje_content == "" ){ $('#wrap_pojam_objasnjenje').addClass('i_error'); do_submit = 0; }
		  		
		  		// submit form
		  		if( do_submit ){ $("#new_content_form").submit(); }
		  		
		  		return false;
		  		
		  	});
		  	
		  	
		  	// new content - recepti
		  	$("A#new_content_recepti").click(function(){
		  		
		  		// do submit ?
		  		var do_submit = 1;
		  		
		  		// check form
		  		r_uvodni_tekst 	= tinyMCE.get('recept_uvodni_tekst').getContent();
		  		r_puni_tekst 	= tinyMCE.get('recept_puni_tekst').getContent();
		  		r_sastojci 		= tinyMCE.get('recept_sastojci').getContent();
		  		
				if( document.forms['new_content_form'].recept_naslov.value == "" ){ $('INPUT[name=recept_naslov]').addClass('i_error'); do_submit = 0; }
				
				if( r_uvodni_tekst == "" ){ $('#wrap_pojam_objasnjenje1').addClass('i_error'); do_submit = 0; }
				if( r_puni_tekst == "" ){ $('#wrap_pojam_objasnjenje2').addClass('i_error'); do_submit = 0; }
				if( r_sastojci == "" ){ $('#wrap_pojam_objasnjenje3').addClass('i_error'); do_submit = 0; }
		  		
		  		// submit form
		  		if( do_submit ){ $("#new_content_form").submit(); }
		  		
		  		return false;
		  		
		  	});
		  	
		  	
		  	
		  	// new content - clanak
		  	$("A#new_content_clanak").click(function(){
		  		
		  		// do submit ?
		  		var do_submit = 1;
		  		
		  		// check form
		  		r_tekst 	= tinyMCE.get('clanak_tekst').getContent();
		  		
				if( document.forms['new_content_form'].clanak_naslov.value == "" ){ $('INPUT[name=clanak_naslov]').addClass('i_error'); do_submit = 0; }
				if( document.forms['new_content_form'].clanak_izvor.value == "" ){ $('INPUT[name=clanak_izvor]').addClass('i_error'); do_submit = 0; }
				if( $("INPUT[name=kategorije[]]:checked").length == 0 ){ $(".video_error_cat").addClass('i_error'); }
				if( r_tekst == "" ){ $('#wrap_pojam_objasnjenje').addClass('i_error'); do_submit = 0; }
		  		
		  		// submit form
		  		if( do_submit ){ $("#new_content_form").submit(); }
		  		
		  		return false;
		  		
		  	});
		  	
		  	
		  	// new content - zanimljivost
		  	$("A#new_content_zanimljivost").click(function(){
		  		
		  		// do submit ?
		  		var do_submit = 1;
		  		
		  		// check form
		  		z_kratki_tekst 	= tinyMCE.get('zanimljivost_kratki_opis').getContent();
		  		z_puni_tekst 	= tinyMCE.get('zanimljivost_puni_tekst').getContent();
		  		
				if( document.forms['new_content_form'].zanimljivost_naslov.value == "" ){ $('INPUT[name=zanimljivost_naslov]').addClass('i_error'); do_submit = 0; }
				if( document.forms['new_content_form'].zanimljivost_izvor.value == "" ){ $('INPUT[name=zanimljivost_izvor]').addClass('i_error'); do_submit = 0; }
				
				if( z_kratki_tekst == "" ){ $('#wrap_pojam_objasnjenje1').addClass('i_error'); do_submit = 0; }
				if( z_puni_tekst == "" ){ $('#wrap_pojam_objasnjenje2').addClass('i_error'); do_submit = 0; }
		  		
		  		// submit form
		  		if( do_submit ){ $("#new_content_form").submit(); }
		  		
		  		return false;
		  		
		  	});
		  	

			  
			  
			// close info
			$("A#ws_close_info").click(function(){
			
				switch( $(this).text() ){
					
					case "Zatvori info":
						$("#close_info_box").animate({ 
									        height: '0px'
									      }, 500, function(){ $(this).css('display', 'none'); } );
						$(this).text('Otvori info');
						break;
						
					case "Otvori info": 
						$("#close_info_box").animate({ 
									        height: '90px'
									      }, 500 );
						$(this).text('Zatvori info');
						break;
					
					default: break;
					
				}
				
				return false;
				
			});	  	
			
			// dict word opacity
			$("SPAN.dictionary_word_expl").css('opacity', '0.90');
			
			// adresar 2 focus link
			$("#focus_a2_input").click(function(){
				$("INPUT[name=search_subjekt]").focus();
				return false;	
			});

			
			
		});