// Falling Leaves Effect Javascript
// copyright 30th August 2005, Felgall Pty Ltd
// http://www.felgall.com/
// permission to use this Javascript on your web page is granted
// provided that all of the code in this script (including these
// comments) is used without any alteration
// you can change the number of leaves  that are displayed if you like

var num_leaves = 18;
var folder = "leaves\/img\/";
var imgcnt = 8;
// line 12
var aDOM = 0, ieDOM = 0, nsDOM = 0; 
var stdDOM = document.getElementById; 
if (stdDOM) aDOM = 1; 
else {ieDOM = document.all; 
if (ieDOM) aDOM = 1; else {var nsDOM = ((navigator.appName.indexOf('Netscape') != -1) && (parseInt(navigator.appVersion) ==4)); if (nsDOM) aDOM = 1;}}
 function findDOM(objectId, wS) 
{if (stdDOM) return wS ? document.getElementById(objectId).style:document.getElementById(objectId); if (ieDOM) return wS ? document.all[objectId].style: document.all[objectId]; 
if (nsDOM) return document.layers[objectId];}
// line 21
function findLivePageWidth()
 {return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:700;}
function findLivePageHeight()
 {return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:500;}
function posX() 
 {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;} 
function posY()
 {return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;}
 var speed = 75;var mvw = [];var mvh = [];var mve = [];var stw = [];var sth = [];var posw = [];var posh = [];var dir = [];var winWidth, winHeight; 
function startleaves() 
 {winWidth = findLivePageWidth()-100;winHeight = findLivePageHeight()-100; 
  for (var i = 0; i < num_leaves; i++)
   {mve[i] = 0;mvh[i] = 28+ Math.random()*2;mvw[i] = 10+ Math.random()*4;posw[i] = Math.random()*(winWidth-35)+12;posh[i] = Math.random()*winHeight; stw[i] = 0.02 + Math.random()/15;sth[i] = 1.8 + Math.random();dir[i] = (Math.random()>0.5)?1:-1;document.write('<div id="leaves'+ i +'" style="position: absolute; z-index: 999'+ (i+10) +'; visibility:hidden; "><img src="'+folder + 'palm' + (Math.floor(Math.random()*imgcnt) + 1) + '.gif" border="0"></div>');}setInterval("moreleaves()", speed);} 
// l 35
function moreleaves() 
  {for (var i = num_leaves-1; i >= 0;i--)
   {if (posh[i] > winHeight-50) {posw[i] = 10+ Math.random()*(winWidth-mvw[i]-30);posh[i] = 0;dir[i]=(Math.random()<0.5)?1:-1;stw[i] = 0.03 + Math.random()/7;sth[i] = 1.3 + Math.random();} mve[i] += stw[i] *dir[i]; 
     if (Math.abs(mve[i]) > 6) {dir[i]=-dir[i]; posh[i]+=Math.abs(mvh[i]*mve[i]);posw[i]+=mvw[i]*mve[i]; mve[i]=0;} objstyle = findDOM('leaves'+i,1); objstyle.left = (posX()+posw[i] + mvw[i]*mve[i])+'px'; objstyle.top = (posY()+posh[i] + mvh[i]*(Math.abs(Math.cos(mve[i])+mve[i])))+'px';objstyle.visibility = 'visible';}}
 //window.onload = startleaves();

