//WBL 17 Jun 2010 Go back to r1.13 (ie non xmas operational version) //WBL 9 Apr 2007 add cookie //WBL 3 Mar 2007 add time+name for firefox //WBL 17 June 2006 point both ie4up and ns6up pfeiffer_local.html r1.114 var CookieName = "animation"; function setCookie(value) { var today = new Date() var expires = new Date() expires.setTime(today.getTime() + 1000*60*60*24*365) document.cookie = CookieName + "=" + escape(value) + "; expires=" + expires.toGMTString() } function getCookie(def) { if (navigator.cookieEnabled == 0) return 0; var search = CookieName + "=" if (document.cookie.length > 0) { // if there are any cookies offset = document.cookie.indexOf(search) if (offset != -1) { // if cookie exists offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset) // set index of end of cookie value if (end == -1) end = document.cookie.length var s = unescape(document.cookie.substring(offset, end)) //alert("cookie is '"+s+"'"); return s; } } return def; } //from http://www.assortedstuff.com/webmaster/beyond/jssample/snow/snow.html //!-- Original: Altan (snow@altan.hr) //!-- Web Site: http://www.altan.hr/snow var no = 0; // snow number var running = true; var speed = 50; // smaller number moves the snow faster var snowflake = "http://www.cs.ucl.ac.uk/cgi-bin/staff/W.Langdon/endpop.bat?"; var snowname = "http://www.cs.ucl.ac.uk/cgi-bin/staff/W.Langdon/endnam.bat?1"; var ns4up = (document.layers) ? 1 : 0; // browser sniffer var ie4up = (document.all) ? 1 : 0; var ns6up = (document.getElementById&&!document.all) ? 1 : 0; var dx, xp, yp; // coordinate and position variables var am, stx, sty; // amplitude and step variables //--var i, doc_width = 800, doc_height = 600; var i, doc_width = 800, doc_height = 2600; if (ns4up||ns6up) { doc_width = self.innerWidth; //--doc_height = self.innerHeight; } else if (ie4up) { doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } dx = new Array(); xp = new Array(); yp = new Array(); am = new Array(); stx = new Array(); sty = new Array(); function initialise(number) { no=number; for (i = 0; i < no; ++ i) { dx[i] = 0; // set coordinate variables xp[i] = Math.random()*(doc_width-50); // set position variables yp[i] = Math.random()*doc_height; am[i] = Math.random()*20; // set amplitude variables stx[i] = 0.02 + Math.random()/10; // set step variables sty[i] = 0.7 + Math.random(); // set step variables var h=(ie4up||ns6up)? "http://www.cs.ucl.ac.uk/staff/W.Langdon/pfeiffer_local.html" : "http://www.cs.ucl.ac.uk/staff/W.Langdon/pfeiffer_server.html"; var t=""+ "

"; if(i==0) t = t + "Newest snowflake "; if(ns6up) {//IE6 sort of works but looks bad t= t + ""; } t = t + "
"; if (ns4up) { // set layers document.write(""+t+""); } else if (ie4up||ns6up) { document.write("
"+t+"
"); } } }//end initialise //taken from pfeiffer_local.html r1.104 function Xp(i) { return xp[i] + am[i]*Math.sin(dx[i]); } function move() { var eastwind=(Math.max(0.5,Math.sin(new Date().getTime()/2000))-0.5)*8; for (i = 0; i < no; ++ i) { // iterate for every dot yp[i] += sty[i]; if (yp[i] > doc_height-100) { xp[i] = Math.random()*Math.max(doc_width-am[i]-100,100); yp[i] = 0; stx[i] = 0.02 + Math.random()/10; sty[i] = 0.7 + Math.random(); } xp[i] -= eastwind; if(xp[i]<-300) xp[i]=Math.max(doc_width-am[i]-100,100); dx[i] += stx[i]; } }//end move function moveto(I,left,top) { if (ns4up) { document.layers["dot"+I].top = top; document.layers["dot"+I].left = left; } else if (ie4up) { document.all["dot"+I].style.pixelTop = top; document.all["dot"+I].style.pixelLeft = left; } else if (ns6up) { document.getElementById("dot"+I).style.top = top; document.getElementById("dot"+I).style.left = left; } //document.getElementById("dot"+I).innerHTML = who(I); }//end moveto function snow() { // NS4 and IE and NS6 main animation function doc_width = ns4up? self.innerWidth : (ns6up? window.innerWidth : document.body.clientWidth); doc_height = ns4up? self.innerHeight: (ns6up? window.innerHeight+window.pageYOffset : Math.max(document.body.scrollHeight-500,500)); move(); //all the dots for (var i = 0; i < no; ++ i) { // iterate for every dot moveto(i,Xp(i),yp[i]); } if(running) {setTimeout("snow()", speed);} } function show() { for (var i = 0; i < no; ++ i) { // iterate for every dot document.getElementById("dot"+i).style.visibility="visible"; } } function hide() { for (var i = 0; i < no; ++ i) { // iterate for every dot document.getElementById("dot"+i).style.visibility="hidden"; } } function stop() {hide(); setCookie(0); running=false;} function xxstart() { //IE7.0 name clash with start show(); setCookie(no); running=true; snow();}