$(document).ready(function(){
	if (typeof(InitilizeMap)==='function')
		{
				InitilizeMap();	
		}
 
    if (typeof(Init_uploadify)==='function')
		{
				Init_uploadify();	
		}
	if (typeof(newpicturesControls)==='function'){
					newpicturesControls();
		}
	if (typeof(contactPage_clickEvents)==='function'){
		 contactPage_clickEvents();
         }
         
     $('.front_select .ul_holder .main_li:first-child').addClass('selected');
     
     
     
     $('.ul_holder .main_li').hover(function(){
            
        var me = $(this);
         
        if ($(this).hasClass('selected')){
               $(this).children('ul').slideDown();      
               
         }else{
            
            $(this).children('ul').css({top:'0px'});      
             
            $(this).children('span').stop().animate({backgroundPosition:"(0 0)"},600,function(){
                me.children('ul').show().animate({top:'55px'},200);
            });    
            $(this).children('span').children('span').stop().animate({backgroundPosition:"(0 0)"}, {duration:300});
         }
            
        
         
            
     },function(){
        
         if ($(this).hasClass('selected')){
               $(this).children('ul').hide();      
               return false;
                 
         }else{
                $(this).children('ul').hide();    
                $(this).children('span').stop().animate({backgroundPosition:"(0 -65px)"}, 300,function(){
                    $(this).children('span').stop().animate({backgroundPosition:"(0 10px)"}, {duration:300});
                    $(this).css({backgroundPosition:'0 -185px'});
                });
         }
         $(this).children('ul').hide();    
        });    

         
 $('#mycarousel').jcarousel(); 
 
 $("#mycarousel li a[rel='example_group']").fancybox({
     'transitionIn' : 'elastic',
     'transitionOut' : 'elastic',
     'easingIn' : 'easeInOutExpo',
     'easingOut' : 'easeInBack',
     'titlePosition' : 'over',
     'titleShow' : false,
     'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
     return '<span id="fancybox-title-over">' + (title) + '</span>';
     }
 });
 
  
     
     
      $(".baner_img_iso").lazytooltiper({div_to_show:'.sertifikat',close_button:".close-button",centered: true});
      $(".sidenav_pol").lazytooltiper({div_to_show:'.politika_za_kvalitet',close_button:".close-button",centered: true});
      
      
      if ($('.p_list').length>0) $('.p_list').ahover({toggleEffect: 'both',moveSpeed:150}); 
      
     

  
     
  $('.link_gallery ul li a,.mines ul li a').click(function(){
         
         var element=this;
          
         var winTop = ($(window).scrollTop())+20;
         
         var winLeft = (($(window).width())/2)-(($('#pictureLoad').width())/2);
         
         
         $('#pictureLoad').css({top:winTop,left:winLeft});
         $('#ss_loader').show();

         
         
         img = new Image();
         img.onload=function()
         {
             $('#ss_loader').hide();
             
             $('#pictureLoad img').attr({'src':$(element).attr('href'),'alt':$(element).attr('title')});
             $('#pictureLoad img').fadeIn();
             $('#pictureLoadClose').fadeIn();
         }

         img.src=$(element).attr('href');
         
         return false;
  });
  
  $('#pictureLoadClose').click(function(){
      
      $('#pictureLoad img').fadeOut();
      $('#pictureLoadClose').fadeOut();
      return false;
  })
       
});
