jQuery(document).ready(function($){



//  general

// open up links to external content in new browser window/tab


//$("a[href^='http']").attr('target','_blank');



// main menu helper
	/*$('#nav li.cat-item a').prepend('<strong>');
	$('#nav li.cat-item a').prepend('<span>');
	$('#nav li.cat-item a').append('</span>');
	$('#nav li.cat-item a').append('</strong>');*/
	//$('span').appendTo('#nav>.inner>ul>li.cat-item>a');


// home news list

	$('.news_list h2').hover(
		function(e){
			e.preventDefault();
			$(this).next('.thumb_box').show();
		},
		function(e){
			e.preventDefault();
			$(this).next('.thumb_box').hide();
		}
 	);


//  Link style setup
	
	$('dl.docs a[href$=".pdf"]').prepend('<span class="ico">pdf</span>');
	$('dl.docs a[href$=".xls"]').prepend('<span class="ico">xls</span>');
	$('dl.docs a[href$=".doc"]').prepend('<span class="ico">doc</span>');
	$('dl.docs a[href$=".xdoc"]').prepend('<span class="ico">doc</span>');
	$('dl.docs a[href$=".pps"]').prepend('<span class="ico">ppt</span>');
	$('dl.docs a[href$=".zip"]').prepend('<span class="ico">zip</span>');
	$('dl.docs a[href$=".rar"]').prepend('<span class="ico">rar</span>');
	
	
	
	
	
	$('.gallery .gallery-row').not('.galerija_temp .gallery-row').css('opacity','0.5');
	
	$('.gallery').hover(
		function(e){
			e.preventDefault();
			$('.gallery-row').not('.galerija_temp .gallery-row').animate({ opacity: 1 }, 500 );
		},
		function(e){
			e.preventDefault();
			$('.gallery-row').not('.galerija_temp .gallery-row').animate({ opacity: 0.4 }, 500 );
		}
 	);

	$('.galerija_temp .gallery-row dl.gallery-item:first-child').addClass('first-gall-item');
	$('.galerija_temp .gallery-row dl.gallery-item:last-child').addClass('last-gall-item');


	$('ul.promo_block a').hover(
		function(e){
			e.preventDefault();
			$(this).prev().addClass('ower');
		},
		function(e){
			e.preventDefault();
			$(this).prev().removeClass('ower');
		}
 	);


//body gfx randomizer
  var randomClass = ['gfx_1','gfx_2','gfx_3','gfx_4','gfx_5'];
  var rndNum = Math.floor(Math.random() * randomClass.length);
  $("div#bg_gfx").addClass(randomClass[rndNum]);




//table zebra
  /*
  $('table tbody tr:odd').addClass('odd');
  $('table tbody tr:even').addClass('even');
  */













	


// log bar style helper 
	/*
	$("#log li a").mouseover(function(){

		var linkli=$(this).parent();

		linkli.next().addClass("pipe_black");
		linkli.prev().addClass("pipe_black");
		
	}).mouseout(function(){

		var linkli=$(this).parent();

		linkli.next().removeClass("pipe_black");
		linkli.prev().removeClass("pipe_black");

	});
	*/



//add class to last list element
	//$('.gallery li:last-child').addClass('last');
	
	/*
	$('.search_results div:last-child').prev('dl').addClass('last');
	$('.lista_diskusija li:last-child').addClass('last');
	*/
	
	/*
	$('.gallery li').each(function (i) {
		i = i+1;
		$(this).addClass('item'+i);
  	});
	
	$('#tabs-11 li').each(function (i) {
		i = i+1;
		$(this).addClass('item'+i);
  	});
	*/


//add class to every fourth item galerije 
	/*
	if($("ul.gallery ").length){ 
		$("ul.gallery li").each(function(i){ var remainder = (i + 1) % 4; 
			if(remainder === 0){ $(this).addClass("last"); } }); 
		}
	*/


//  hover start
	
	/*
	$('li.wrap_text').hover(
	function() { $(this).addClass('wrap_text_hover'); },
	function() { $(this).removeClass('wrap_text_hover'); });

	$('table.docs').hover(
	function() { $(this).addClass('over_docs'); },
	function() { $(this).removeClass('over_docs'); });
	
	$('ul.links').hover(
	function() { $(this).addClass('over_links'); },
	function() { $(this).removeClass('over_links'); });
	
	$('.home_news_list li').hover(
	function() { $(this).addClass('over_h_list'); },
	function() { $(this).removeClass('over_h_list'); });
	

	$('#search_box input.text').focus(
		function() { 
			$(this).parent('li.wrap_text').addClass('wrap_text_focus')
										  .animate({ width: '147px' }, 500 );
											
	
	});
	
	$('#search_box input.text').click(function(e){
		e.stopPropagation();
	});
	
	$(document).click(function(){
		$('#search_box li.wrap_text_focus').removeClass('wrap_text_focus')
										   .animate({ width: '67px' }, 500 );

	});
	*/
	

//  hover stop





//  Table style setup
	/*
	$('table.docs tbody tr:odd').addClass('odd');
	$('table.docs tbody tr:even').addClass('even');
	$('table.events tbody tr:odd').addClass('odd');
	$('table.events tbody tr:even').addClass('even');
	*/




//  Comment toggle more
	
	//var parentItem = $(this).parents('.comment_item').next('div.discuss');
	/*
	$('a.n_answer').toggle(
		function(e){
			e.preventDefault();
			$(this).addClass('n_answer_opened')
			$(this).parents('.comment_item').next('div.discuss').show();
		},
		function(e){
			e.preventDefault();
			$(this).removeClass('n_answer_opened')
			$(this).parents('.comment_item').next('div.discuss').hide()
		}
 	);
	*/
	//var parentItem = $(this).parents().next('div.wrap_add_comm');
	/*
	$('a.answer').toggle(
		function(e){
			e.preventDefault();
			//$(this).addClass('test')
			$(this).parents('.comment_item').children('li.wrap_add_comm').show();
		},
		function(e){
			e.preventDefault();
			//$(this).removeClass('test')
			$(this).parents('.comment_item').children('li.wrap_add_comm').hide()
		}
 	);
	*/
//  Kalendar small selected
	
	//if($('input[checked*="checked"]'))
	//if($('label.dog input').attr('checked')=='checked')
	
	
	
	



							
});    //document ready stop

////////////////////////////////////////////////////////////////
//anchor slide start
/*******
*** Anchor Slider by Cedric Dugas ***
*** Http://www.position-absolute.com ***
Never have an anchor jumping your content, slide it.
Don't forget to put an id to your anchor !
You can use and modify this script for any project you want, but please leave this comment as credit.
*****/

jQuery(document).ready(function($){
  $("a.anchorLink").anchorAnimate();
});

jQuery.fn.anchorAnimate = function(settings) {

 settings = jQuery.extend({
 speed : 1100
 }, settings);

 return this.each(function(){
 var caller = this
 $(caller).click(function (event) {
 event.preventDefault()
 var locationHref = window.location.href
 var elementClick = $(caller).attr("href")

 var destination = $(elementClick).offset().top;
 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
 window.location.hash = elementClick
 });
 return false;
 })
 })
}

//anchor slide stop
////////////////////////////////////////////////////////////////





