function formatTitle(title, currentArray, currentIndex, currentOpts) {
	var button_prev = '<a href="javascript:;" onclick="$.fancybox.prev();" class="browse prev">Prev</a>';		
	var button_next = '<a href="javascript:;" onclick="$.fancybox.next();" class="browse next">Next</a>';
	
    return '<div id="fancy-title">'+button_prev+'<div class="numbers">' + (currentIndex + 1) + ' / ' + currentArray.length + '</div>'+button_next+'<a href="javascript:;" onclick="$.fancybox.close();" class="close"><span>'+close_text+'</span></a></div>';
}

$(function(){
	$('#slider').flash({
		swf: '/wp-content/themes/refkliima/flash/cu3er.swf',
		width: 885,
		height: 250,
		flashvars: {
			xml: '/wp-content/themes/refkliima/flash/config_'+icl_lang+'.xml',
			font: '/wp-content/themes/refkliima/flash/font.swf'
		}
	});
	
	$('#text a[rel=gallery]').fancybox({
		padding: 10,
		overlayOpacity: 0.65,
		overlayColor: '#000',
		cyclic: true,
		showNavArrows: false,
		showCloseButton: false,
		titlePosition: 'inside',
		titleFormat: formatTitle,
		onStart: function(){
			_gaq.push(['_trackEvent', 'Gallery', 'Big image', $('#text h1').eq(0).text()]);
		}		
	});
	
	$('#text ul.clients li').each(function(i){
		if(i%3 == 0 && i != 0)
			$(this).css('clear', 'both');
	});
});
