var winW,winH;var incvalue=20;var batImageWidth=155;var batImageHeight=136;var chalkBoard=new Object;batFlyImage=new Image();batFlyImage.src="/images/batfly.gif";var browserinfos=navigator.userAgent;var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/);var ns6=document.getElementById&&!document.all;var opera=browserinfos.match(/Opera/);var browserok=ie5||ns6||opera;function startbat(a,j,h,d,c,b){var g,i,f;f=new Object;batimg=document.getElementById(a);f.image=batimg;f.id=a;f.busy=true;batimg.bat=f;f.x=f.image.offsetLeft;f.y=f.image.offsetTop;f.incvalue=incvalue;f.xtarget=f.ytarget=f.flycount=0;f.flycount=f.intervalID=f.timeoutID=0;chalkBoard.element=document.getElementById(j);chalkBoard.leftOffset=h;chalkBoard.rightOffset=d;chalkBoard.topOffset=c;chalkBoard.bottomOffset=b;document.body.onresize=screensize;screensize();f.busy=false;batSit(f)}function batSit(a){a.image.src="/images/batsit.gif";if(a.intervalID){window.clearInterval(a.intervalID);a.intervalID=0}if(a.timeoutID){window.clearTimeout(a.timeoutID);a.timeoutID=0}a.flycount=0;batStartTimer(a)}function batStartTimer(a){delay=3000+Math.round(Math.random()*7000);a.timeoutID=window.setTimeout('batStartFlight("'+a.id+'", true);',delay)}function batStartFlight(d,a){var b,e,c;e=document.getElementById(d);b=e.bat;if(b.busy){if(a){batStartTimer(b)}return}b.busy=true;if(b.timeoutID){window.clearTimeout(b.timeoutID);b.timeoutID=0}b.flycount=0;e.src="/images/batfly.gif";xtarget=Math.round((winW-batImageWidth)*Math.random());ytarget=Math.round((winH-batImageHeight)*Math.random());batFlyTo(b,xtarget,ytarget);b.busy=false}function batFlyTo(e,i,d){var h,g,b,a,f,c;e.xtarget=i;e.ytarget=d;e.flycount++;h=e.x;g=e.y;b=Math.abs(i-h);a=Math.abs(d-g);if(b>a){f=e.incvalue;c=Math.round(e.incvalue*(a/b))}else{c=e.incvalue;f=Math.round(e.incvalue*(b/a))}e.xinc=(i>h)?f:-f;e.yinc=(d>g)?c:-c;if(!e.intervalID){e.intervalID=window.setInterval('batFly("'+e.id+'");',70)}}function batFly(f){var a,b,h,d,g,e,c;batimg=document.getElementById(f);c=batimg.bat;if(c.busy){return}c.busy=true;a=c.x;g=a+c.xinc;h=c.y;e=h+c.yinc;if((c.xinc<0&&g<c.xtarget)||c.xinc>0&&g>c.xtarget){c.xinc=0;g=c.xtarget}if((c.yinc<0&&e<c.ytarget)||c.yinc>0&&e>c.ytarget){c.yinc=0;e=c.ytarget}b=g+"px";c.image.style.left=b;c.x=g;d=e+"px";c.image.style.top=d;c.y=e;if(c.xinc==0&&c.yinc==0){if(a<chalkBoard.Left||a>chalkBoard.Right||h<chalkBoard.Top||h>chalkBoard.Bottom){batSit(c)}else{xtarget=Math.round((winW-batImageWidth)*Math.random());ytarget=Math.round((winH-batImageHeight)*Math.random());if(c.flycount>4){distLeft=a-chalkBoard.Left;distRight=chalkBoard.Right-a;distBottom=chalkBoard.Bottom-h;if(distLeft<distRight&&distLeft<distBottom){xtarget=Math.round(chalkBoard.Left*Math.random())}else{if(distRight<distBottom){xtarget=chalkBoard.Right+Math.round((winW-chalkBoard.Right)*Math.random())}else{ytarget=chalkBoard.Bottom+Math.round((winH-chalkBoard.Bottom)*Math.random())}}}batFlyTo(c,xtarget,ytarget)}}c.busy=false}function screensize(){var d=navigator.appName;if(ns6){winW=window.innerWidth-16-40;winH=window.innerHeight-16-40}else{if(ie5||opera){if(document.documentElement.clientWidth==0){winW=document.body.clientWidth-20-40;winH=document.body.clientHeight-20-40}else{winW=document.documentElement.clientWidth-20-40;winH=document.documentElement.clientHeight-20-40}}else{winW=640;winH=580}}var c=chalkBoard.element;var b=0,a=0;do{b+=c.offsetTop;a+=c.offsetLeft;c=c.offsetParent}while(c);chalkBoard.Top=b+chalkBoard.topOffset-batImageHeight;chalkBoard.Bottom=b+chalkBoard.element.offsetHeight+chalkBoard.bottomOffset;chalkBoard.Left=a+chalkBoard.leftOffset-batImageWidth;chalkBoard.Right=a+chalkBoard.element.offsetWidth+chalkBoard.rightOffset}function setbatimage(a){var b;b="/images/bat.gif";a.image.src=b}var bat_onload;function initbat(){startbat("bat1","Body",50,-60,40,55);startbat("bat2","Body",50,-60,40,55);if(bat_onload){bat_onload()}}var s1='<img id="bat1" onmouseover="batStartFlight(\'bat1\',false)" src="/images/batsit.gif" style="position:absolute; z-index:1023; top:1px; left:1px" />';var s2='<img id="bat2" onmouseover="batStartFlight(\'bat2\',false)" src="/images/batsit.gif" style="position:absolute; z-index:1023; top:400px; left:1px" />';document.write(s1+s2);bat_onload=window.onload;window.onload=initbat;