$(document).ready(function(){
	$('.img-gallery .gallery-preview ul').width($('.img-gallery .gallery-preview li').size()*160);
	$('.gallery-preview').jScrollPane({
			verticalDragMinHeight: 25,
			verticalDragMaxHeight: 25,
			horizontalDragMinWidth: 35,
			horizontalDragMaxWidth: 35
		});
	$('.img-gallery .fancy-view li').hide();
	$('.img-gallery .fancy-view li#gl1').show();
	$('.img-gallery .gallery-preview li a').click(function(){
		$('.img-gallery .fancy-view li').hide();
		$('.img-gallery .fancy-view li#'+$(this).attr('title')).show();
		
	});
	$('.fancy').fancybox({
		titlePosition:'inside',
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
	});
	
	if($('.tab-content').length){
		$('.tab-content').each(function(){
			$(this).find('ul').css('width', $(this).find('li').size()*719);
		});
		
		var i1=0;
		
		var siv1=setInterval(slider1, 4000);
		
		$('#sl1').slider({
			value:1,
			min: 1,
			max: $('.tab-content').eq(0).find('li').size(),
			step: 1,
			slide: function(event, ui) { 
				$('.tab-content').eq(0).find('ul').animate({marginLeft:-(ui.value-1)*719}, 200);
			}
		}).hover(function(){
			clearInterval (siv1);
		}, function(){
			siv1=setInterval(slider1, 4000);
		});
		

		
		
	}
	
	/*lang*/
	
	$('.fake-select-lang .option-list').hover(function(){
		/*nothing*/
	},function(){
		$(this).hide();
		$(this).parent().css('z-index', '1');
		$(this).parent().find('.option-list').css('z-index', 'auto');
	});
	
	$('.fake-select-lang .option').click(function(){
		$('.fake-select .option-list').hide().css('z-index', 'auto');
		$(this).parent().find('.option-list').show().css('z-index', '50');
		$(this).parent().css('z-index', '100');
	});
	
	/*lang*/
	
});

		var i1=0;


function slider1(){
	var s=$('.tab-content').eq(0).find('ul').css('margin-left').split('px');
	s=s[0];
	i1=((parseInt(s)/719)*-1)+1;
	if(i1>=$('.tab-content').eq(0).find('li').size()){
		$('#sl1').slider( "option", "value", 1);
		$('.tab-content').eq(0).find('ul').animate({marginLeft:0}, 200);
		i1=0;
	}else{	
		$('#sl1').slider( "option", "value", i1+1);
		$('.tab-content').eq(0).find('ul').animate({marginLeft:-i1*719}, 200);
	}
}



