
var animationTime=200;
$(document).ready(function(){
	
	//lightBox
	$('a.lb').lightBox({
			overlayBgColor: '#99ccff',
			overlayOpacity: 0.6,
			imageLoading: './i/loading.gif',
			imageBtnClose: './i/lightbox-btn-close.gif',
			imageBtnPrev: './i/lightbox-btn-prev.gif',
			imageBtnNext: './i/lightbox-btn-next.gif',
			containerResizeSpeed: animationTime,
			txtImage: 'Image',
			txtOf: 'of'
	   });
	
	//call togle news
	$(".head-line").click(function(){
			togleNews(this);
			return false;
		});
	
	//function togle nav
	function togleNews(o){
		if($(o).next().length){
			$(o).next().slideToggle(animationTime);
			$(o).children('a').toggleClass("expanded").toggleClass("collapsed");
		}
	};
	
	//nava
	$(".nav ul li").hover(
	  function() {
	  	$(this).addClass("active"); 
		$(this).children('ul').slideDown("fast");
		},
	  function() { 
	  		var o = this
			setTimeout(function(){
				$(o).removeClass("active");
			}, animationTime/2);
			$(o).children('ul').fadeOut("fast");
		});
		
	$("#default-usage-select").selectbox();	
	
	
	//projektaz
		$('.front-slider a.prev').css({opacity:'0.5',cursor:'default'});
		var projektaz = $('.front-slider ul li').length;
		$('.front-slider ul').width(projektaz*860);
		$('.front-slider').serialScroll({
			target:'.slider-content',
			items:'li',
			prev:'a.prev',
			next:'a.next',
			offset:0, //when scrolling to photo, stop 230 before reaching it (from the left)
			start:0, //as we are centering it, start at the 2nd
			duration:600,
			force:true,
			interval:14400,
			stop:true,
			lock:false,
			cycle:true, //don't pull back once you reach the end
			//easing:'easeOutQuart', //use this easing equation for a funny effect
			jump: false, //click on the images to scroll to them
			onBefore:function( e, elem, $pane, $items, pos ){
				if (pos+2>projektaz) {
						$('.front-slider a.next').css({opacity:'0.5',cursor:'default'});
					}else{
						$('.front-slider a.next').css({opacity:'1',cursor:'hand'}).css({cursor:'pointer'});
					}
				if (pos<1) {
						$('.front-slider a.prev').css({opacity:'0.5',cursor:'default'});
					}else{
						$('.front-slider a.prev').css({opacity:'1',cursor:'hand'}).css({cursor:'pointer'});
					}
			},
			onAfter:function( elem ){}
		});
	
	
});
