$(document).ready(function(){

	$('.taburi_cont ul').superSimpleTabs();	
	$(".input-field input").defaultValues();


		//scrollpane parts
		var scrollPane = $('.scroll-pane');
		var scrollContent = $('.scroll-content');
		
		//build slider
		var scrollbar = $(".scroll-bar").slider({
			slide:function(e, ui){
				if( scrollContent.width() > scrollPane.width() ){
					scrollContent.css('margin-left', Math.round( ui.value / 100 * ( 950 - scrollContent.width() )) + 'px');
					}
				else { 
					scrollContent.css('margin-left', 0); 
					}
			}
		});
		
		//append icon to handle
		var handleHelper = scrollbar.find('.ui-slider-handle')
		.mousedown(function(){
			scrollbar.width( handleHelper.width() );
		})
		.mouseup(function(){
			scrollbar.width( '100%' );
		})
		.append('<span class="ui-icon ui-icon-grip-dotted-vertical"></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.width() - scrollPane.width();
			var proportion = remainder / scrollContent.width();
			var handleSize = 62;
			scrollbar.find('.ui-slider-handle').css({
				width: handleSize,
				'margin-left': -handleSize/2
			});
			handleHelper.width('').width( 500 - 62);
		}
		


		//scrollpane parts
		var scrollPaneVizionate = $('.scroll-pane-vizionate');
		var scrollContentVizionate = $('.scroll-content-vizionate');
		
		//build slider
		var scrollbarVizionate = $(".scroll-bar-vizionate").slider({
			slide:function(e, ui){
				if( scrollContentVizionate.width() > scrollPaneVizionate.width() ){ scrollContentVizionate.css('margin-left', Math.round( ui.value / 100 * ( 950 - scrollContentVizionate.width() )) + 'px'); }
				else { scrollContentVizionate.css('margin-left', 0); }
			}
		});
		
		//append icon to handle
		var handleHelperVizionate = scrollbarVizionate.find('.ui-slider-handle')
		.mousedown(function(){
			scrollbarVizionate.width( handleHelperVizionate.width() );
		})
		.mouseup(function(){
			scrollbarVizionate.width( '100%' );
		})
		.append('<span class="ui-icon ui-icon-grip-dotted-vertical"></span>')
		.wrap('<div class="ui-handle-helper-parent"></div>').parent();
		
		//change overflow to hidden now that slider handles the scrolling
		scrollPaneVizionate.css('overflow','hidden');



		//size scrollbar and handle proportionally to scroll distance
		function sizeScrollbarVizionate(){
			var remainder = scrollContentVizionate.width() - scrollPaneVizionate.width();
			var proportion = remainder / scrollContentVizionate.width();
			var handleSize = 62;
			scrollbarVizionate.find('.ui-slider-handle').css({
				width: handleSize,
				'margin-left': -handleSize/2
			});
			handleHelperVizionate.width('').width( 500 - 62);
//			handleHelperVizionate.width(100);
		}
		

		

		//init scrollbar size
		setTimeout(sizeScrollbar,10);//safari wants a timeout
		setTimeout(sizeScrollbarVizionate,10);//safari wants a timeout







});


