		$(function(){
			$('#slider').anythingSlider({
				buildArrows         : false, 
				buildNavigation     : false,
				startStopped        : false,
				autoplay			: false,
				delay               : 6000,
				width               : 690,	
				height              : 290,
				animationTime       : 400
				
			});
		$("#opt1").click(function(){$('#slider').anythingSlider(1);});	
		$("#opt2").click(function(){$('#slider').anythingSlider(2);});	
		$("#opt3").click(function(){$('#slider').anythingSlider(3);});
		$("#opt4").click(function(){$('#slider').anythingSlider(4);});	
		$("#opt5").click(function(){$('#slider').anythingSlider(5);});	
		$("#opt6").click(function(){$('#slider').anythingSlider(6);});	
		$("#opt7").click(function(){$('#slider').anythingSlider(7);});	
		$("#opt8").click(function(){$('#slider').anythingSlider(8);});	
		$("#opt9").click(function(){$('#slider').anythingSlider(9);});
		$("#opt10").click(function(){$('#slider').anythingSlider(1);});	
		$("#opt11").click(function(){$('#slider').anythingSlider(2);});	
		$("#opt12").click(function(){$('#slider').anythingSlider(3);});	
		$("#opt13").click(function(){$('#slider').anythingSlider(4);});	
		$("#opt14").click(function(){$('#slider').anythingSlider(5);});	
		$("#opt15").click(function(){$('#slider').anythingSlider(6);});	
		$("#opt16").click(function(){$('#slider').anythingSlider(7);});		
		$("#opt17").click(function(){$('#slider').anythingSlider(8);});	
		$("#opt18").click(function(){$('#slider').anythingSlider(9);});	
		$("#optPrev").click(function(){$('#slider').data('AnythingSlider').goBack()});
		$("#optNext").click(function(){$('#slider').data('AnythingSlider').goForward()});	
			
		});

	currentMargin=0;
	isSliding=false;
	buttonDown=false;
	function beginSliding(pixels)
		{	
			therealmargin = document.getElementById("optDiv").style.marginLeft.match(/\d+/);
			if(therealmargin ==0 && pixels ==0){false; return}
			if(isSliding==false){isSliding=true; changeOpt(pixels);}
		}

	function horSliding(dir)
		{
			if(buttonDown == false)
			{
				buttonDown = true;
				setTimeout("buttonSliding(dir)", 20);
			}
		}
	function buttonSliding(dir)
		{
			if(isSliding==false)
			{
				therealmargin = document.getElementById("optDiv").style.marginLeft.match(/\d+/);
				g = 'unassigned';
				var current = $('#slider').data('AnythingSlider').currentPage;
				if(dir=='prev')
				{

					if(therealmargin == 0 		&& current == 1) {g = -1195}
					if(therealmargin == 185 	&& current == 2) {g = 0}
					if(therealmargin == 285 	&& current == 3) {g = -185}
					if(therealmargin == 440 	&& current == 4) {g = -285}
					if(therealmargin == 630 	&& current == 5) {g = -440}
					if(therealmargin == 750 	&& current == 6) {g = -630}
					if(therealmargin == 865 	&& current == 7) {g = -750}
					if(therealmargin == 1030 	&& current == 8) {g = -865}
					if(therealmargin == 1195 	&& current == 9) {g = -1030}

					if(therealmargin == 1345	&& current == 1) {g = -1195}
					if(therealmargin == 1530	&& current == 2) {g = -1345}
					if(therealmargin == 1630	&& current == 3) {g = -1530}
					if(therealmargin == 1785	&& current == 4) {g = -1630}
					if(therealmargin == 1975	&& current == 5) {g = -1795}
					if(therealmargin == 2095	&& current == 6) {g = -1975}
					if(therealmargin == 2210	&& current == 7) {g = -2095}
					if(therealmargin == 2375	&& current == 8) {g = -2210}
					if(therealmargin == 1195	&& current == 9) {g = -1030}
				}
				if(dir=='next')
				{
					if(therealmargin == 0 		&& current == 1) {g = -185}
					if(therealmargin == 185 	&& current == 2) {g = -285}
					if(therealmargin == 285 	&& current == 3) {g = -440}
					if(therealmargin == 440 	&& current == 4) {g = -630}
					if(therealmargin == 630 	&& current == 5) {g = -750}
					if(therealmargin == 750 	&& current == 6) {g = -865}
					if(therealmargin == 865 	&& current == 7) {g = -1030}
					if(therealmargin == 1030 	&& current == 8) {g = -1195}
					if(therealmargin == 1195 	&& current == 9) {g = -1345}

					if(therealmargin == 1345	&& current == 1) {g = -1530}
					if(therealmargin == 1530	&& current == 2) {g = -1630}
					if(therealmargin == 1630	&& current == 3) {g = -1785}
					if(therealmargin == 1785	&& current == 4) {g = -1975}
					if(therealmargin == 1975	&& current == 5) {g = -2095}
					if(therealmargin == 2095	&& current == 6) {g = -2210}
					if(therealmargin == 2210	&& current == 7) {g = -2375}
					if(therealmargin == 2375	&& current == 8) {g = -1195}
					if(therealmargin == 1195	&& current == 9) {g = -1345}
				}
				if(g!='unassigned')
				{
					document.getElementById("optDiv").style.marginLeft = g + 'px';
					currentmargin = g;
					pixels = g;
					buttonDown = false;
					changeOpt(pixels);
				}
			}
		}
	function loopdSliding(lpixels)
		{
			if(isSliding==false)
			{			
			beginSliding(lpixels);
			}
		}
	function doStuff(pixelz)
		{
			document.getElementById("optDiv").style.marginLeft = pixelz + 'px';
			clearTimeout(t);
		}
	function changeOpt(pixels) 
		{
		if (currentMargin == pixels)
			{
				clearTimeout(t);
				isSliding=false;
				return;	
			}
		else{	
			  if(currentMargin == 401){document.getElementById("optDiv").style.marginLeft = currentMargin + 'px';}
			  slideSpeed = 0;
			  slideDistance = currentMargin-pixels;
			  //alert(slideDistance);
			  slideSpeed = 2;
			  //alert(slideSpeed);
			  if(currentMargin>pixels){
				  distspeed = 10;
				  if(slideDistance > 200){distspeed =15; }
				  if(slideDistance > 400){distspeed =20; }
				  if(slideDistance > 600){distspeed =25; }
				  if(slideDistance > 800){distspeed =35; }
				  currentMargin -=distspeed;
				  
				  if(currentMargin<pixels) 
				  {
					  currentMargin = pixels;
					  }
			  }
			  if(currentMargin<pixels){
				  distspeed = 10;
				  if(slideDistance > 200){distspeed =15; }
				  if(slideDistance > 400){distspeed =20; }
				  if(slideDistance > 600){distspeed =25; }
				  if(slideDistance > 800){distspeed =35; }
				  currentMargin +=distspeed;
				  if(currentMargin>pixels) 
				  {
					  currentMargin = pixels;
					  }
			  }
			  document.getElementById("optDiv").style.marginLeft = currentMargin + 'px';
			  t = setTimeout("changeOpt("+pixels+");", slideSpeed); 
			}
		}
