tdi_simpleHscroll = {
	vars:{
		html:[
			"<div style='position:relative;width:100%;height:100%;'>",
				"<div style='position:absolute;left:0px;top:0px;width:50%;height:100%;border-right:1px solid #adb1b4;overflow:hidden'></div>",
				"<div style='cursor:pointer;position:absolute;left:0px;top:0px;width:100%;height:50px;border:1px solid #adb1b4;background-color:#fbfaf8;overflow:hidden'></div>",
			"</div>"
		]	
	},
	utils:0,
	autoFuns:{
		main:function(oPar, sName){
			this.par = oPar
			this.name = sName
			this.site = oPar.par
			this.inish = function(oSelf){
				this.self = oSelf
			}
			this.run = function(oContainer, oScroller, oScrollCon){
				oContainer.innerHTML = this.par.vars.html.join("")
				var r = new this.par.funs.scroller(this.self, this.name, oContainer, oScroller, oScrollCon)
				r.inish(r)
				return r
			}
		}
	},
	funs:{
		scroller:function(oPar, sName, oContainer, oScroller, oScrollCon){
			this.par = oPar
			this.site = oPar.site
			this.name = sName+"_"+(new Date).getTime()
			var d = this.site.utils.findChildren(oContainer, "div", 0)
			this.con = {
				con:oContainer,
				bg:d[0],
				sb:this.site.utils.findChildren(d[0], "div", 0)[1]
			}
			this.dims = {bgH:d[0].offsetHeight,cTop:0,maxTop:0,per:0}
			this.scroll = oScroller
			this.scrollCon = oScrollCon
			oScrollCon.style.position = "relative"
			var s = oScroller.style
			s.position = "absolute"
			s.top = "0px"
			s.left = "0px"
			this.inish = function(oSelf){
				this.self = oSelf
				this.self.fun = {
					mouseEvent:function(event){
						oSelf.setMove(event)
					},
					move:function(event, lastEvent){
						oSelf.move(event, lastEvent)
					}
				}
				this.site.utils.addListener(this.con.sb, ["mousedown"], this.self.fun.mouseEvent)
			}
			this.run = function(bHide){
				this.scroll.style.top = this.con.sb.style.top = "0px"
				this.dims.cTop = 0
				if(bHide){
					this.con.con.style.visibility = "hidden"
				} else {
				    this.setDims()
				}
			}
			this.setDims = function(){
				if(this.scroll.offsetHeight < this.scrollCon.offsetHeight){
					this.con.con.style.visibility = "hidden"
				} else {
					this.dims.per = this.scrollCon.offsetHeight/(this.scroll.offsetHeight+5)
					var h = this.con.bg.offsetHeight * this.dims.per
					this.dims.unit = (this.scroll.offsetHeight-this.scrollCon.offsetHeight+5)/(this.con.bg.offsetHeight-h)
					this.con.sb.style.height = h+"px"
					this.dims.maxTop = this.dims.bgH-h
					this.con.con.style.visibility = "visible"
				}
			}
			this.setMove = function(e){
			    var v = this.site.vars
			    var b = 0
				if(e.type == "mousedown"){	
					v.events.mouseup[this.name] = this.self.fun.mouseEvent
					v.events.mousemove[this.name] = this.self.fun.move
				} else {
					delete v.events.mouseup[this.name]
					delete v.events.mousemove[this.name]
					b = 1
				}
				this.site.utils.noSelect(document.body,b)
			}
			this.move = function(e, le){
				var d = e.clientY-le.clientY
				this.dims.cTop += d
				if(this.dims.cTop > this.dims.maxTop) this.dims.cTop = this.dims.maxTop
				if(this.dims.cTop < 0) this.dims.cTop = 0
				this.con.sb.style.top = this.dims.cTop+"px"
				this.scroll.style.top = ((this.dims.unit*this.dims.cTop)*-1)+"px"
			}
		}
	},
	inish:tdi_site.funs.genInish
}

tdi_site.autoFuns["simpleHscroll"] = tdi_simpleHscroll