$(document).ready(function() {
	
	//HORIZONTAL SCROLL BAR
  	$('div.sliderGallery').each(function () {
    	var ul = $('ul.items', this);
    	var productWidth = ul.innerWidth() - $(this).outerWidth();

    	var slider = $('.slider', this).slider({ 
      		handle: '.handle',
      		minValue: 0, 
      		maxValue: productWidth, 
      		slide: function (ev, ui) {
        		ul.css('left', '-' + ui.value + 'px');
        		eftpost = parseInt(ui.value);
        		backgroundAdjust(ui.value);
      		}, 
      		stop: function (ev, ui) {
        		ul.animate({ 'left' : '-' + ui.value + 'px' }, 200, 'linear');
        		backgroundAdjust(ui.value);
			}
    	});
  	});






  	//SLIDESHOW NAV - **PREVIOUS**
  	//previous slides in intervals of 780px exactly.
  	$("a.prevslide").bind("click", function() {
  		var leftpos = parseInt($("ul.items").css("left"));
  		$("span.navright").css("display","block");
 
  		if (leftpos >= -780 && leftpos <= 0) {
			$("ul.items").animate({left:"0"}, "fast");
			sliderAdjust(-780);
			$(this).children("span").css("display","none");
		}
		if (leftpos >= -1560 && leftpos <= -781) {
			$("ul.items").animate({left:"-780px"}, "fast");
			sliderAdjust(0);
		}
		//TRIPHARBOUR
		if (leftpos >= -2340 && leftpos <= -1561) {
			$("ul.items").animate({left:"-1560px"}, "fast");
			sliderAdjust(780);
		}
		if (leftpos >= -3120 && leftpos <= -2341) {
			$("ul.items").animate({left:"-2340px"}, "fast");
			sliderAdjust(1560);
		}
		if (leftpos >= -3900 && leftpos <= -3121) {
			$("ul.items").animate({left:"-3120px"}, "fast");
			sliderAdjust(2340);
		}
		if (leftpos >= -4680 && leftpos <= -3901) {
			$("ul.items").animate({left:"-3900px"}, "fast");
			sliderAdjust(3120);
		}
		//SPIRIT OF VANCOUVER
		if (leftpos >= -5460 && leftpos <= -4681) {
			$("ul.items").animate({left:"-4680px"}, "fast");
			sliderAdjust(3900);
		}
		if (leftpos >= -6240 && leftpos <= -5461) {
			$("ul.items").animate({left:"-5460px"}, "fast");
			sliderAdjust(4680);
		}
		if (leftpos >= -7020 && leftpos <= -6241) {
			$("ul.items").animate({left:"-6240px"}, "fast");
			sliderAdjust(5460);
		}
		if (leftpos >= -7800 && leftpos <= -7021) {
			$("ul.items").animate({left:"-7020px"}, "fast");
			sliderAdjust(6240);
		}
		//CTC
		if (leftpos >= -8580 && leftpos <= -7801) {
			$("ul.items").animate({left:"-7800px"}, "fast");
			sliderAdjust(7020);
		}
		if (leftpos >= -9360 && leftpos <= -8581) {
			$("ul.items").animate({left:"-8580px"}, "fast");
			sliderAdjust(7800);
		}
		if (leftpos >= -10140 && leftpos <= -9361) {
			$("ul.items").animate({left:"-9360px"}, "fast");
			sliderAdjust(8580);
		}
		if (leftpos >= -10920 && leftpos <= -10141) {
			$("ul.items").animate({left:"-10140px"}, "fast");
			sliderAdjust(9360);
		}
		if (leftpos >= -11700 && leftpos <= -10921) {
			$("ul.items").animate({left:"-10920px"}, "fast");
			sliderAdjust(10140);
		}
		if (leftpos >= -12480 && leftpos <= -11701) {
			$("ul.items").animate({left:"-11700px"}, "fast");
			sliderAdjust(10920);
		}
		if (leftpos >= -13260 && leftpos <= -12481) {
			$("ul.items").animate({left:"-12480px"}, "fast");
			sliderAdjust(11700);
		}
		//DREAMBANK
		if (leftpos >= -14040 && leftpos <= -13261) {
			$("ul.items").animate({left:"-13260px"}, "fast");
			sliderAdjust(12480);
		}
		if (leftpos >= -14820 && leftpos <= -14041) {
			$("ul.items").animate({left:"-14040px"}, "fast");
			sliderAdjust(13260);
		}
		if (leftpos >= -15600 && leftpos <= -14821) {
			$("ul.items").animate({left:"-14820px"}, "fast");
			sliderAdjust(14040);
		}
		if (leftpos >= -16380 && leftpos <= -15601) {
			$("ul.items").animate({left:"-15600px"}, "fast");
			sliderAdjust(14820);
		}
		//RICEWORKS
		if (leftpos >= -17160 && leftpos <= -16381) {
			$("ul.items").animate({left:"-16380px"}, "fast");
			sliderAdjust(15600);
		}
		if (leftpos >= -17940 && leftpos <= -17161) {
			$("ul.items").animate({left:"-17160px"}, "fast");
			sliderAdjust(16380);
		}
		if (leftpos >= -18720 && leftpos <= -17941) {
			$("ul.items").animate({left:"-17940px"}, "fast");
			sliderAdjust(17160);
		}
		if (leftpos >= -19500 && leftpos <= -18721) {
			$("ul.items").animate({left:"-18720px"}, "fast");
			sliderAdjust(17940);
		}
		//MUZI TEA
		if (leftpos >= -20280 && leftpos <= -19501) {
			$("ul.items").animate({left:"-19500px"}, "fast");
			sliderAdjust(18720);
		}
		if (leftpos >= -21060 && leftpos <= -20281) {
			$("ul.items").animate({left:"-20280px"}, "fast");
			sliderAdjust(19500);
		}
		if (leftpos >= -21840 && leftpos <= -21061) {
			$("ul.items").animate({left:"-21060px"}, "fast");
			sliderAdjust(20280);
		}
		if (leftpos >= -22620 && leftpos <= -21841) {
			$("ul.items").animate({left:"-21840px"}, "fast");
			sliderAdjust(21060);
		}
		//MOTIONBALL
		if (leftpos >= -23400 && leftpos <= -22621) {
			$("ul.items").animate({left:"-22620px"}, "fast");
			sliderAdjust(21840);
		}
		if (leftpos >= -24180 && leftpos <= -23401) {
			$("ul.items").animate({left:"-23400px"}, "fast");
			sliderAdjust(22620);
		}
		if (leftpos >= -24960 && leftpos <= -24181) {
			$("ul.items").animate({left:"-24180px"}, "fast");
			sliderAdjust(23400);
		}
		if (leftpos >= -25740 && leftpos <= -24961) {
			$("ul.items").animate({left:"-24960px"}, "fast");
			sliderAdjust(24180);
		}
		//CELEBRATION OF LIGHT
		if (leftpos >= -26520 && leftpos <= -25741) {
			$("ul.items").animate({left:"-25740px"}, "fast");
			sliderAdjust(24960);
		}
		if (leftpos >= -27300 && leftpos <= -26521) {
			$("ul.items").animate({left:"-26520px"}, "fast");
			sliderAdjust(25740);
		}
		if (leftpos >= -28080 && leftpos <= -27301) {
			$("ul.items").animate({left:"-27300px"}, "fast");
			sliderAdjust(26520);
		}
		if (leftpos >= -28860 && leftpos <= -28081) {
			$("ul.items").animate({left:"-28050px"}, "fast");
			sliderAdjust(27300);
		}
		backgroundAdjustBackward(leftpos);
		return false;
  	});






	//SLIDESHOW NAV - **NEXT**
  	//forwards slides in intervals of 780px exactly
	$("a.nextslide").bind("click", function() {
		var leftpos = parseInt($("ul.items").css("left"));
		//var ul_w = $("ul.items").width();
		var ul_w = parseInt($("#numofslides").attr("alt"))*780;
		//alert(ul_w);

		$("span.navleft").css("display","block");

		if (leftpos >= -779 && leftpos <= 0 && ul_w > 780) {
			$("ul.items").animate({left:"-780px"}, "fast");
			sliderAdjust(0);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -1559 && leftpos <= -780 && ul_w > 1560) {
			$("ul.items").animate({left:"-1560px"}, "fast");
			sliderAdjust(780);
			isMore(leftpos,ul_w);
		}
		//TRIPHARBOUR
		if (leftpos >= -2339 && leftpos <= -1560 && ul_w > 2340) {
			$("ul.items").animate({left:"-2340px"}, "fast");
			sliderAdjust(1560);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -3119 && leftpos <= -2340 && ul_w > 3120) {
			$("ul.items").animate({left:"-3120px"}, "fast");
			sliderAdjust(2340);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -3899 && leftpos <= -3120 && ul_w > 3900) {
			$("ul.items").animate({left:"-3900px"}, "fast");
			sliderAdjust(3120);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -4679 && leftpos <= -3900 && ul_w > 4680) {
			$("ul.items").animate({left:"-4680px"}, "fast");
			sliderAdjust(3900);
			isMore(leftpos,ul_w);
		}
		//SPRITOFVANCOUVER
		if (leftpos >= -5459 && leftpos <= -4680 && ul_w > 5460) {
			$("ul.items").animate({left:"-5460px"}, "fast");
			sliderAdjust(4680);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -6239 && leftpos <= -5460 && ul_w > 6240) {
			$("ul.items").animate({left:"-6240px"}, "fast");
			sliderAdjust(5460);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -7019 && leftpos <= -6240 && ul_w > 7020) {
			$("ul.items").animate({left:"-7020px"}, "fast");
			sliderAdjust(6240);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -7799 && leftpos <= -7020 && ul_w > 7800) {
			$("ul.items").animate({left:"-7800px"}, "fast");
			sliderAdjust(7020);
			isMore(leftpos,ul_w);
		}
		//CTC
		if (leftpos >= -8579 && leftpos <= -7800 && ul_w > 8580) {
			$("ul.items").animate({left:"-8580px"}, "fast");
			sliderAdjust(7800);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -9359 && leftpos <= -8580 && ul_w > 9360) {
			$("ul.items").animate({left:"-9360"}, "fast");
			sliderAdjust(8580);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -10139 && leftpos <= -9360 && ul_w > 10140) {
			$("ul.items").animate({left:"-10140"}, "fast");
			sliderAdjust(9360);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -10919 && leftpos <= -10140 && ul_w > 10920) {
			$("ul.items").animate({left:"-10920"}, "fast");
			sliderAdjust(10140);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -11699 && leftpos <= -10920 && ul_w > 11700) {
			$("ul.items").animate({left:"-11700"}, "fast");
			sliderAdjust(10920);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -12479 && leftpos <= -11700 && ul_w > 12480) {
			$("ul.items").animate({left:"-12480"}, "fast");
			sliderAdjust(11700);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -13259 && leftpos <= -12480 && ul_w > 13260) {
			$("ul.items").animate({left:"-13260"}, "fast");
			sliderAdjust(12480);
			isMore(leftpos,ul_w);
		}
		//DREAMBANK
		if (leftpos >= -14039 && leftpos <= -13260 && ul_w > 14040) {
			$("ul.items").animate({left:"-14040"}, "fast");
			sliderAdjust(13260);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -14819 && leftpos <= -14040 && ul_w > 14820) {
			$("ul.items").animate({left:"-14820"}, "fast");
			sliderAdjust(14040);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -15599 && leftpos <= -14820 && ul_w > 15600) {
			$("ul.items").animate({left:"-15600"}, "fast");
			sliderAdjust(14820);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -16379 && leftpos <= -15600 && ul_w > 16380) {
			$("ul.items").animate({left:"-16380"}, "fast");
			sliderAdjust(15600);
			isMore(leftpos,ul_w);
		}
		//RICEWORKS
		if (leftpos >= -17159 && leftpos <= -16380 && ul_w > 17160) {
			$("ul.items").animate({left:"-17160"}, "fast");
			sliderAdjust(16380);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -17939 && leftpos <= -17160 && ul_w > 17940) {
			$("ul.items").animate({left:"-17940"}, "fast");
			sliderAdjust(17160);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -18719 && leftpos <= -17940 && ul_w > 18720) {
			$("ul.items").animate({left:"-18720"}, "fast");
			sliderAdjust(17940);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -19499 && leftpos <= -18720 && ul_w > 19500) {
			$("ul.items").animate({left:"-19500"}, "fast");
			sliderAdjust(18720);
			isMore(leftpos,ul_w);
		}
		//MUZI TEA
		if (leftpos >= -20279 && leftpos <= -19500 && ul_w > 20280) {
			$("ul.items").animate({left:"-20280"}, "fast");
			sliderAdjust(19500);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -21059 && leftpos <= -20280 && ul_w > 21060) {
			$("ul.items").animate({left:"-21060"}, "fast");
			sliderAdjust(20280);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -21839 && leftpos <= -21060 && ul_w > 21840) {
			$("ul.items").animate({left:"-21840"}, "fast");
			sliderAdjust(21060);
			isMore(leftpos,ul_w);
		}
		//MOTIONABALL
		if (leftpos >= -22619 && leftpos <= -21840 && ul_w > 22620) {
			$("ul.items").animate({left:"-22620"}, "fast");
			sliderAdjust(21840);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -23399 && leftpos <= -22620 && ul_w > 23400) {
			$("ul.items").animate({left:"-23400"}, "fast");
			sliderAdjust(21840);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -24179 && leftpos <= -23400 && ul_w > 24180) {
			$("ul.items").animate({left:"-24180"}, "fast");
			sliderAdjust(20280);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -24959 && leftpos <= -24180 && ul_w > 24960) {
			$("ul.items").animate({left:"-24960"}, "fast");
			sliderAdjust(21060);
			isMore(leftpos,ul_w);
		}
		//CELEBRATION OF LIGHT
		if (leftpos >= -25739 && leftpos <= -24960 && ul_w > 25740) {
			$("ul.items").animate({left:"-25740"}, "fast");
			sliderAdjust(21840);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -26519 && leftpos <= -25740 && ul_w > 26520) {
			$("ul.items").animate({left:"-26520"}, "fast");
			sliderAdjust(22620);
			isMore(leftpos,ul_w);
		}
		
		if (leftpos >= -27299 && leftpos <= -26520 && ul_w > 27270) {
			$("ul.items").animate({left:"-27300"}, "fast");
			sliderAdjust(23400);
			isMore(leftpos,ul_w);
		}
		if (leftpos >= -28079 && leftpos <= -27300 && ul_w > 28050) {
			$("ul.items").animate({left:"-28080"}, "fast");
			sliderAdjust(24180);
			isMore(leftpos,ul_w);
		}
		backgroundAdjustForward(leftpos);
		return false;
		
	});
	
	function sliderAdjust(leftpos) {
		var viewingwidth = $("div.sliderGallery").width();
		//var gallerywidth = $("ul.items").width();
		var gallerywidth = parseInt($("#numofslides").attr("alt"))*780;
		var sliderwidth = $("div.slider").width();
		var handlewidth = $("div.handle").width();
		var leftpos = ((leftpos + viewingwidth) / (gallerywidth - viewingwidth)) * (sliderwidth - handlewidth) + "px";
		$("div.slider div.handle").animate({left: leftpos}, "fast");
	}
	
	function isMore(leftpos,ul_w) {
		leftpos = (leftpos * -1) + 1560;
		if (leftpos < ul_w) {
			$("span.navright").css("display","block");
		
		} else if (leftpos = ul_w) {
			$("span.navright").css("display","none");
		}
	}
	
	
	
	
	
	
	//BACKGROUND ADJUSTMENT 					**BACKWARD
	
	section = "nike";
	
	function backgroundAdjustBackward(leftpos) {
		var leftpos = leftpos + 780;
		//NIKE
		if (leftpos > -1559 && leftpos <= 0) {
			if (section != "nike") {
				$("body#work img#background").fadeOut("fast");
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_nike.jpg");
				$("body#work img#background").load(function() {
					$(this).fadeIn("fast");
				});
				section = "nike";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_nike.jpg");
			}
		}
		//TRIPHARBOUR
		if (leftpos > -4679 && leftpos <= -1560) {
			if (section != "tripharbour") {
				$("body#work img#background").fadeOut("fast");
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_cruise.jpg");
				$("body#work img#background").load(function() {
					$(this).fadeIn("fast");
				});
				section = "tripharbour";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_cruise.jpg");
			}
		}
		//SPRITOFVANCOUVER
		if (leftpos > -7799 && leftpos <= -4680) {
			if (section != "spiritofvancouver") {
				$("body#work img#background").fadeOut("fast");
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_social.jpg");
				$("body#work img#background").load(function() {
					$(this).fadeIn("fast");
				});
				section = "spiritofvancouver";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_social.jpg");
			}
		}
		//CTC
		if (leftpos > -13259 && leftpos <= -7800) {
			if (section != "ctc") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_trophycase.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "ctc";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_trophycase.jpg");
			}
		}
		//DREAMBANK
		if (leftpos > -16379 && leftpos <= -13260) {
			if (section != "dreambank") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_night.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "dreambank";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_night.jpg");
			}
		}
		//RICEWORKS
		if (leftpos > -19499 && leftpos <= -16380) {
			if (section != "riceworks") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_rice.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "riceworks";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_rice.jpg");
			}
		}
		//MUZI
		if (leftpos > -22589 && leftpos <= -19500) {
			if (section != "muzi") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_muzitea.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "muzi";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_muzitea.jpg");
			}
		}
		//MOTIONBALL
		if (leftpos > -25649  && leftpos <= -22620) {
			if (section != "motionball") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_motionball.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "motionball";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_motionball.jpg");
			}
		}
		//CELEBRATON OF LIGHT
		if (leftpos <= -25650) {
			if (section != "celebrationoflight") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_celebrationoflight.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "celebrationoflight";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_celebrationoflight.jpg");
			}
		}
	}






	//BACKGROUND ADJUSTMENT 					**FORWARD
	function backgroundAdjustForward(leftpos) {
		var leftpos = leftpos - 780;
		//NIKE
		if (leftpos > -1559 && leftpos <= 0) {
			if (section != "nike") {
				$("body#work img#background").fadeOut("fast");
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_nike.jpg");
				$("body#work img#background").load(function() {
					$(this).fadeIn("fast");
				});
				section = "nike";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_nike.jpg");
			}
		}
		//TRIPHARBOUR
		if (leftpos > -4679 && leftpos <= -1560) {
			if (section != "tripharbour") {
				$("body#work img#background").fadeOut("fast");
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_cruise.jpg");
				$("body#work img#background").load(function() {
					$(this).fadeIn("fast");
				});
				section = "tripharbour";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_cruise.jpg");
			}
		}
		//SPRITOFVANCOUVER
		if (leftpos > -7799 && leftpos <= -4680) {
			if (section != "spiritofvancouver") {
				$("body#work img#background").fadeOut("fast");
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_social.jpg");
				$("body#work img#background").load(function() {
					$(this).fadeIn("fast");
				});
				section = "spiritofvancouver";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_social.jpg");
			}
		}
		//CTC
		if (leftpos > -13259 && leftpos <= -7800) {
			if (section != "hostingbc") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_trophycase.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "hostingbc";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_trophycase.jpg");
			}
		}
		//DREAMBANK
		if (leftpos > -16379 && leftpos <= -13260) {
			if (section != "dreambank") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_night.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "dreambank";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_night.jpg");
			}
		}
		//RICEWORKS
		if (leftpos > -19499 && leftpos <= -16380) {
			if (section != "riceworks") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_rice.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "riceworks";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_rice.jpg");
			}
		}
		//MUZI
		if (leftpos > -22619 && leftpos <= -19500) {
			if (section != "muzi") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_muzitea.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "muzi";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_muzitea.jpg");
			}
		}
		//MOTIONBALL
		if (leftpos > -25739 && leftpos <= -22620) {
			if (section != "motionball") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_motionball.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "motionball";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_motionball.jpg");
			}
		}
		//CELEBRATION OF LIGHT
		if (leftpos <= -25740) {
			if (section != "celebrationoflight") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_celebrationoflight.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "celebrationoflight";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_celebrationoflight.jpg");
			}
		}
	}
	
	
	
	
	
	
	//BACKGROUND ADJUSTMENT 					**CLICK ANYWHERE ON SLIDER
	function backgroundAdjust(leftpos) {
		var leftpos = "-" + leftpos;
		//TRIPHARBOUR
		if (leftpos > -3119 && leftpos <= 0) {
			if (section != "tripharbour") {
				$("body#work img#background").fadeOut("fast");
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_cruise.jpg");
				$("body#work img#background").load(function() {
					$(this).fadeIn("fast");
				});
				section = "tripharbour";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_cruise.jpg");
			}
		}
		//SPRITOFVANCOUVER
		if (leftpos > -6239 && leftpos <= -3120) {
			if (section != "spiritofvancouver") {
				$("body#work img#background").fadeOut("fast");
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_social.jpg");
				$("body#work img#background").load(function() {
					$(this).fadeIn("fast");
				});
				section = "spiritofvancouver";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_social.jpg");
			}
		}
		//CTC
		if (leftpos > -11699 && leftpos <= -6240) {
			if (section != "hostingbc") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_trophycase.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "hostingbc";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_trophycase.jpg");
			}
		}
		//DREAMBANK
		if (leftpos > -14819 && leftpos <= -11700) {
			if (section != "dreambank") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_night.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "dreambank";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_night.jpg");
			}
		}
		//RICEWORKS
		if (leftpos > -17939 && leftpos <= -14820) {
			if (section != "riceworks") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_rice.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "riceworks";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_rice.jpg");
			}
		}
		//MUZI
		if (leftpos <= -17940) {
			if (section != "muzi") {
					$("body#work img#background").fadeOut("fast");
					$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_muzitea.jpg");
					$("body#work img#background").load(function() {
						$(this).fadeIn("fast");
					});
					section = "muzi";
			} else {
				$("body#work img#background").attr("src","/wp-content/themes/default/images/bg_muzitea.jpg");
			}
		}
	}
	
	$("div#work_list ul li div.project_info h2").each(function() {
		var expand = "";
		$(this).click(function() {
			if (expand == false || expand == "") {
				$(this).css("backgroundPosition","right 0");
				$(this).parent().animate({width:"780px"}, "slow");
				$(this).next("div").fadeIn("slow");
				expand = true;
			} else {
				$(this).css("backgroundPosition","0 0");
				$(this).next("div").fadeOut("fast");
				$(this).parent().animate({width:"79px"}, "slow");
				expand = false;
			}
		})
	});
	
});

/*
7800
8580
9360
10140
10920
11700
12480
13260
14040
14820
15600
16380
17160
17940
18720
19500
20280
21060
21840
*/