/*			Полоса прокрутки
 * 
 * 
 *$(function() {
		//scrollpane parts
		var scrollPane = $('.scroll-pane');
		var scrollContent = $('.scroll-content');
		
		//build slider
		var scrollbar = $(".scroll-bar").slider({
			orientation: 'vertical',
			slide:function(e, ui){
				if( scrollContent.height() > scrollPane.height() ){ scrollContent.css('margin-top', ( 0 - 149 - Math.round( ui.value / 100 * ( scrollPane.height() - scrollContent.height() )) ) + 'px'); }
				else { scrollContent.css('margin-top', 0); }
			}
		});
		
		//append icon to handle
		var handleHelper = scrollbar.find('.ui-slider-handle')
		.mousedown(function(){
			scrollbar.height( '100%' );
			
		})
		.mouseup(function(){
			scrollbar.height( '100%' );
		})
		.append('<span class="ui-icon ui-icon-grip-dotted-horizontal"></span>')
		.wrap('<div class="ui-handle-helper-parent"></div>').parent();
		
		//change overflow to hidden now that slider handles the scrolling
		scrollPane.css('overflow','hidden');
		
		//size scrollbar and handle proportionally to scroll distance
		function sizeScrollbar(){
			var remainder = scrollContent.height() - scrollPane.height();
			var proportion = remainder / scrollContent.height();
			//var handleSize = ( scrollPane.height() - (proportion * scrollPane.height()) )/4;
			var handleSize = 14;
			scrollbar.find('.ui-slider-handle').css({
				height: handleSize,
				'margin-bottom': handleSize/2
			});
			handleHelper.height('').height( scrollbar.height() - handleSize - 4);
			//handleHelper.height('').height( scrollbar.height() );
		}
		
		//reset slider value based on scroll content position
		function resetValue(){
			var remainder = scrollPane.height() - scrollContent.height();
			var topVal = scrollContent.css('margin-top') == 'auto' ? 0 : parseInt(scrollContent.css('margin-top'));
			var percentage = Math.round(topVal / remainder * 100);
			scrollbar.slider("value", percentage);
		}
		
		//if the slider is 100% and window gets larger, reveal content
		function reflowContent(){
				var showing = scrollContent.height() + parseInt( scrollContent.css('margin-top') );
				var gap = scrollPane.height() - showing;
				if(gap > 0){
					scrollContent.css('margin-top', parseInt( scrollContent.css('margin-top') ) + gap);
				}
		}
		
		$('.ui-slider-handle').css('bottom', '100%');
		//$('.ui-handle-helper-parent').css('height', '336px');
		
		//change handle position on window resize
		/*$(window)
		.resize(function(){
				resetValue();
				sizeScrollbar();
				reflowContent();
		});*//*
		//init scrollbar size
		setTimeout(sizeScrollbar,10);//safari wants a timeout
	});
*/
