			/*
				SLIDING PANELS SCRIPT
				---------------------
				Author:			samhs
				Email:			sam@hampton-smith.com
				Client:			Strutt Couture
				---------------------
				Script loads number of panels specified 
				and automatically cycles between showing 
				these panels by changing the width of a 
				container with overflow set to hidden.
				
				Once user mouses over panels area, auto sliding
				is disabled and the panel the user moves over
				expands, reducing all other panels to smallsize.
				
				Panel content is loaded from external files in
				format "panel[n].html" where [n] represents an
				integer within the range specified by numberofpanels.
				
			
			*/

			// Configurable settings
			var panelwidth = 900; // width in pixels of overall container
			var numberofpanels = 5; // number of panels to load
			var smallsize = 20; // width in pixels of collapsed panel
			var panelspacing = 3; // spacing in pixels between panels
			var transition = 1000; // time in milliseconds that slide takes
			var autotimer = 8000; // time in milliseconds between auto slides
			var container = "#contentinner";
			
			
			// Utility variables - do not alter
			var largesize = panelwidth-((numberofpanels-1)*(smallsize+panelspacing));
			var currentpanel;
			var goforward = true;
			var t;
			$(document).ready(function(){
			   for (var i=1;i<=numberofpanels;i++) {
				   $(container).append("<div class='panelwrappers' id='panelwrapper"+i+"'><div class='spanel'></div></div>");
				   $("#panelwrapper"+i+" .spanel").load("panel"+i+".html");
			   }
			   currentpanel = $(".panelwrappers:first");
			   $(currentpanel).css("width",largesize+"px");
			   $(".panelwrappers").not(":last").css("margin-right",panelspacing+"px");
				$(".panelwrappers").each(function(n){
					$(this).mouseover(function(){switchpanel(this);});	
				});
				t = setTimeout("switchpanel(null);",autotimer);
			});
			function switchpanel(newpanel) {
				if (newpanel==currentpanel) {
					// do nothing because we're already on this panel
				} else {
					var auto = false;
					if (newpanel==null) {
						auto = true;
						if (goforward && parseInt($(currentpanel).attr("id").replace(/panelwrapper/,""))==numberofpanels) {
							goforward=false;
						}
						if (!goforward && parseInt($(currentpanel).attr("id").replace(/panelwrapper/,""))==1) {
							goforward=true;
						}						
						if (goforward) {
							newpanel = $(currentpanel).next();
						} else {
							newpanel = $(currentpanel).prev();
						}							
					}
					else {
						$(".panelwrappers").stop();
						clearTimeout(t);
					}
					$(".iefixer").remove();
					$(".panelwrappers").not(newpanel).animate({width: smallsize+"px"},transition, "swing");
					$(newpanel).animate({width: largesize+"px"},transition, "swing");				
					currentpanel = newpanel;
					if (auto) t = setTimeout("switchpanel(null);",autotimer); 
				}
			}