$(document).ready(function() {
	// center block
	$(".center_block_next").click(function(){
       
	  var div     = $(this).parent().prev().find("div.scroll-text");
	   var top     = div.css("top").split("px")[0];
	   //var height  = div.parent().css("height").split("px")[0];
	    var height  = 250;
	   var count   = div.find("li").length;
	   //alert(div.parent().css("height"));
	   //alert(count);
	   if(height < (count * 25) )
	    if(parseInt(height)+Math.abs(top) < (count * 25) )
		  div.animate({"top":(parseInt(top)-25)+"px"}, 500 );	
	});
	$(".center_block_prev").click(function(){
       var div     = $(this).parent().prev().find("div.scroll-text");
	   var top     = div.css("top").split("px")[0];
	   var height  = 250;
	   var count   = div.find("li").length;
	   if(height < (count * 25) )
	    if(Math.abs(top) !=  top )
		  div.animate({"top":(parseInt(top)+25)+"px"}, 500 );				  
	});
	
	// film block
	$(".film_block_next").click(function(){
       var div     = $(this).parent().prev().find("div.scroll-film");
	   var right   = div.css("right").split("px")[0];
	   var width   = 716;
	   var count   = div.find("div").length;
	   if(count > 6)
	    if(Math.abs(right) < 738 )
		  div.animate({"right":(parseInt(right)-123)+"px"}, 500 );	
	});
    $(".film_block_prev").click(function(){
       var div     = $(this).parent().prev().find("div.scroll-film");
	   var right   = div.css("right").split("px")[0];
	   var width   = 716;
	   var count   = div.find("div").length;
	   if(count > 6)
	     if(Math.abs(right) !=  right )
		  div.animate({"right":(parseInt(right)+123)+"px"}, 500 );				  
	});
	/* $('#photos').galleryView({
			panel_width: 400,
			panel_height: 200,
			frame_width: 100,
			frame_height: 38,
			transition_speed: 1500,
			transition_interval : 9000,
			pause_on_hover : true,
			background_color: '#222',
			border: 'none',
			easing: 'easeInOutBack',
			pause_on_hover: true,
			overlay_height: 52,
			filmstrip_position: 'top',
			overlay_position: 'top'
	});*/
	$("#accordion").accordion();
	$("#centertab,#centertabthowe,#b-left").tabs();
	$(".panel img").show();
	$('#switcher').themeswitcher();
	/*$('#lang').change(function(){
		window.location  = '/'+$('#lang').val();
	});*/
    $(".fg-button,.button_div a").hover(function(){ $(this).addClass("ui-state-hover"); },function(){ $(this).removeClass("ui-state-hover"); })
		//png fix
		
	// lang 
	var lang_open_bol = false;
	$("#lang_open").click(function(){
		if (lang_open_bol) {
		    $("#lang-list").slideUp("normal");
		    lang_open_bol = false;
		}else{
		    $("#lang-list").slideDown("slow");
			lang_open_bol = true;
		}
	})
	$("#lang-list").hover(
		function(){},
		function(){if(lang_open_bol){$("#lang-list").slideUp("normal");lang_open_bol = false;}}
	);
	/*$("#lang_open").blur(function(){
		  $("#lang-list").slideUp("slow");
    })*/
	DD_belatedPNG.fix('.nav-prev,.nav-overlay,.nav-next,.png-fix');
});
