Function.prototype.bind = function (object) {
    var method = this;
    return function () {
        method.apply(object, arguments);
    };
}
Function.prototype.bindAsEventListener = function(object) {
  var __method = this;
  return function(event) {
    return __method.call(object, event || window.event);
  }
}

function numConvert(b)
{
    var kmbArr = new Array("", "K", "M", "B");
    var budget_cnt = 0;
    var budget = b;
    var btxt = b+"";
    if(!btxt.indexOf("0"))
    {
        return b;
    }
    while(true)
    {
        if((budget/1000) >= 1)
        {
            budget=budget/1000;
            budget_cnt++;
        }
        else
        {break;}
    }
    budget = budget+""+kmbArr[budget_cnt];
    return budget;
}

function NumberFormat(num, inputDecimal)
{
this.VERSION = 'Number Format v1.5.4';
this.COMMA = ',';
this.PERIOD = '.';
this.DASH = '-'; 
this.LEFT_PAREN = '('; 
this.RIGHT_PAREN = ')'; 
this.LEFT_OUTSIDE = 0; 
this.LEFT_INSIDE = 1;  
this.RIGHT_INSIDE = 2;  
this.RIGHT_OUTSIDE = 3;  
this.LEFT_DASH = 0; 
this.RIGHT_DASH = 1; 
this.PARENTHESIS = 2; 
this.NO_ROUNDING = -1 
this.num;
this.numOriginal;
this.hasSeparators = false;  
this.separatorValue;  
this.inputDecimalValue; 
this.decimalValue;  
this.negativeFormat; 
this.negativeRed; 
this.hasCurrency;  
this.currencyPosition;  
this.currencyValue;  
this.places;
this.roundToPlaces; 
this.truncate; 
this.setNumber = setNumberNF;
this.toUnformatted = toUnformattedNF;
this.setInputDecimal = setInputDecimalNF; 
this.setSeparators = setSeparatorsNF; 
this.setCommas = setCommasNF;
this.setNegativeFormat = setNegativeFormatNF; 
this.setNegativeRed = setNegativeRedNF; 
this.setCurrency = setCurrencyNF;
this.setCurrencyPrefix = setCurrencyPrefixNF;
this.setCurrencyValue = setCurrencyValueNF; 
this.setCurrencyPosition = setCurrencyPositionNF; 
this.setPlaces = setPlacesNF;
this.toFormatted = toFormattedNF;
this.toPercentage = toPercentageNF;
this.getOriginal = getOriginalNF;
this.moveDecimalRight = moveDecimalRightNF;
this.moveDecimalLeft = moveDecimalLeftNF;
this.getRounded = getRoundedNF;
this.preserveZeros = preserveZerosNF;
this.justNumber = justNumberNF;
this.expandExponential = expandExponentialNF;
this.getZeros = getZerosNF;
this.moveDecimalAsString = moveDecimalAsStringNF;
this.moveDecimal = moveDecimalNF;
this.addSeparators = addSeparatorsNF;
if (inputDecimal == null) {
this.setNumber(num, this.PERIOD);
} else {
this.setNumber(num, inputDecimal); 
}
this.setCommas(true);
this.setNegativeFormat(this.LEFT_DASH); 
this.setNegativeRed(false); 
this.setCurrency(false); 
this.setCurrencyPrefix('$');
this.setPlaces(0);
}
function setInputDecimalNF(val)
{
this.inputDecimalValue = val;
}
function setNumberNF(num, inputDecimal)
{
if (inputDecimal != null) {
this.setInputDecimal(inputDecimal); 
}
this.numOriginal = num;
this.num = this.justNumber(num);
}
function toUnformattedNF()
{
return (this.num);
}
function getOriginalNF()
{
return (this.numOriginal);
}
function setNegativeFormatNF(format)
{
this.negativeFormat = format;
}
function setNegativeRedNF(isRed)
{
this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal)
{
this.hasSeparators = isC;
if (separator == null) separator = this.COMMA;
if (decimal == null) decimal = this.PERIOD;
if (separator == decimal) {
this.decimalValue = (decimal == this.PERIOD) ? this.COMMA : this.PERIOD;
} else {
this.decimalValue = decimal;
}
this.separatorValue = separator;
}
function setCommasNF(isC)
{
this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC)
{
this.hasCurrency = isC;
}
function setCurrencyValueNF(val)
{
this.currencyValue = val;
}
function setCurrencyPrefixNF(cp)
{
this.setCurrencyValue(cp);
this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPositionNF(cp)
{
this.currencyPosition = cp
}
function setPlacesNF(p, tr)
{
this.roundToPlaces = !(p == this.NO_ROUNDING); 
this.truncate = (tr != null && tr); 
this.places = (p < 0) ? 0 : p; 
}
function addSeparatorsNF(nStr, inD, outD, sep)
{
nStr += '';
var dpos = nStr.indexOf(inD);
var nStrEnd = '';
if (dpos != -1) {
nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
nStr = nStr.substring(0, dpos);
}
var rgx = /(\d+)(\d{3})/;
while (rgx.test(nStr)) {
nStr = nStr.replace(rgx, '$1' + sep + '$2');
}
return nStr + nStrEnd;
}
function toFormattedNF()
{	
var pos;
var nNum = this.num; 
var nStr;            
var splitString = new Array(2);   
if (this.roundToPlaces) {
nNum = this.getRounded(nNum);
nStr = this.preserveZeros(Math.abs(nNum)); 
} else {
nStr = this.expandExponential(Math.abs(nNum)); 
}
if (this.hasSeparators) {
nStr = this.addSeparators(nStr, this.PERIOD, this.decimalValue, this.separatorValue);
} else {
nStr = nStr.replace(new RegExp('\\' + this.PERIOD), this.decimalValue); 
}
var c0 = '';
var n0 = '';
var c1 = '';
var n1 = '';
var n2 = '';
var c2 = '';
var n3 = '';
var c3 = '';
var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN : this.DASH;
var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN : this.DASH;
if (this.currencyPosition == this.LEFT_OUTSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c0 = this.currencyValue;
} else if (this.currencyPosition == this.LEFT_INSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c1 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_INSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c2 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_OUTSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c3 = this.currencyValue;
}
nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
if (this.negativeRed && nNum < 0) {
nStr = '<font color="red">' + nStr + '</font>';
}
return (nStr);
}
function toPercentageNF()
{
nNum = this.num * 100;
nNum = this.getRounded(nNum);
return nNum + '%';
}
function getZerosNF(places)
{
var extraZ = '';
var i;
for (i=0; i<places; i++) {
extraZ += '0';
}
return extraZ;
}
function expandExponentialNF(origVal)
{
if (isNaN(origVal)) return origVal;
var newVal = parseFloat(origVal) + ''; 
var eLoc = newVal.toLowerCase().indexOf('e');
if (eLoc != -1) {
var plusLoc = newVal.toLowerCase().indexOf('+');
var negLoc = newVal.toLowerCase().indexOf('-', eLoc); 
var justNumber = newVal.substring(0, eLoc);
if (negLoc != -1) {
var places = newVal.substring(negLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, true, parseInt(places));
} else {
if (plusLoc == -1) plusLoc = eLoc;
var places = newVal.substring(plusLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, false, parseInt(places));
}
newVal = justNumber;
}
return newVal;
} 
function moveDecimalRightNF(val, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimal(val, false);
} else {
newVal = this.moveDecimal(val, false, places);
}
return newVal;
}
function moveDecimalLeftNF(val, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimal(val, true);
} else {
newVal = this.moveDecimal(val, true, places);
}
return newVal;
}
function moveDecimalAsStringNF(val, left, places)
{
var spaces = (arguments.length < 3) ? this.places : places;
if (spaces <= 0) return val; 
var newVal = val + '';
var extraZ = this.getZeros(spaces);
var re1 = new RegExp('([0-9.]+)');
if (left) {
newVal = newVal.replace(re1, extraZ + '$1');
var re2 = new RegExp('(-?)([0-9]*)([0-9]{' + spaces + '})(\\.?)');		
newVal = newVal.replace(re2, '$1$2.$3');
} else {
var reArray = re1.exec(newVal); 
if (reArray != null) {
newVal = newVal.substring(0,reArray.index) + reArray[1] + extraZ + newVal.substring(reArray.index + reArray[0].length); 
}
var re2 = new RegExp('(-?)([0-9]*)(\\.?)([0-9]{' + spaces + '})');
newVal = newVal.replace(re2, '$1$2$4.');
}
newVal = newVal.replace(/\.$/, ''); 
return newVal;
}
function moveDecimalNF(val, left, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimalAsString(val, left);
} else {
newVal = this.moveDecimalAsString(val, left, places);
}
return parseFloat(newVal);
}
function getRoundedNF(val)
{
val = this.moveDecimalRight(val);
if (this.truncate) {
val = val >= 0 ? Math.floor(val) : Math.ceil(val); 
} else {
val = Math.round(val);
}
val = this.moveDecimalLeft(val);
return val;
}
function preserveZerosNF(val)
{
var i;

val = this.expandExponential(val);
if (this.places <= 0) return val; 
//alert(typeof(val));

var decimalPos = val.indexOf('.');
if (decimalPos == -1) {
val += '.';
for (i=0; i<this.places; i++) {
val += '0';
}
} else {
var actualDecimals = (val.length - 1) - decimalPos;
var difference = this.places - actualDecimals;
for (i=0; i<difference; i++) {
val += '0';
}
}
return val;
}
function justNumberNF(val)
{
newVal = val + '';
var isPercentage = false;
if (newVal.indexOf('%') != -1) {
newVal = newVal.replace(/\%/g, '');
isPercentage = true; 
}
var re = new RegExp('[^\\' + this.inputDecimalValue + '\\d\\-\\+\\(\\)eE]', 'g');	
newVal = newVal.replace(re, '');
var tempRe = new RegExp('[' + this.inputDecimalValue + ']', 'g');
var treArray = tempRe.exec(newVal); 
if (treArray != null) {
var tempRight = newVal.substring(treArray.index + treArray[0].length); 
newVal = newVal.substring(0,treArray.index) + this.PERIOD + tempRight.replace(tempRe, ''); 
}
if (newVal.charAt(newVal.length - 1) == this.DASH ) {
newVal = newVal.substring(0, newVal.length - 1);
newVal = '-' + newVal;
}
else if (newVal.charAt(0) == this.LEFT_PAREN
&& newVal.charAt(newVal.length - 1) == this.RIGHT_PAREN) {
newVal = newVal.substring(1, newVal.length - 1);
newVal = '-' + newVal;
}
newVal = parseFloat(newVal);
if (!isFinite(newVal)) {
newVal = 0;
}
if (isPercentage) {
newVal = this.moveDecimalLeft(newVal, 2);
}
return newVal;
}

