﻿var navTimer=0;function navReset(){var loadp=$("#nav li.head.active").position();var loadpleft=((loadp.left+Math.round($("#nav li.head.active").width()/2))-30);$("#navhov").animate({left:loadpleft+"px"},500,'easeOutBack')}
$(document).ready(function () { $("#nav li.head").mouseover(function(){$(this).css("background-image","url(client/im/mainnav_on.png)");var p=$(this).position();$("#navhov").animate({left:((p.left+Math.round($(this).width()/2))-30)+"px"},100);clearTimeout(navTimer)});$("#nav li.head").mouseout(function(){if(!$(this).parent().parent().hasClass("active")){$(this).css("background-image","url(client/im/mainnav_off.png)");navTimer=setTimeout("navReset()",2000)}});$("#nav li.head.active").css("background-image","url(client/im/mainnav_on.png)");$("#navhov").fadeIn(1000);navReset(); });

var Spark=function(){var a=this;this.b='client/im/';this.s=['spark.png','spark2.png','spark3.png','spark4.png'];this.i=this.s[this.random(this.s.length)];this.f=this.b+this.i;this.n=document.createElement('img');this.newSpeed().newPoint().display().newPoint().fly()};Spark.prototype.display=function(){$(this.n).attr('src',this.f).css('position','absolute').css('z-index','-'+this.random(20)).css('top',this.pointY).css('left',this.pointX);$(document.body).append(this.n);return this};Spark.prototype.fly=function(){var a=this;$(this.n).animate({"top":this.pointY,"left":this.pointX,},this.speed,'linear',function(){a.newSpeed().newPoint().fly()})};Spark.prototype.newSpeed=function(){this.speed=(this.random(10)+5)*1100;return this};Spark.prototype.newPoint=function(){this.pointX=this.random(window.innerWidth-100);this.pointY=this.random(350);return this};Spark.prototype.random=function(a){return Math.ceil(Math.random()*a)-1}

$(function(){ var totalSparks=40;var sparks=[];for(i=0;i<totalSparks;i++){sparks[i]=new Spark()} });

