tdi_wallpaper_window = {
	vars:{
		lightBox:"tdi_window_wallpaper_lightBox",
		con:"tdi_window_wallpaper",
		close:"tdi_window_wallpaper_close",
		select:"tdi_window_wallpaper_select",
		img:"tdi_window_wallpaper_img"
	},
	utils:0,
	autoFuns:{
		load:function(oPar, sName){
			this.par = oPar
		
			this.name = sName
			this.inish = function(oSelf){
				this.self = oSelf
				this.par.par.vars.events.load[this.par.name] = oSelf
			}
			this.run = function(bAllLoad){
				
				if(bAllLoad){
					var v = this.par.vars
					for(var e in v) v[e] = document.getElementById(v[e])
					this.par.par.flipLightBox.main.add(this.par.name, v.lightBox, "background-color:transparent", document.body, document.getElementById("tdi_imageDispDiv"))
					var r = new this.par.funs.updateWP(this.par.main, v.select)
					r.inish(r, this.par.par)
					
					r = new this.par.funs.closeLB(this.par, this.par.par, v.close)
					r.inish(r)
					
					delete this.par.par.vars.events.load[this.par.name]
				}
			}
		},
		main:function(oPar, sName){
			this.par = oPar
			this.site = oPar.par
			this.name = sName
			this.inish = function(oSelf){
				this.self = oSelf
			}
			
			this.run = function(oImages){
				
				this.images = oImages
				this.par.vars.select.selectedIndex = 0
				this.updateWP()
			}
			
			this.updateWP = function(){
				this.par.vars.img.src = this.images[this.par.vars.select.selectedIndex]
			}
			
		}
		
	},
	funs:{
		updateWP:function(oFun, oObj){
			this.call = oFun
			this.obj = oObj
			this.inish = function(oSelf, oSite){
				var fun = function(){
					oSelf.run()
				}
				oSite.utils.addListener(this.obj, ['change'], fun)
			}
			this.run = function(){
				this.call.updateWP(this.selectedIndex)
			}
		},
		closeLB:function(oPar, oSite, oObj){
			this.par = oPar
			this.site = oSite,
			this.obj = oObj
			this.inish = function(oSelf){
				var fun = function(){
					oSelf.run()
				}
				this.site.utils.addListener(this.obj, ['mouseup'], fun)
			}
			this.run = function(){
				this.site.flipLightBox.main.hide(this.par.name)
			}
				
		}
	},
	inish:tdi_site.funs.genInish
}

tdi_site.autoFuns["wallpaper_window"] = tdi_wallpaper_window