
window.StormTide={};StormTide.Tree={};StormTide.Fern={};StormTide.Tree.DrawingContext="";StormTide.Fern.DrawingContext="";StormTide.Tree.InitTree=function(){canvas=document.getElementById('drawingCanvas');if(canvas.getContext){if(typeof window.innerWidth!='undefined'){canvas.width=window.innerWidth-100;canvas.height=window.innerHeight-100;canvas.style.width=window.innerWidth-100+"px";canvas.style.height=window.innerHeight-100+"px";}else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){canvas.width=document.documentElement.clientWidth-100;canvas.height=document.documentElement.clientHeight-100;canvas.style.width=document.documentElement.clientWidth-100;canvas.style.height=document.documentElement.clientHeight-100;}else{return;}
StormTide.Tree.DrawingContext=document.getElementById('drawingCanvas').getContext("2d");}}
StormTide.Tree.CurrentTree=1;StormTide.Tree.Draw=function(x1,y1,length,level,deg,treeid){if(StormTide.Tree.CurrentTree!=treeid){return;}
context=StormTide.Tree.DrawingContext;context.beginPath();context.strokeStyle="#fff";context.lineWidth=(10/Math.pow(1.6,level));context.lineCap="round";context.moveTo(x1,y1);if(level>2){deg=deg+Math.random()*1.6-1.6/2;}
if(level==2){deg=deg+Math.random()*1.1-1.1/2;}
if(level==1){deg=StormTide.Tree.Random(1.37,1.77)*-1;}
length=(length*(.75+Math.random()*.3));var x2=x1+length*Math.cos(deg);var y2=y1+length*Math.sin(deg);context.lineTo(x2,y2);context.stroke();if(level++>6)return;for(i=0,cnt=StormTide.Tree.Random(level,3);i<cnt;i++){setTimeout(function(){StormTide.Tree.Draw(x2,y2,length,level,deg,treeid);},100);}}
StormTide.Tree.Random=function(a,b){if(a>b)return b;return a+(Math.random()*(b-a));}
StormTide.Tree.Reset=function(){canvas=document.getElementById('drawingCanvas');if(canvas.getContext){StormTide.Tree.DrawingContext.clearRect(0,0,window.innerWidth,window.innerHeight);}}
StormTide.Tree.DrawSite=function(){canvas=document.getElementById('drawingCanvas');if(canvas.getContext){ele=document.getElementById('footer');StormTide.Tree.Draw((ele.offsetLeft+ele.offsetWidth/2),(ele.offsetTop-60),60,1,null,++StormTide.Tree.CurrentTree);document.getElementById('header').style.visibility='hidden';}};StormTide.Fern.InitFern=function(){canvas=document.getElementById('drawingCanvas');if(canvas.getContext){if(typeof window.innerWidth!='undefined'){canvas.width=window.innerWidth-100;canvas.height=window.innerHeight-100;canvas.style.width=window.innerWidth-100+"px";canvas.style.height=window.innerHeight-100+"px";}else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){canvas.width=document.documentElement.clientWidth-100;canvas.height=document.documentElement.clientHeight-100;canvas.style.width=document.documentElement.clientWidth-100;canvas.style.height=document.documentElement.clientHeight-100;}else{return;}
StormTide.Fern.DrawingContext=document.getElementById('drawingCanvas').getContext("2d");ele=document.getElementById('footer');StormTide.Fern.offset_x=(ele.offsetLeft+ele.offsetWidth/2);StormTide.Fern.offset_y=ele.offsetTop-20;}}
StormTide.Fern.interval="";StormTide.Fern.Matrix=[];StormTide.Fern.Random=function(a,b){return a+(Math.random()*(b-a));}
StormTide.Fern.Draw=function(){context=StormTide.Fern.DrawingContext;context.beginPath();context.strokeStyle="#fff";context.lineWidth=StormTide.Fern.Random(0.5,0.15);StormTide.Fern.Matrix[0]=[0,0,0,StormTide.Fern.Random(0.16,0.25),0,0,StormTide.Fern.Random(0.01,0.02)];L=StormTide.Fern.Random(0.04,0.05);StormTide.Fern.Matrix[1]=[StormTide.Fern.Random(0.85,0.95),L,(L*-1),StormTide.Fern.Random(0.85,0.93),StormTide.Fern.Random(0,0.0002)*-1,StormTide.Fern.Random(0.5,1.6),0.85];StormTide.Fern.Matrix[2]=[StormTide.Fern.Random(0.2,0.35),(StormTide.Fern.Random(0.2,0.26)*-1),StormTide.Fern.Random(0.16,0.23),StormTide.Fern.Random(0.04,0.22),StormTide.Fern.Random(0,0.009)*-1,StormTide.Fern.Random(0.02,1.6),0.93];StormTide.Fern.Matrix[3]=[StormTide.Fern.Random(0.04,0.15)*-1,StormTide.Fern.Random(0.2,0.28),StormTide.Fern.Random(0.16,0.26),StormTide.Fern.Random(0.04,0.24),StormTide.Fern.Random(0,0.083),StormTide.Fern.Random(0.12,0.44),null];StormTide.Fern.LoopCounter=0;StormTide.Fern.interval=setInterval(function(){StormTide.Fern.Iterate();},50);}
StormTide.Fern.LoopCounter=0;StormTide.Fern.Iterate=function(){if(StormTide.Fern.LoopCounter++>75){clearInterval(StormTide.Fern.interval);}
for(i=0;i<120;i++){x=Math.random();y=Math.random();for(iter=0;iter<20;iter++){rand=Math.random();if(rand<=StormTide.Fern.Matrix[0][6]){x=0;y=StormTide.Fern.Matrix[0][3]*y;}
else
if(rand<=StormTide.Fern.Matrix[1][6]){x1=(StormTide.Fern.Matrix[1][0]*x)+(StormTide.Fern.Matrix[1][1]*y)+StormTide.Fern.Matrix[1][4];y1=(StormTide.Fern.Matrix[1][2]*x)+(StormTide.Fern.Matrix[1][3]*y)+StormTide.Fern.Matrix[1][5];x=x1;y=y1;}
else
if(rand<=StormTide.Fern.Matrix[2][6]){x1=(StormTide.Fern.Matrix[2][0]*x)+(StormTide.Fern.Matrix[2][1]*y)+StormTide.Fern.Matrix[2][4];y1=(StormTide.Fern.Matrix[2][2]*x)+(StormTide.Fern.Matrix[2][3]*y)+StormTide.Fern.Matrix[2][5];x=x1;y=y1;}
else{x1=(StormTide.Fern.Matrix[3][0]*x)+(StormTide.Fern.Matrix[3][1]*y)+StormTide.Fern.Matrix[3][4];y1=(StormTide.Fern.Matrix[3][2]*x)+(StormTide.Fern.Matrix[3][3]*y)+StormTide.Fern.Matrix[3][5];x=x1;y=y1;}}
context=StormTide.Fern.DrawingContext;scale=30;pixelSize=.1;context.moveTo(StormTide.Fern.offset_x+(x*scale)-pixelSize,StormTide.Fern.offset_y-y*scale-pixelSize);context.lineTo(StormTide.Fern.offset_x+(x*scale),StormTide.Fern.offset_y-y*scale);}
context.stroke();}
StormTide.BinaryCloud={};StormTide.BinaryCloud.DrawingContext="";StormTide.BinaryCloud.InitCloud=function(){canvas=document.getElementById('drawingCanvas');if(canvas.getContext){if(typeof window.innerWidth!='undefined'){canvas.width=window.innerWidth-100;canvas.height=window.innerHeight-100;canvas.style.width=window.innerWidth-100+"px";canvas.style.height=window.innerHeight-100+"px";}else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){canvas.width=document.documentElement.clientWidth-100;canvas.height=document.documentElement.clientHeight-100;canvas.style.width=document.documentElement.clientWidth-100;canvas.style.height=document.documentElement.clientHeight-100;}else{return;}
StormTide.BinaryCloud.DrawingContext=document.getElementById('drawingCanvas').getContext("2d");ele=document.getElementById('footer');StormTide.BinaryCloud.offset_x=(ele.offsetLeft+ele.offsetWidth/2);StormTide.BinaryCloud.offset_y=ele.offsetTop-20;}}
StormTide.BinaryCloud.CurrentCloud=0;StormTide.BinaryCloud.Draw=function(x1,y1,length,level,deg,cloudid){if(StormTide.BinaryCloud.CurrentCloud!=cloudid){return;}
context=StormTide.BinaryCloud.DrawingContext;context.beginPath();context.strokeStyle="#fff";context.lineWidth=(10/Math.pow(1.6,level));context.lineCap="round";context.moveTo(x1,y1);length=(length*(.75+Math.random()*.3));var x2=x1+length*Math.cos(deg);var y2=y1+length*Math.sin(deg);context.lineTo(x2,y2);context.stroke();if(level++>8)return;setTimeout(function(){StormTide.BinaryCloud.Draw(x2,y2,length*.75,level,deg+(Math.PI*35/180),cloudid);},100);setTimeout(function(){StormTide.BinaryCloud.Draw(x2,y2,length*.75,level,deg-(Math.PI*35/180),cloudid);},100);}
StormTide.BinaryCloud.Random=function(a,b){if(a>b)return b;return a+(Math.random()*(b-a));}
lastPane=null;lastPaneId=null;function TogglePane(pane){clearInterval(StormTide.Fern.interval);StormTide.Tree.Reset();if(lastPane){lastPane.style.display='none';}else{document.getElementById('unused').style.display='none';}
el=null;++StormTide.BinaryCloud.CurrentCloud;++StormTide.Tree.CurrentTree;switch(pane){case'architecture':StormTide.Tree.DrawSite();el=document.getElementById('architecture');break;case'development':document.getElementById('header').style.visibility='hidden';StormTide.Fern.Draw();el=document.getElementById('development');break;case'experience':document.getElementById('header').style.visibility='hidden';for(i=1;i<=8;i++){StormTide.BinaryCloud.Draw(StormTide.BinaryCloud.offset_x,StormTide.BinaryCloud.offset_y-200,(70*(.75+Math.random()*.3)),1,((45*i)-10+Math.random()*10)*0.0174532925,StormTide.BinaryCloud.CurrentCloud);}
el=document.getElementById('experience');break;}
if(el){lastPane=el;lastPaneId=pane;el.style.display='block';}}
function Resizing(){if(lastPaneId){clearInterval(StormTide.Fern.interval);++StormTide.Tree.CurrentTree;++StormTide.BinaryCloud.CurrentCloud;switch(lastPaneId){case'architecture':StormTide.Tree.DrawSite();break;case'development':StormTide.Fern.Draw();break;case'experience':for(i=1;i<=8;i++){StormTide.BinaryCloud.Draw(StormTide.BinaryCloud.offset_x,StormTide.BinaryCloud.offset_y-200,(70*(.75+Math.random()*.3)),1,((45*i)-10+Math.random()*10)*0.0174532925,StormTide.BinaryCloud.CurrentCloud);}
break;}}}