function Slider(container, p)
{
	if(container != null && typeof(container) == "object" && container.tagName.toLowerCase() == "div")
		this.container = container;
		
	if(p != null)
		this.p = p;
				
}
Slider.prototype.__getOffset = function(obj, bool)
{
		var total=0;
		while(obj!=null)
		{
			total+=obj["offset"+(bool?"Left":"Top")];
			
			obj=obj.offsetParent;
		}
		return total;	
}

Slider.prototype.__getEvt = function (evt)
{
		var e = evt ? evt : window.event;
		var src = ((ie)?e.srcElement:e.target);
		return [e, src];	
}
Slider.prototype.initSlider = function()
	{
		//alert(this.container);
		if(this.container == null || this.p == null)
			return false;
		if(this.p.min_val == null || this.p.max_val == null || this.p.width == null)
			return false;
		if(this.p.min_val >= this.p.max_val)
			return false;
			
		if(isNaN(this.p.factor))
		{
			this.p.factor=1;
		}
		
		if (this.p.rounding == null)
			this.p.rounding = true;		
		
		if(this.p.interval == null)
			this.p.interval = 1;
		this.p.margin = parseInt(this.p.max_val)-parseInt(this.p.min_val);
		this.p.marginx = Math.ceil((this.p.margin)/this.p.interval);
		//alert();
		this.p.val_per_px = Math.ceil(this.p.margin/this.p.width);
		
		if(this.p.num_of_grid == null || this.p.num_of_grid >= this.p.margin)
		{
			if(this.p.width >= (this.p.marginx))
			{
				if(this.p.interval > this.p.margin)
					this.p.interval = this.p.margin;
				this.p.num_of_grid = Math.ceil(this.p.margin/this.p.interval);
				this.p.grid_val = this.p.interval;
			}
			else
			{
				this.p.num_of_grid = this.p.width;
				this.p.grid_val = Math.ceil((this.p.margin/this.p.width));
				
			}
			//this.p.num_of_grid++;
		}
		else
		{
			this.p.num_of_grid = this.p.num_of_grid;
			this.p.grid_val = Math.ceil(this.p.margin/this.p.num_of_grid);
				
		}
		
		this.p.grid_width_val = this.p.width/this.p.num_of_grid;
		this.p.grid_width = Math.ceil(this.p.grid_width_val);
		
		if((this.p.grid_width*this.p.num_of_grid) > this.p.width)
		{
			this.p.num_of_grid = this.p.width;
			this.p.grid_val = Math.ceil((this.p.margin/this.p.width))*((this.p.margin+1)/this.p.num_of_grid);
			this.p.grid_width_val = this.p.width/this.p.num_of_grid;
			this.p.grid_width = Math.ceil(this.p.grid_width_val);				
		}

		this.div = document.createElement("div");
		this.div.style.position = "absolute";
		this.div.style.border = "1px #cccccc solid";
		this.div.style.width = this.p.width+"px";
		if(this.p.height == null)
		{
			this.p.height = 16;
		}
		this.div.style.height = this.p.height+"px";
		//alert(this.p.init_val1);
		if(this.p.init_val1 == null)
		{
			this.p.init_val1 = this.p.min_val*this.p.factor;
			this.val1 = this.p.init_val1;
		}
		else
		{
			if(	this.p.init_val1 < this.p.min_val || this.p.init_val1 > this.p.max_val)
			{
				this.p.init_val1 = this.p.min_val*this.p.factor;
				this.val1 = this.p.init_val1;
			}
			else
			{
				this.p.init_val1 = this.p.init_val1*this.p.factor;
				this.val1 = this.p.init_val1;
			}
		}
		
		if(this.p.init_val2 == null)
		{
			this.p.init_val2 = this.p.max_val*this.p.factor;
			this.val2 = this.p.init_val2;
		}
		else
		{
			if(	this.p.init_val2 < this.p.min_val || this.p.init_val2 > this.p.max_val)
			{
				this.p.init_val2 = this.p.max_val*this.p.factor;
				this.val2 = this.p.init_val2;
			}
			else
			{
				this.p.init_val2 = this.p.init_val2*this.p.factor
				this.val2 = this.p.init_val2;
			}
		}
				
		document.body.appendChild(this.div);
		this.div.style.left = this.__getOffset(this.container, true)+"px";
		this.div.style.top = this.__getOffset(this.container, false)+"px";
		this.grid_tbl = document.createElement("table");
		this.div.appendChild(this.grid_tbl);
		this.grid_tbl.style.border = 0;
		this.grid_tbl.className = "opac8";
		if(this.p.background_image != null)
		{
			this.grid_tbl.style.backgroundImage = "url("+this.p.background_image+")";
		}
		this.grid_tbl.cellPadding = 0;
		this.grid_tbl.cellSpacing = 0;
		this.grid_tbl.style.width = (this.p.num_of_grid*this.p.grid_width)+"px";
		this.grid_tbl.style.height =this.div.offsetHeight+"px";
		this.grid_tbody = document.createElement("tbody");
		this.grid_tbl.appendChild(this.grid_tbody);
		this.grid_tr = document.createElement("tr");
		this.grid_tbody.appendChild(this.grid_tr);

		for(var i=0; i<this.p.num_of_grid; i++)
		{
			var gtd = document.createElement("td");
			this.grid_tr.appendChild(gtd);
			gtd.style.width = this.p.grid_width+"px";
			gtd.vAlign = "bottom";
			
			var gdiv = document.createElement("div");
			gtd.appendChild(gdiv);
			gdiv.innerHTML = "";
			gdiv.style.backgroundColor = "#666666";

			var t = 1;
			if(t==0)
				t=1;
			gdiv.style.height = t+"px";
			gdiv.style.overflow = "hidden";
			gdiv.style.width = this.p.grid_width+"px";
		}
		
		//Init Dragger
		this.dragger_icon = null;
		var src = "search.files/pointer1.gif";
		if(this.p.icon != null)
		{
			src = this.p.icon;	
		}
		this.dragger_icon = new Image(10,10);
		this.dragger_icon.src = src;
		
		this.dragger1 = document.createElement("div");
		this.dragger1.code = 1;
		document.body.appendChild(this.dragger1);
		this.dragger1.style.position = "absolute";
		this.dragger1.style.height = (this.p.height+10+1)+"px";
		this.dragger1.style.width = "10px";
		var htm = '<table width="100%" height="'+(this.p.height+10+1)+'" border="0" cellspacing="0" cellpadding="0"><tr><td valign="bottom"><img src="search.files/pointer2.gif"></td></tr></table>';
		this.dragger1.innerHTML = htm;
		var l = this.__getOffset(this.div, true)-5;
		var l2 = this.__getOffset(this.div, true)+this.div.offsetWidth-5;
		var t = this.__getOffset(this.div, false);
		this.dragger1.style.left = l+"px";
		this.dragger1.style.top = t+"px";
		this.dragger1.style.cursor = "pointer";
		
		this.drag1 = Drag2
		this.drag1.init(this.dragger1,null, l, l2-2, t, t);
		this.dragger1.onDragStart = this.onDragStartEvt.bind(this);
		this.dragger1.onDrag = this.onDragEvt.bind(this);
		this.dragger1.onDragEnd = this.onDragEndEvt.bind(this);			
		
		var htm = '<table width="100%" height="'+(this.p.height+10+1)+'" border="0" cellspacing="0" cellpadding="0"><tr><td valign="bottom"><img src="search.files/pointer1.gif"></td></tr></table>';
		this.dragger2 = document.createElement("div");
		this.dragger2.code = 2;
		document.body.appendChild(this.dragger2);
		this.dragger2.style.position = "absolute";
		this.dragger2.style.height = (this.p.height+10+1)+"px";
		this.dragger2.style.width = "10px";
		this.dragger2.innerHTML = htm;
		this.dragger2.style.left = l2+"px";
		this.dragger2.style.top = t+"px";
		this.dragger2.style.cursor = "pointer";	
		this.drag2 = Drag2
		this.drag2.init(this.dragger2,null, l+2, l2, t, t);
		this.dragger2.onDragStart = this.onDragStartEvt.bind(this);
		this.dragger2.onDrag = this.onDragEvt.bind(this);
		this.dragger2.onDragEnd = this.onDragEndEvt.bind(this);		
		
		this.dragger1_tricker = document.createElement("div");
		this.dragger1_tricker.style.backgroundColor = "#ffffff";
		if(ie)
			this.dragger1_tricker.style.border = "1px #000000 solid";
		this.dragger1_tricker.className = "dragtricker";	

				this.div.appendChild(this.dragger1_tricker);
		
		
		this.dragger2_tricker = document.createElement("div");
		this.dragger2_tricker.style.backgroundColor = "#ffffff";
		if(ie)
			this.dragger2_tricker.style.border = "1px #000000 solid";	
		this.dragger2_tricker.className = "dragtricker";	

		this.div.appendChild(this.dragger2_tricker);
		this.dragger1_tricker.style.position = "absolute";
		this.dragger2_tricker.style.position = "absolute";

		this.setDisplayValue2(this.p.init_val2);
		this.setDisplayValue1(this.p.init_val1);

		
		this.margin_shad = document.createElement("div");
		document.body.appendChild(this.margin_shad);
		this.margin_shad.style.position = "absolute";
		this.margin_shad.style.top = (t+1)+"px";
		var w = l2-l;
		this.margin_shad.style.width = w+"px";
		this.margin_shad.style.backgroundColor = "#B3C61C";
		this.margin_shad.style.height = (this.p.height)+"px";
		this.margin_shad.style.left = (l+5)+"px";
		this.margin_shad.style.overflow = "hidden";
		this.margin_shad.className = "mshad";
	
		if(this.p.margin_shad == null || false == this.p.margin_shad)
		{
			this.margin_shad.style.display = "none";
		}
		this.setVal1(this.val1/this.p.factor);
		this.setVal2(this.val2/this.p.factor);
		this.dragger2_tricker.style.left = (this.div.offsetWidth-this.dragger2_tricker.offsetWidth)+"px";
		this.dragger2_tricker.style.top = this.dragger2.offsetHeight+"px";
		this.dragger1_tricker.style.top = this.dragger1.offsetHeight+"px";
		//window.onresize = this.relocateElement.bindAsEventListener(this);
	}
