// GN engine // animation effects // 2006, s0nik var _d=3; var _fps=30; var timeout=Math.round(1000/_fps); function set_size(O,targ_s,targ_p,noeff) { //alert(targ_s[0]+' '+targ_s[1]); O.style.overflow='hidden'; if (!O.old_size) O.old_size=[O.offsetWidth,O.offsetHeight]; if (!O.old_pos) O.old_pos=getPos(O); O.targ_s=[O.offsetWidth,O.offsetHeight]; O.targ_p=[null,null]; O.targ_s[0]=targ_s[0]; O.targ_s[1]=targ_s[1]; O.targ_p[0]=targ_p[0]; O.targ_p[1]=targ_p[1]; if (!noeff) do_resize(O); else { if (targ_s[0]!=null) O.style.width=O.targ_s[0]; if (O.targ_s[1]!=null) O.style.height=O.targ_s[1]; } } function restore_size(O) { O.targ_s=O.old_size; O.targ_p=O.old_pos; do_resize(O); } // for this to work as expected, the object (O) must have one children html tag containing all other tags function fit_size(O,w,h,noeff) { var x,wP=0,hP=0; O.targ_s=[(w?O.offsetWidth:null),(h?O.offsetHeight:null)]; O.targ_p=[null,null]; x=O.style.marginTop; if (!isNaN(x)) hP+=x; x=O.style.marginBottom; if (!isNaN(x)) hP+=x; hP=parseInt(hP); x=O.style.marginLeft; if (!isNaN(x)) wP+=x; x=O.style.marginRight; if (!isNaN(x)) wP+=x; wP=parseInt(wP); var cs=O.getElementsByTagName("*"); var maxw=0, maxh=0; for (var i in cs) if (cs[i]) if (cs[i].style) if (cs[i].style.display!='none' && cs[i].style.position!='absolute') { if (w && O.targ_s[0]+4maxw) maxw=cs[i].offsetWidth+wP; if (cs[i].offsetHeight+hP>maxh) maxh=cs[i].offsetHeight+hP; } if (w && maxw2 || Math.abs(dy)>2) || Math.abs(dw)>2 || Math.abs(dh)>2) setTimeout(function(){do_resize(O,1)},timeout); else { if (!isNaN(O.targ_p[0]) && O.targ_p[0]!=null) O.style.top=O.targ_p[0]+'px'; if (!isNaN(O.targ_p[1]) && O.targ_p[1]!=null) O.style.left=O.targ_p[1]+'px'; if (!isNaN(O.targ_s[0]) && O.targ_s[0]!=null) O.style.width=O.targ_s[0]+'px'; if (!isNaN(O.targ_s[1]) && O.targ_s[1]!=null) O.style.height=(O.targ_s[1]+1)+'px'; O.resize_in_progress=0; } } /////