function pbMove(e,obj){var parentLeft=document.getElementById("menu-right").offsetLeft+document.getElementById("p01").offsetLeft;var objLeft=obj.offsetLeft+parentLeft;var objWidth=obj.clientWidth;if(objWidth==0)objWidth="-1";var x=e.clientX;var pos=x-objLeft;if(pos<0)pos=0;if(pos>objWidth)pos=objWidth;var p=Math.round(pos/objWidth*320);obj.val=p;obj.value=obj.getAttribute("min")+Math.round((obj.getAttribute("max")-obj.getAttribute("min"))*(p/320));obj.value=Math.round(obj.getAttribute("max")*(p/320)); if(obj.value<obj.getAttribute("min"))obj.value=obj.getAttribute("min");obj.drawSlider();if(obj==theGameObj.pb01)theGameObj.setSize(obj.value);if(obj==theGameObj.pb02)theGameObj.setIslands(obj.value);if(obj==theGameObj.pb03)theGameObj.setSB(obj.value);if(obj==theGameObj.pb04)theGameObj.setRand(obj.value)}function setSlider(obj,p){} var drawSlider=function drawSlider(){var h=this.getAttribute("h");var w=this.getAttribute("w");var p_min=this.getAttribute("min");var p_max=this.getAttribute("max");var p_value=this.getAttribute("value");var p_jed=this.getAttribute("jed");var p_bgcolor=this.getAttribute("bgcolor");var p_color=this.getAttribute("color");var p_width=this.getAttribute("width");var p_height=this.getAttribute("height");var p_fcolor=this.getAttribute("fcolor");this.c2D.fillStyle=""+p_bgcolor;this.c2D.fillRect(0,0,w,h); this.c2D.fillStyle=""+p_color;var d=Math.abs(this.val-this.val_draw);if(this.val_draw<this.val)this.val_draw+=Math.ceil(d*smooth);if(this.val_draw>this.val)this.val_draw-=Math.ceil(d*smooth);this.c2D.fillRect(0,0,this.val_draw,h);this.desc.textContent=""+this.value+p_jed}; function makeSlider(obj){var h=obj.clientHeight;if(h<1)h=1;var w=obj.clientWidth;if(w<10)w=10;var p_min=obj.getAttribute("min");var p_max=obj.getAttribute("max");var p_value=obj.getAttribute("value");var p_jed=obj.getAttribute("jed");var p_bgcolor=obj.getAttribute("bgcolor");var p_fcolor=obj.getAttribute("fcolor");var p_color=obj.getAttribute("color");var p_width=obj.getAttribute("width");var p_height=obj.getAttribute("height");var canvas=document.createElement("canvas");var desc=document.createElement("span"); desc.className="pbd";desc.textContent=""+p_value+p_jed;obj.val=Math.round(p_value/(p_max-p_min)*320);obj.val_draw=obj.val;obj.value=p_value;canvas.style.width="100%";canvas.style.height="100%";canvas.width=320;canvas.height=1;obj.setAttribute("w",canvas.width);obj.setAttribute("h",canvas.height);var context2D=canvas.getContext("2d");context2D.font="15pt Calibri";obj.c2D=context2D;obj.desc=desc;obj.drawSlider=drawSlider;obj.drawSlider();attachEvent(obj,"pop",pbMove);attachEvent(obj,"hover",pbMove); attachEvent(obj,"tap",pbMove);obj.appendChild(desc);obj.appendChild(canvas)};