Slider.prototype.setDisplayValue1 = function(val)
	{
		if (this.p.rounding) 
			this.dragger1_tricker.innerHTML = numConvert(val);
		else 
			this.dragger1_tricker.innerHTML = new NumberFormat(val).toFormatted();
	}
Slider.prototype.setDisplayValue2 = function(val)
	{			
		var symbol = '';
		if ((val/this.p.factor) == this.p.max_val) 
			symbol = ">";
		
		if (this.p.rounding) 
			this.dragger2_tricker.innerHTML = symbol+numConvert(val);
		else 
			this.dragger2_tricker.innerHTML = symbol+(new NumberFormat(val).toFormatted());
	}
Slider.prototype.setGridValue = function(val_arr)
	{
		for(var i=0; i < this.grid_tr.childNodes.length; i++)
		{
			if(val_arr[i] != null && !isNaN(parseInt(val_arr[i])))
			{
				this.grid_tr.childNodes[i].childNodes[0].style.visibility = "visible";
				//var val = Math.ceil(val_arr[i]/parseInt(this.grid_tbl.offsetHeight)*parseInt(this.grid_tbl.offsetHeight));
				var val = parseInt(this.grid_tbl.offsetHeight)*(val_arr[i]/100);
				if(val==0)
					val=1;				
				this.grid_tr.childNodes[i].childNodes[0].style.height = val+"px";
			}
			else
			{
				this.grid_tr.childNodes[i].childNodes[0].style.visibility = "hidden";	
			}
		}
	}
	
