
$(document).ready(function(){ 

	$("a[class='play']").prettyPhoto({ social_tools: "", callback: function(){ $("#header-slider").scrollable().begin(200); } });
});



// =============
// = Main menu =
// =============
$(document).ready(function(){
	$("#menu-main>li, #menu-references>li").mouseover(function(){  
		$(this).children(".submenu").fadeIn(100);
	}); 
	
	$("#menu-main>li, #menu-references>li").mouseleave	(function(){
		$(".submenu").fadeOut(100);
	});	
});  


// =====================
// = Header scrollable =
// =====================
$(document).ready(function(){
	$("#header-slider").scrollable({'speed' : 700, 'touch' : true, 'circular' : true }).autoscroll({ autoplay: true, interval : 8000 });
}); 

// ====================
// = Boxes scrollable =
// ====================
$(document).ready(function(){ 
	$.easing.custom = function (x, t, b, c, d) {
		var s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	}
	$("#boxes-slider").scrollable({
		'circular' : true, 
		'touch' : false,
		'onBeforeSeek' : function(){
			$("#boxes-slider-navigation").fadeOut(100);
		},
		'onSeek' : function(){
			$("#boxes-slider-navigation").fadeIn(300);
		},
		'keyboard' : false
  });     


	$(".box-content-slider").scrollable({ 'touch' : false,  prev : ".prev01", next : ".next01", circular: true }).navigator();
});


// ============
// = Box news =
// ============
$(document).ready(function(){
	$("#box02-references .news li[class!=archive]").click(function(){
		$(this).siblings("li[class!=archive]").attr("class", "");
		$(this).attr("class", "active");
	});
}); 

// ==============
// = References =
// ==============
            
$(document).ready(function(){ 
	$("#slider-clients-about-us").scrollable({ 'touch' : false, vertical:true,  prev : ".prev01", next : ".next01", circular: false }).navigator();
	// $("#slider-clients-about-us").scrollable();
});


// ==============
// = Fix layout =
// ==============
// $(document).ready(function(){
// 	var h = $("#column-right").height() - 98;
// 	$(".box06>.content").css("height", h);
// });  
     


   

$(document).ready(function(){ 
	var el = new Array();
	$(".references>li").each(function(){
		el[$(this).attr("id")] = $(this).children(".image").scrollable({ 'speed':1, 'touch' : false,  prev : ".prev01", next : ".next01", circular: true}).autoscroll({ autoplay: false, interval : 700 });

	}); 
	
	
	// window.api = root.data("scrollable");

	$(".references>li").mouseover(function(){ 
		window.api = el[$(this).attr("id")].data("scrollable");
		api.play();
	});
	             
	$(".references>li").mouseleave(function(){
		window.api = el[$(this).attr("id")].data("scrollable"); 
		api.stop();
	  el[$(this).attr("id")].scrollable().begin(1);   
	});
	
	// References
	
	$(".gallery_slider>.items>div>img").click(function(e){ 
		e.preventDefault();
		if($(this).attr("lang") == "video"){ 
					var str = '<iframe title="YouTube video player" width="620" height="495" src="'+$(this).attr("id")+'" frameborder="0" allowfullscreen></iframe>' 
		} 
		else{
					var str = '<a rel="popout" href="'+$(this).attr("class")+'"><img src="'+$(this).attr("id")+'" alt="" /></a>' 
		}

		$(".picture").html(str); 
		$("a[rel^='popout']").prettyPhoto({animation_speed:'normal',  social_tools: "" });
	}); 
	$("a[rel^='popout']").prettyPhoto({animation_speed:'normal',  social_tools: "" });
	
	$(".gallery_slider").scrollable({'touch' : false,  prev : ".prev01", next : ".next01", circular: false }).navigator(); 
	
	
	
	
 
  $jScroller.add("#box1_container","#box1","up",1,200); 
	$jScroller.start();

    
	// $.getJSON("http://twitter.com/statuses/user_timeline/poslovnavizija.json?callback=?", function(data) { 
	// 	var str = "";
	// 	str += data[0].text;
	// 	
	//      $("#box05-social > .content > .tweet").html(data[0].text);
	// }); 


});


