home *** CD-ROM | disk | FTP | other *** search
- // CREDITS:
- // FlowerPower: put springtime on your website
- // by Urs Dudli and Peter Gehrig
- // Copyright (c) 2001 Peter Gehrig and Urs Dudli. All rights reserved.
- // Permission given to use the script provided that this notice remains as is.
- // Additional scripts can be found at http://www.24fun.com.
- // info@24fun.com
- // 3/27/2001
-
- // IMPORTANT:
- // If you add this script to a script-library or a script-archive
- // you have to insert a highly visible link to http://www.24fun.com right into the
- // webpage where the script will be displayed.
-
- // CONFIGURATION:
- // Go to http://www.24fun.com, open category 'image' and
- // download the ZIP-file of this script containing
- // 6 images and the script-file with step-by-step instructions for easy configuration.
-
- // do not edit the variables below
- var frame=new Array()
- frame[0]=new Image()
- frame[0].src="frame1.gif"
- frame[1]=new Image()
- frame[1].src="frame2.gif"
- frame[2]=new Image()
- frame[2].src="frame3.gif"
- frame[3]=new Image()
- frame[3].src="frame4.gif"
- frame[4]=new Image()
- frame[4].src="frame5.gif"
- frame[5]=new Image()
- frame[5].src="frame6.gif"
-
- var i_nownumberofframes=0
- var i_maxnumberofframes=5
- var i_numberofblossoms=0
-
- var marginleft=0
- var margintop=0
- var marginbottom
- var marginright
-
- var timer
- var thisblossom
-
- showblossomstime=showblossomstime*1000
-
- function positionblossoms() {
- if (document.all) {
- marginbottom=document.body.clientHeight-40
- marginright=document.body.clientWidth-40
- for (i=0;i<=numberofblossoms;i++) {
- var randx=Math.floor(marginright*Math.random())
- var randy=Math.floor(marginbottom*Math.random())
- thisblossom=eval("document.all.blossom"+i+".style")
- thisblossom.posLeft=randx
- thisblossom.posTop=randy
- thisblossom.visibility="visible"
- }
- thisblossom=eval("blossom0")
- openblossoms()
- }
- if (document.layers) {
- marginbottom=window.innerHeight-40
- marginright=window.innerWidth-40
- for (i=0;i<=numberofblossoms;i++) {
- var randx=Math.floor(marginright*Math.random())
- var randy=Math.floor(marginbottom*Math.random())
- thisblossom=eval("document.blossom"+i)
- thisblossom.left=randx
- thisblossom.top=randy
- thisblossom.visibility="visible"
- }
- thisblossom=eval("document.blossom0.document")
- openblossoms()
- }
- }
-
- function openblossoms() {
- if (document.all) {
- clearTimeout(timer)
- if (i_nownumberofframes<=i_maxnumberofframes) {
- thisblossom.innerHTML="<img src='"+frame[i_nownumberofframes].src+"'>"
- i_nownumberofframes++
- timer=setTimeout("openblossoms()",openblossomspeed)
- }
- else {
- clearTimeout(timer)
- i_nownumberofframes=0
- switchtonextblossom()
- }
- }
- if (document.layers) {
- if (i_nownumberofframes<=i_maxnumberofframes) {
- thisblossom.write("<img src='"+frame[i_nownumberofframes].src+"'>")
- thisblossom.close()
- i_nownumberofframes++
- timer=setTimeout("openblossoms()",openblossomspeed)
- }
- else {
- clearTimeout(timer)
- i_nownumberofframes=0
- switchtonextblossom()
- }
- }
- }
-
- function switchtonextblossom() {
- if (document.all) {
- i_numberofblossoms++
- if (i_numberofblossoms<=numberofblossoms) {
- thisblossom=eval("blossom"+i_numberofblossoms)
- openblossoms()
- }
- else {
- setTimeout("hideblossoms()",showblossomstime)
- }
- }
- if (document.layers) {
- i_numberofblossoms++
- if (i_numberofblossoms<=numberofblossoms) {
- thisblossom=eval("document.blossom"+i_numberofblossoms+".document")
- openblossoms()
- }
- else {
- setTimeout("hideblossoms()",showblossomstime)
- }
- }
- }
-
- function hideblossoms() {
- if (document.all) {
- for (i=0;i<=numberofblossoms;i++) {
- thisblossom=eval("document.all.blossom"+i+".style")
- thisblossom.visibility="hidden"
- }
- }
- if (document.layers) {
- for (i=0;i<=numberofblossoms;i++) {
- thisblossom=eval("document.blossom"+i)
- thisblossom.visibility="hidden"
- }
- }
- }
-
- if (document.all) {
- for (i=0;i<=numberofblossoms;i++) {
- document.write("<div id='blossom"+i+"' style='position:absolute;top:0px;left:0px;visibility:hidden;'><img name='blossomimg"+i+"' src='frame1.gif'></div>")
- document.clear()
- }
- }
-
- if (document.layers) {
- for (i=0;i<=numberofblossoms;i++) {
- document.write("<layer name='blossom"+i+"' visibility=hide><img name='blossomimg"+i+"' src='frame1.gif'></layer>")
- }
- }
-
- window.onresize=positionblossoms
- window.onload=positionblossoms
-