$(document).ready(function(){
		
  $('.slide') .css({'height': 1200});
  $('.content-frame') .css({'height': 1200});
  $('.content-frame-fifth') .css({'height': 1200});
		
  $("#content-slider").slider({
    animate: true,
    change: handleSliderChange,
    slide: handleSliderSlide
  });
  
  $("#content-slider2").slider({
    animate: true,
    change: handleSliderChange2,
    slide: handleSliderSlide2
  });
  
  $('ul.scrollmenu a').click(function(){setScrollPosition($(this).attr('href'), this);return false});
  
  //$("div.content-frame").vAlign("div");
});

function handleSliderChange(e, ui)
{
  var maxScroll = $("#content-scroll").attr("scrollWidth") - $("#content-scroll").width();
  $("#content-scroll").animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000);
}

function handleSliderSlide(e, ui)
{
  var maxScroll = $("#content-scroll").attr("scrollWidth") - $("#content-scroll").width();
  $("#content-scroll").attr({scrollLeft: ui.value * (maxScroll / 100) });
}


function handleSliderChange2(e, ui)
{
  var maxScroll = $("#content-scroll2").attr("scrollWidth") - $("#content-scroll2").width();
  $("#content-scroll2").animate({scrollLeft: ui.value * (maxScroll / 100) }, 1000);
}

function handleSliderSlide2(e, ui)
{
  var maxScroll = $("#content-scroll2").attr("scrollWidth") - $("#content-scroll2").width();
  $("#content-scroll2").attr({scrollLeft: ui.value * (maxScroll / 100) });
}

function goToByScroll(id){
			$('html,body').animate({scrollTop: $("."+id).offset().top},'slow');
}

function setScrollPosition(n, element){
	n = n.substr(1);
	var id = element.parentNode.parentNode.parentNode.id;
	switch(n){
		case 'craig':
			positionHandle(0, id);
		break;
		case 'jessica':
			positionHandle(33.5, id);
		break;
		case 'rachel':
			positionHandle(67, id);
		break;
		case 'doug':
			positionHandle(100, id);
		break;
		
		case 'banksimple':
			positionHandle(0, id);
		break;
		case 'groundcrew':
			positionHandle(20, id);
		break;
		case 'profounder':
			positionHandle(40, id);
		break;
		case 'mindsnacks':
			positionHandle(60, id);
		break;
		case 'gobble':
			positionHandle(80, id);
		break;
	}
}

function positionHandle(n, id){
	//$('#'+id+' .ui-slider-handle').css('left', n);
	$('#'+id+' .ui-slider').slider('value', n);
}

/*$(function()
{
        $('.slide') .css({'height': 1200});
        $('.content-frame') .css({'height': 1200});
        $('.content-frame-fifth') .css({'height': 1200});
});*/

