/*Function to get window dimensions by support rather than browser */ function getWinDims() { var result=new Array(); if(window.innerWidth) { result[0]=window.innerWidth; result[1]=window.innerHeight; return result; } if(document.documentElement && document.documentElement.clientWidth) { if(document.clientWidth) { result[0]=document.clientWidth; result[1]=document.clientHeight; } else { result[0]=document.documentElement.clientWidth; result[1]=document.documentElement.clientHeight; } return result; } if(document.body) { result[0]=document.body.clientWidth; result[1]=document.body.clientHeight; return result; }} function Is() { var agent = navigator.userAgent.toLowerCase(); var plat = navigator.platform.toLowerCase(); this.major = parseInt(navigator.appVersion); this.minor = parseFloat(navigator.appVersion); this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1))); this.ns2 = (this.ns && (this.major == 3)); this.ns3 = (this.ns && (this.major == 3)); this.ns4b = (this.ns && (this.major == 4) && (this.minor <= 4.03)); this.ns4 = (this.ns && (this.major >= 4)); this.ns6 = (this.ns && (this.major >= 5)); this.ns7 = (this.ns && (this.major >= 7)); this.ie = (agent.indexOf("msie") != -1); this.ie3 = (this.ie && (this.major < 4)); this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") == -1)); this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1)); this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1)); this.cam = (agent.indexOf('camino') != -1); this.opera = (agent.indexOf('opera') != -1); this.saf = (agent.indexOf('safari') != -1); this.ff = (agent.indexOf('firefox') != -1); this.kong = (agent.indexOf('konqueror') != -1); this.linux = (plat.indexOf('linux') != -1); this.w32 = (plat.indexOf('win32') != -1); this.mcp = (plat.indexOf('macppc') != -1); this.m68 = (plat.indexOf('mac68k') != -1); this.mac = (this.mcp || this.m68); } function getAngle(this_x,this_y,that_x,that_y) { var r=360+Math.round(Math.atan2(that_y-this_y,that_x-this_x)/0.017453293); r-=360*(r>=360); return r; } //returns the angle in degrees formed by the horizontal plane running through //this and a line from this to that, reckoning clockwise function signOf(n) { return n>=0; } //true if n is 0 or greater, false if negative function toggleBool(tf) { return !tf } /*function toggleBool(tf) { if(tf) return false; else return true } //true if arg if false, false if true */ function rndInRange(lower,upper) { return (lower+Math.floor(Math.random()*(++upper-lower))); } //returns a random integer in the range lower to upper. Either or both may be negative function posneg() {return -1+2*Math.floor(Math.random()+.5)} // returns 1 or -1 at random. //useful for eg, reversing direction //of a moving object at random function showhide() { //args in pairs ("div1",true,"div2",false..) true to show, false to hide. Note quotes var a=arguments,vh,success; for(var loop=0;loop