Slider.prototype.onDragStartEvt = function(e, x, y)
	{
		evt = this.__getEvt(e);
		obj = evt[1];
		while(obj!=null)
		{
			if(obj.tagName == "DIV" && obj.code != null)
				break;
			
			obj=obj.offsetParent;
		}		

		this.current_obj = obj;
		switch(this.current_obj.code)
		{
			case 1:
			case "1":
				this.dragger1.style.zIndex = "1000";
				this.dragger2.style.zIndex = "900";
				break;
			case 2:
			case "2":
				this.dragger2.style.zIndex = "1000";
				this.dragger1.style.zIndex = "900";
				break;
		}		
	}
Slider.prototype.onDragEvt = function(e, x, y)
	{
		var t = this.__getOffset(this.div, false);
		var cl = this.__getOffset(this.current_obj, true);
		var l1 = this.__getOffset(this.div, true)-5;
		var l2 = this.__getOffset(this.div, true)+this.div.offsetWidth-5;
		var m = ((cl+4)-this.__getOffset(this.div, true));
		var v = ( ( (cl+4)-this.__getOffset(this.div, true))/this.div.offsetWidth)*100;
		v = Math.ceil(Math.ceil(v)/100*this.p.num_of_grid);
	
		v = (v*this.p.grid_val)+this.p.min_val;
	
		if(v > this.p.max_val)
			v = this.p.max_val;
		if(v < this.p.min_val)
			v = this.p.min_val;
			
		switch(this.current_obj.code)
		{
			case 1:
			case "1":
				this.val1 = Math.ceil(v);
				if(this.p.factor != null)
					this.val1 = this.val1*this.p.factor;
				//this.dragger1_tricker.innerHTML = this.val1;
				this.setDisplayValue1(this.val1);
				if(this.margin_shad.style.display != "none")
				{
					cl2 = this.__getOffset(this.dragger2, true);
					var w = cl2-cl;
					this.margin_shad.style.width = w+"px";
					this.margin_shad.style.left = (cl+5)+"px";					
				}				
				break;
			case 2:
			case "2":
				this.val2 = Math.ceil(v);
				if(this.p.factor != null)
					this.val2 = this.val2*this.p.factor;				
				//this.dragger2_tricker.innerHTML = this.val2;
				this.setDisplayValue2(this.val2);
				if(this.margin_shad.style.display != "none")
				{
					cl2 = this.__getOffset(this.dragger1, true);
					var w = cl-cl2;
					this.margin_shad.style.width = w+"px";
					this.margin_shad.style.left = (cl2+5)+"px";							
				}
				break;
		}
		this.dragger2.style.top = t+"px";
		this.dragger1.style.top = t+"px";
		this.dragger2_tricker.style.left = (this.div.offsetWidth-this.dragger2_tricker.offsetWidth)+"px";
		return;
	}
	
	Slider.prototype.onDragEndEvt = function(x, y)
	{
		if(this.current_obj != null)
		{
			switch(this.current_obj.code)
			{
				case 1:
				case "1":
					this.dragger2.minX = this.__getOffset(this.dragger1, true)+2;
					break;
				case 2:
				case "2":
					this.dragger1.maxX = this.__getOffset(this.dragger2, true)-2;
					break;

			}
			this.current_obj = null;	
		}	
		if(this.p.drag_end_func != null && typeof(this.p.drag_end_func) == "function")
		{
			this.p.drag_end_func(this);
		}
			
	}

