
function slider(id, theArray, min, numberOfSteps, type, modifier, precision, suffix) {
				this.id = id;
				this.minX = parseInt((getWindowWidth() / 2) + 196);
				this.sliderWidth = 208;
				this.offsetX = 13;

				//this.steps = new Array(1,2,4,8,16,32,64,128,256,512,1024,2048,4096);
				if(theArray)
				{
					this.steps = theArray;
				}
				else
				{
					this.steps = new Array();
					var temp;
					for(var i=0; i<(numberOfSteps + 1); i++)
					{
						if(type == "lin")
						{
							if(i!=(numberOfSteps-1))
								this.steps[i] = "" + (min + modifier * i) + " " + suffix;
							else
								this.steps[i] = ">" + (min + modifier * i) + " " + suffix;
						}
						if(type == "exp")
						{
							if(i==0)
								temp = this.steps[0] = min;
							else
							{
								temp = (temp * modifier) ;

								this.steps[i] = parseInt((temp) / precision) * precision; 
							}
						}
					}
				}

				this.minIndex = 0;
				this.maxIndex = this.steps.length-1;
				this.stepPercent = 100 / (this.steps.length-1);
				this.stepWidth = (this.sliderWidth - this.minX) / this.steps.length;
				
				this.elm = document.getElementById("slider" + id);
				
				this.elmMinInput = this.elm.getElementsByTagName("input")[0];
				this.elmMaxInput = this.elm.getElementsByTagName("input")[1];
				this.elmMinHandle = this.elm.getElementsByTagName("div")[3];
				this.elmMaxHandle = this.elm.getElementsByTagName("div")[4];
				this.coverMin = this.elm.getElementsByTagName("div")[1];
				this.coverMax = this.elm.getElementsByTagName("div")[2];

				this.startPos = 0;
				this.startMousePos = 0;				
				
				function init()
				{
					this.elmMinInput.value = this.steps[0];
					this.elmMaxInput.value = this.steps[this.steps.length-2];
				}
				
				function refreshValues()
				{
				}
				
				
				function startDrag(minmax)
				{
					if (!dragTimer) {

						this.startMousePos = mousePosX;
						globalObject = this;
						if (minmax == "min")
						{
							dragTimer = setInterval("globalObject.draggingMin()",50);
							this.startPos = this.elmMinInput.value * (this.sliderWidth / this.max);						
						}
						else
						{
							dragTimer = setInterval("globalObject.draggingMax()",50);
							
							this.startPos = this.startMousePos;
						}
						
						
						
					}
				}
			

				function draggingMin()
				{
					//tempValue = parseInt(((parseInt(this.startPos) + mousePosX - this.startMousePos) / this.sliderWidth) * this.max);
					percent = ((mousePosX - this.minX) / this.sliderWidth) * 100;
					newIndex = Math.round( percent / this.stepPercent );

					if (newIndex <= 0)
					{
						newIndex = 0;
					}
					if (newIndex >= this.maxIndex)
					{
						newIndex = (this.maxIndex - 1);
					}
					this.minIndex = newIndex;
					newSliderPos = Math.round( ( newIndex / (this.steps.length - 1) ) * (this.sliderWidth) ) - 3;
					
					/*if (newIndex == 0)
						this.elmMinInput.value = "";
					else*/
						this.elmMinInput.value = this.steps[newIndex];
						
					this.elmMinHandle.style.left = newSliderPos + this.offsetX - 4  + "px";
					this.coverMin.style.width = Math.abs(newSliderPos + this.offsetX + 2) + "px";
					

				}


				function draggingMax()
				{
					//tempValue = parseInt(((parseInt(this.startPos) + mousePosX - this.startMousePos) / this.sliderWidth) * this.max);
					percent = ((mousePosX - this.offsetX - this.minX) / this.sliderWidth) * 100;
					newIndex = Math.round( percent / this.stepPercent );

					if (newIndex <= this.minIndex)
					{
						newIndex = this.minIndex + 1;
					}
					if (newIndex >= this.steps.length )
					{
						newIndex = (this.steps.length - 1);
					}
					this.maxIndex = newIndex;

					newSliderPos = Math.round( ( newIndex / (this.steps.length - 1) ) * (this.sliderWidth) ) + 3;
					
					/*if (newIndex == parseInt(this.steps.length-1))
						this.elmMaxInput.value = "";
					else*/
						this.elmMaxInput.value = this.steps[newIndex-1];
						
					this.elmMaxHandle.style.left = newSliderPos + this.offsetX  + 4 + "px";
					this.coverMax.style.width = Math.abs(this.sliderWidth - newSliderPos + this.offsetX + 5) + "px";
				}
				
				function updateMin()
				{
					var newIndex = 0;
					if(this.elmMinInput.value)
					{
						for (var i=0; i<this.steps.length-1; i++)
						{
							if(parseInt(this.elmMinInput.value.replace(/ /g,'').replace(/>/,"")) > parseInt(("" + this.steps[i]).replace(/ /g,'').replace(/>/,"")) )
							{
								if((""+this.elmMinInput.value).indexOf(">")!=-1)
									newIndex = this.steps.length-2;
								else
									newIndex = i + 1;
							}
						}
					}
					
					newSliderPos = Math.round( ( newIndex / (this.steps.length - 1) ) * (this.sliderWidth) ) - 3;
					this.elmMinHandle.style.left = newSliderPos + this.offsetX - 4  + "px";
					this.coverMin.style.width = Math.abs(newSliderPos + this.offsetX + 2) + "px";
				}
				
				function updateMax()
				{
					var newIndex = this.steps.length-1;//this.elmMaxInput.value;
					if(this.elmMaxInput.value)
					{
						for (var i=this.steps.length-1; i>=0; i--)
						{
							if(parseInt(("" + this.steps[i]).replace(/ /g,'')) >= parseInt(this.elmMaxInput.value.replace(/ /g,'')))
							{
								newIndex = i;
							}
						}
					}
					if(newIndex < (this.steps.length-1))
					newIndex++
					var newSliderPos = Math.round( ( newIndex / (this.steps.length - 1) ) * (this.sliderWidth) ) + 3;
					this.elmMaxHandle.style.left = newSliderPos + this.offsetX  + 4 + "px";
					this.coverMax.style.width = Math.abs(this.sliderWidth - newSliderPos + this.offsetX + 5) + "px";
					
				}
				
				function resetSliders() {
					this.elm.getElementsByTagName("input")[0].value = this.steps[0];
					this.elm.getElementsByTagName("input")[1].value = this.steps[this.steps.length-2];
				}
				
				this.init = init;
				this.stopDrag = stopDrag;
				this.startDrag = startDrag;
				this.draggingMin = draggingMin;
				this.draggingMax = draggingMax;
				this.updateMin = updateMin;
				this.updateMax = updateMax;
				this.resetSliders = resetSliders;
				
				this.init();
				refreshValues();
			}
			

			
			
			
			var sliderMax = 8;
			
			var mousePosX = 0;
			function getMouseXY(e) {
				var elmSearchArea = document.getElementById("searchArea");
				if (elmSearchArea.className == "advancedSearchOpen")
				{
					if (!e) var e = window.event;
					if (e.pageX || e.pageY)
					{
						mousePosX = e.pageX;
					}
					else if (e.clientX || e.clientY)
					{
						mousePosX = e.clientX + document.body.scrollLeft;
					}
				}
				
			}
			
			function stopDrag()
			{
				if (dragTimer)
				{
					clearTimeout(dragTimer);
					dragTimer = false;
					updateGlobalCommandObject();
				}
			}
			
			
			var dragTimer = false;
			
			
		
			
			
			var globalObject;
			var slider1;
			var slider2;
			var slider3;
			onload = function initSliders()
			{
				//slider1 = new slider(1,false,1,9,"lin",1);
				//slider2 = new slider(2,false,20,10,"lin",20);
				//slider3 = new slider(3,false,50000,100,"exp",1.05,10000);
				slider1 = new slider(1,new Array("1 rum","2 rum","3 rum","4 rum","5 rum","6 rum","7 rum","8 rum",">8 rum","9"));
				slider2 = new slider(2,false,0,31,"lin",10,10,"kvm");
				slider3 = new slider(3,new Array("0 kr", "250 000 kr", "500 000 kr", "750 000 kr", "1 000 000 kr", "1 250 000 kr", "1 500 000 kr", "1 750 000 kr", "2 000 000 kr", "2 225 000 kr", "2 500 000 kr", "2 750 000 kr", "3 000 000 kr", "3 500 000 kr", "4 000 000 kr", "4 500 000 kr", "5 000 000 kr", "6 000 000 kr", "7 000 000 kr", ">8 000 000 kr","9"));
				document.onmousemove = getMouseXY;
				document.onmouseup = stopDrag;
			}
			
function getWindowWidth()
{
	var x;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth + 35;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
	}
	return x;
}