var ie=(document.all)?true:false;var gifselected=false;var changeuserpicsizemode=false;function gifpicpageOnSelect(){var c=document.getElementById("gifpicpages");var b=document.getElementById("gifpicpage");var a=document.getElementById("gifpicpageselect");b.value=c.options[c.selectedIndex].value;a.submit()}function gifpicChoose(b){var a=document.getElementById("gifpicdiv");var c=document.getElementById("doagif");var d=document.getElementById("userpic");if(d==null){alert("Upload userpic first!");return}gifpic.src="gifs/"+b+"/ani.gif";gifpic.height=document.getElementById(b).height;gifpic.width=document.getElementById(b).width;c.gifpichratio.value=100;c.gifpicwratio.value=100;a.style.display="block";c.gifpicid.value=b;gifselected=true}function getBounds(a){var d;var c;if(a==null){return{left:0,top:0,width:0,height:0}}d=a.offsetLeft;c=a.offsetTop;for(var b=a.offsetParent;b;b=b.offsetParent){d+=b.offsetLeft-b.scrollLeft;c+=b.offsetTop-b.scrollTop}return{left:d,top:c,width:a.offsetWidth,height:a.offsetHeight}}function getBodyScrollTop(){return self.pageYOffset||(document.documentElement&&document.documentElement.scrollTop)||(document.body&&document.body.scrollTop)}function getBodyScrollLeft(){return self.pageXOffset||(document.documentElement&&document.documentElement.scrollLeft)||(document.body&&document.body.scrollLeft)}function gifpicClick(b){var g,d;var i,f;var k=document.getElementById("gifpic");var j=document.getElementById("userpic");var a=document.getElementById("gifpicdiv");var c=document.getElementById("doagif");var h=getBounds(j);if(ie){g=b.x;d=b.y}else{g=b.pageX-getBodyScrollLeft();d=b.pageY-getBodyScrollTop()}if(j==null){return}i=(g-h.left);f=(d-h.top);i=i+1;f=f+1;if(i>0&&i<j.width&&f>0&&f<j.height&&!gifselected){changeuserpicsizemode=!changeuserpicsizemode;if(changeuserpicsizemode){j.style.cursor="move"}else{j.style.cursor="default"}}if(i>-k.width&&i<j.width&&f>-k.height&&f<j.height&&gifselected){gifpic.src="";a.style.display="none";gifselected=false;c.gifpicposx.value=i;c.gifpicposy.value=f;c.submit()}}function gifpicOnMouseMove(c){var h,f;var j,g;var m=document.getElementById("userpic");var b=document.getElementById("gifpicdiv");var i=getBounds(m);var d=document.getElementById("doagif");var l=document.getElementById("upload_gifpic");var k,a;if(m==null){return}if(ie){h=c.x+document.body.scrollLeft;f=c.y+document.body.scrollTop}else{h=c.pageX;f=c.pageY}j=(h-i.left);g=(f-i.top);b.style.left=h+1;b.style.top=f+1;if(changeuserpicsizemode){m.width=(g+5)*parseFloat(upratio.value);m.height=g+5;if(m.width<10){m.width=10}if(m.width>300){m.width=300}if(m.height<10){m.height=10}if(m.height>300){m.height=300}d.userpich.value=m.height;d.userpicw.value=m.width;l.userpich.value=m.height;l.userpicw.value=m.width;uph.value=m.height;upw.value=m.width}}function gifpicIncGifPicW(c){var b=document.getElementById("doagif");var a=parseInt(b.gifpicwratio.value);if(!gifselected){alert("Pickup gif from library first, then resize it.");return}a=a+c;if(a<=0){a=10}if(a>300){a=300}b.gifpicwratio.value=a;gifpic.width=document.getElementById(b.gifpicid.value).width*a/100}function gifpicIncGifPicH(c){var b=document.getElementById("doagif");var a=parseInt(b.gifpichratio.value);if(!gifselected){return}a=a+c;if(a<=0){a=10}if(a>300){a=300}b.gifpichratio.value=a;gifpic.height=document.getElementById(b.gifpicid.value).height*a/100};