Slider.prototype.setVal1 = function(val)
	{
		if(val < this.min_val || val > this.max_val || val*this.p.factor > this.val2) 
		{
			return false;	
		}
		
		this.val1 = Math.ceil(val);
		if(this.p.factor != null)
			this.val1 = this.val1*this.p.factor;
		//this.dragger1_tricker.innerHTML = this.val1;
		this.setDisplayValue1(this.val1);
		var d_l = this.__getOffset(this.div, true)-5;
		var p = (val-this.p.min_val)/(this.p.max_val-this.p.min_val);
		var pos = this.div.offsetWidth*p+d_l;
		this.dragger1.style.left = pos+"px";
		
		var cl = this.__getOffset(this.dragger1, true);
		if(this.margin_shad.style.display != "none")
		{
			cl2 = this.__getOffset(this.dragger2, true);
			var w = cl2-cl;
			this.margin_shad.style.width = w+"px";
			this.margin_shad.style.left = (cl+5)+"px";					
		}	
		this.dragger2.minX = this.__getOffset(this.dragger1, true)+2;
	}
Slider.prototype.setVal2 = function(val)
	{
		if(val < this.min_val || val > this.max_val || val*this.p.factor < this.val1) 
		{
			return false;	
		}
		
		this.val2 = Math.ceil(val);
		if(this.p.factor != null)
			this.val2 = this.val2*this.p.factor;				
		//this.dragger2_tricker.innerHTML = this.val2;
		this.setDisplayValue2(this.val2);
		var d_l = this.__getOffset(this.div, true)-5;
		var p = (val-this.p.min_val)/(this.p.max_val-this.p.min_val);
		var pos = this.div.offsetWidth*p+d_l;

		this.dragger2.style.left = pos+"px";
		var cl = this.__getOffset(this.dragger2, true);
		if(this.margin_shad.style.display != "none")
		{
			cl2 = this.__getOffset(this.dragger1, true);
			var w = cl-cl2;
			
			this.margin_shad.style.width = w+"px";
			this.margin_shad.style.left = (cl2+5)+"px";							
		}		
		this.dragger1.maxX = this.__getOffset(this.dragger2, true)-2;
	}
Slider.prototype.relocateElement = function()
	{
		this.div.style.left = this.__getOffset(this.container, true)+"px";
		this.div.style.top = this.__getOffset(this.container, false)+"px";
		var t = this.__getOffset(this.div, false);
		var d_l = this.__getOffset(this.div, true)-5;
		var p = ((this.val1/this.p.factor)-this.p.min_val)/(this.p.max_val-this.p.min_val);
		var pos = this.div.offsetWidth*p+d_l;
		this.dragger1.style.left = pos+"px";
		this.dragger1.style.top = t+"px";	
		var p = ((this.val2/this.p.factor)-this.p.min_val)/(this.p.max_val-this.p.min_val);
		var pos = this.div.offsetWidth*p+d_l;

		this.dragger2.style.left = pos+"px";
		this.dragger2.style.top = t+"px";
		//this.dragger2.style.left = pos+"px";
		var cl = this.__getOffset(this.dragger2, true);
		if(this.margin_shad.style.display != "none")
		{
			cl2 = this.__getOffset(this.dragger1, true);
			var w = cl-cl2;
			
			this.margin_shad.style.width = w+"px";
			this.margin_shad.style.left = (cl2+5)+"px";
			this.margin_shad.style.top = t+"px";								
		}
		this.dragger1.minX = this.__getOffset(this.div, true)-4;
		this.dragger1.maxX = this.__getOffset(this.dragger2, true)-2;
		this.dragger2.minX = this.__getOffset(this.dragger1, true)+2;
		this.dragger2.maxX = this.__getOffset(this.div, true)+this.div.offsetWidth-5;
	}
Slider.prototype.setDisplay = function(bool)
	{
		if(this.div == null)
			return false;
		if(bool)
		{
			this.div.style.display = "";
			if(this.dragger1 != null)
				this.dragger1.style.display = "";
			if(this.dragger2 != null)
				this.dragger2.style.display = "";	
			if(this.margin_shad != null)
				this.margin_shad.style.display = "";			
		}
		else
		{
			this.div.style.display = "none";
			if(this.dragger1 != null)
				this.dragger1.style.display = "none";
			if(this.dragger2 != null)
				this.dragger2.style.display = "none";	
			if(this.margin_shad != null)
				this.margin_shad.style.display = "none";	
		}
	}