/* jsMorph v0.4.0 http://jsMorph.com/ | http://jsMorph.com/license */
var jsMorph=function(r,x,t,s,o,p,v){var l=(function(b,R,U,J,h,j){var S={},Q,e,c,T=b.style,a,P,d,f=0,L,g,i=[],K=function(y){return[y.offsetWidth,y.offsetHeight,y.offsetLeft,y.offsetTop]},N=function(){if(document.body.currentStyle){return function(z,y){return z.currentStyle[y.replace(/\-(\w)/g,function(){return arguments[1].toUpperCase()})]}}else{return function(z,y){return document.defaultView.getComputedStyle(z,null).getPropertyValue(y)}}}(),M=function(D){var z={},B,C=D.style,y=document.createElement("div"),A=y.style;A.cssText="position:absolute;left:0;top:-10ex;width:10em;height:72pt;";D.appendChild(y);B=K(y).concat(K(D));z={em:B[0]/10,pt:B[1]/72,pc:B[1]/6,"in":B[1],cm:B[1]/2.54,mm:B[1]/25.4,ex:Math.abs(B[3])/10,"%font":B[0]/1000,"%line":B[0]/1000};A.cssText+=";font-size:"+R["font-size"]+(R["font-family"]?";font-family:"+R["font-family"]:"")+";";B=K(y);D.removeChild(y);z.exn=Math.abs(B[3]/10);P=C.cssText;C.cssText+=";position:absolute;left:0%;top:0%;";B=K(D);C.cssText+=";left:-100%;top:-100%;";B=B.concat(K(D));C.cssText=P;z["%outX"]=(B[2]-B[6])/100;z["%outY"]=(B[3]-B[7])/100;return z},k=function(A,y,z){if(A[2]!="px"&&A[2]!=""){if(A[2]!="%"){A[1]*=z[A[2]]}else{if(!y.match(/^(font)/)){A[1]*=y.match(/width|left|right|padding|margin|text-ind/)?z["%outX"]:z["%outY"]}else{A[1]*=z["%"+y.split("-")[0]]}}}};b.initStyle=b.style.cssText;if(R["font-size"]){a=/([\-0-9\.]+)([a-z%]+)(!*)/.exec(R["font-size"])}for(var O in R){if(!(O.replace(/\-(\w)/g,function(){return arguments[1].toUpperCase()}) in T)){delete (R[O]);continue}c=/([\-0-9\.]+)([a-z%]*)(\s*!*)/.exec(R[O])||[];R[O]=R[O].toString().replace("!","");e=/([\-0-9\.]+)(\D*)/.exec(N(b,O.match(/^(padding|margin)$/)?O+"-left":O.match(/^(border-width)$/)?"border-left-width":O.match(/(border-radius)$/)?(d=(O.match(/^(\-\w+\-)/)||["",""])[1])+"border-"+(d=="-moz-"?"radius-topleft":"top-left-radius"):O))||["0px",0,"px"];if(!e[1]&&O.match(/^(height|width)/)){T.zoom=1;i[0]=/([\-0-9\.]+)([a-z%]*)/.exec(N(b,"padding-"+(O=="width"?"left":"top")));i[1]=/([\-0-9\.]+)([a-z%]*)/.exec(N(b,"padding-"+(O=="width"?"right":"bottom")));if((i[0]&&i[0][2]!="px")||(i[1]&&i[1][2]!="px")){k(i[0],"padding",Q||(Q=M(b)));k(i[1],"padding",Q)}e=["",(O=="width"?b.clientWidth:b.clientHeight)-i[0][O=="width"?0:1]-i[1][O=="width"?0:1],"px"]}if((e[2]&&e[2]!="px")||(e[2]!=c[2])){k(e,O,Q||(Q=M(b)));k(c,O,Q);if(a&&O!="font-size"){if(c[2]=="em"){c[1]*=a[1]/(a[2]!="em"?Q.em:1)}if(c[2]=="ex"){c[1]*=Q.exn/Q.ex}}}e[1]=parseFloat(e[1]);L=parseFloat(c[1])-e[1];if(f<Math.abs(L)){f=L}S[O]={full:e[1],delta:L,unit:c[2]==""?"":"px"}}f=12+Math.abs(U/f*(!J&&J!=0?1:J));if(j.speed&&f>j.speed){}else{j.speed=f}S.speed=f;if(h){h(S,Q)}return S}),w=function(a){if(!a){return new Date().getTime()-w.sT||0}else{w.sT=new Date().getTime();return 0}},u=function(F,f,G,e,k,i,H){var I,a,L=false,j,d,h,g,J,K;for(var b=k.length;b--;){j=k[b];g=j.params;J=j.prop;K=j.initProp;d=F-(j.newTime||0)-g.delay;if(i&&!i[b]&&!j.newTime){continue}I="";if(d>0){h=(G||j.obj.backwards);a=j.ease(d/g.duration);if(d<g.duration){L=true;j.done=null;for(var c in J){I+=";"+c+":"+(K[c].full+(!h?a:1-a)*K[c].delta)+K[c].unit}j.objStyle.cssText+=I}else{if(!j.done){if(g.doEnd){if(!h){for(var c in J){I+=";"+c+":"+J[c]}j.objStyle.cssText+=I}else{j.objStyle.cssText=j.obj.initStyle}}else{for(var c in J){I+=";"+c+":"+(K[c].full+(!h?K[c].delta:0))+K[c].unit}j.objStyle.cssText+=I}if(j.onMorphEnd){j.onMorphEnd(j.obj,f(),e,K.speed,H.speed,j.objStyle.cssText)}j.done=true;j.newTime=null}}if(j.onMorph){j.onMorph(j.obj,j.objStyle,F,e+1,K.speed,H.speed,a,j.objStyle.cssText)}}else{L=true}}if(L){H.timer=window.setTimeout(function(){u(f(),f,G,++e,k,i,H)},H.speed)}else{H.timer=null;if(b<=0&&H.onMorphEnd){H.onMorphEnd(i,f(),e,H.speed)}}},q=[];this.reset=function(h,e,a,i,f,g,d){for(var c=q.length;c--;){for(var b in q[c]){b=null}q[c]=null;q.pop()}if(h){this.concat(h,e,a,i,f,g,d)}return this};this.init=function(c){var d=q.length,e,f;for(var b=c?d-1:0,a=d;b<a;b++){if(q[b].obj.initStyle!=undefined&&c==undefined){e=q[b].obj.style;f=e.cssText;if(q[b].obj.initStyle!=f){e.cssText=q[b].obj.initStyle}else{f=null}}q[b]["initProp"]=l(q[b].obj,q[b].prop,q[b].params.duration,q[b].params.speed,q[b].onMorphInit,this);if(f&&c==undefined){e.cssText=f}}return this};this.concat=function(h,c,e,f,a,g,b){if(!h.pop&&!h.item){h=[h]}if(!e){e={}}for(var d=h.length;d--;){if(typeof h[d]=="string"){h[d]=document.getElementById(h[d])}q[q.length]={obj:h[d],objStyle:h[d].style,prop:c,params:{duration:e.duration||500,delay:e.delay||0,speed:e.speed!=undefined?e.speed:1,doEnd:e.doEnd!=undefined?e.doEnd:true},ease:f||function(i){return i},onMorphInit:a,onMorph:g,onMorphEnd:b};this.init(true)}return this};if(r){this.concat(r,x,t,s,o,p,v)}this.stop=function(a){window.clearTimeout(this.timer)};this.start=function(d){var e=w();if(d&&(d.pop||d.item)){arguments=d}for(var c=[],b=arguments.length;b--;){for(var a=q.length;a--;){if(q[a].obj==arguments[b]){q[a].newTime=this.timer?e:0.1;c[a]=true}}}window.clearTimeout(this.timer);u(this.timer?e:w(true),w,this.backwards,1,q,c.length?c:null,this);return this}};var button=document.getElementById("button");if(button){var myButton=new jsMorph(button,{width:"151px",height:"151px",right:"-82px",top:"45px"},{delay:1000},function(a){return --a*a*((2.7)*a+1.7)+1}).start();button.onclick=myButton.start}var accordeon=function(d,g,c,a){var f=d.getElementsByTagName(c||"h2"),e=d.getElementsByTagName(a||"span"),b=new jsMorph();for(var h=f.length;h--;){b.concat(e[h],{height:"0px"},{duration:g},function(i){return --i*i*i*i*i+1},null,null,function(i){i.backwards=i.backwards?false:true});f[h].me=h;if(h){e[h].backwards=true;e[h].style.height="0px"}else{d.current=h}}d.onclick=function(j){var j=j||window.event,i=j.target||j.srcElement;if(i.tagName.toLowerCase()==(c||"h2")&&i.me!=d.current&&!b.timer){b.start(e[i.me],e[d.current]);d.current=i.me}}};var accordeonDemo=document.getElementById("demoBox");if(accordeonDemo){accordeon(accordeonDemo,300,null,"div")}var demoCount=0,myMorph=[],demo=document.getElementById("demo_"+(++demoCount));if(demo){myMorph[demoCount]=new jsMorph(demo,{left:"200px"}).start();demo.onclick=myMorph[demoCount].start}demo=document.getElementById("demo_"+(++demoCount));if(demo){myMorph[demoCount]=new jsMorph(demo,{left:"200px"},{duration:650},function(a){return --a*a*a+1});demo.onclick=myMorph[demoCount].start}demo=document.getElementById("demo_"+(++demoCount));if(demo){myMorph[demoCount]=new jsMorph(demo,{left:"350px",height:"40px",width:"80px","border-width":"6px"},{duration:600},function(b){var a=1.70158;return(b=b-1)*b*((a+1)*b+a)+1},null,null,function(a){a.backwards=a.backwards?false:true});demo.onclick=myMorph[demoCount].start}demo=document.getElementById("demo_"+(++demoCount));if(demo){myMorph[demoCount]=new jsMorph(demo,{left:"50%",height:"7em",width:"280px","border-width":"6px","margin-left":"-140px"},{duration:600},function(a){return --a*a*a+1}).concat(demo,{top:"95px"},{delay:220},function(a){if((a/=1)<(1/2.75)){return 7.5625*a*a}else{if(a<(2/2.75)){return 7.5625*(a-=(1.5/2.75))*a+0.75}else{if(a<(2.5/2.75)){return 7.5625*(a-=(2.25/2.75))*a+0.9375}else{return 7.5625*(a-=(2.625/2.75))*a+0.984375}}}},null,null,function(a){a.backwards=a.backwards?false:true});demo.onclick=myMorph[demoCount].start;window.onresize=function(){myMorph[demoCount].init()}}demo=document.getElementById("demoWrap");if(demo){demo=demo.getElementsByTagName("div");myMorph[++demoCount]=new jsMorph(demo,{bottom:"-44px",height:"100px","border-top-width":"8px"},{duration:150},function(a){return --a*a*a+1},null,function(e,a,d,g,b,h,f,c){e.firstChild.data=d},function(a){a.backwards=a.backwards?false:true}).concat(demo[demo.length-1],{left:"100px"},{duration:150},function(a){return --a*a*a+1});for(var n=demo.length;n--;){demo[n].onclick=function(){myMorph[demoCount].start(this)}}}var demo=document.getElementById("demo_9"),fps=document.getElementById("fps"),recycle=function(a,c,b){a.reset(c,{width:b+"px"},{duration:450,speed:3},function(d){return --d*d*d+1},function(d){fps.firstChild.data=(1000/d.speed).toFixed(2)+" fps "}).start()};if(demo){myMorph[7]=new jsMorph();demo.onclick=function(){window.setInterval(function(){recycle(myMorph[7],demo,Math.random()*600)},1000);this.onclick=null}}if(document.getElementById("unitDemo")){var myDemoMorph=new jsMorph("unitDemo",{width:"1px",height:"1px","border-width":"1px",padding:"1px","margin-left":"1px"},null,null,function(b,c){var a=document.getElementById("demo-console");for(n in b){if(n!="speed"){a.innerHTML+=n+": "+b[n].full+"px<br />"}}})}if(document.getElementById("slide")){var scewSlide=function(i,v,h,o,d,a,q,j,f,c,s){var p=[],r,g,u,l=j%2,t,b,e=v.parentNode;d=d||10;q=typeof q!=undefined?q:40;a=(a||800)-((d-1)*q);t=(s?v.offsetWidth:v.offsetHeight)/d;b=t*d%d?1:0;for(var k=0;k<d;k++){if(!scewSlide.slizes||scewSlide.slizes<k){scewSlide.slizes=k;e.appendChild(p[k]=document.createElement("div"))}else{p[k]=e.children[k+1]}u=(l?d-k:k);if(f){u=(k<=d/2)?Math.round(d-u-(!l?d/2:0))-1:Math.round(u-(!l?d/2:0))}p[k].style.cssText=!(s%2)?"position:absolute;left:0px;top:"+(t*k)+"px;height:"+(t+b)+"px;width:100%;background: url("+v.src+") no-repeat 0 -"+(t*k)+"px;":"position:absolute;top:0px;left:"+(t*k)+"px;width:"+(t+b)+"px;height:100%;background: url("+v.src+") no-repeat -"+(t*k)+"px 0;";r={duration:a,delay:u*q};g=s&&!(s<2)?{top:j%4<2?"100%":"-100%"}:{left:j%4<2?"100%":"-100%"};if(c){g=s&&!(s<2)?{top:k%2?"100%":"-100%"}:{left:k%2?"100%":"-100%"}}i.concat(p[k],g,r,o)}v.src=null;v.src=h},img=document.getElementById("slide").children[0],myMorhp,timer,cubicEaseIn=function(a){return a*a*a},backEaseIn=function(b){var a=1.70158;return b*b*((a+1)*b-a)},images=["Garten.jpg","Wald.jpg","Wasserfall.jpg","Frangipani.jpg"],current=0,ease=cubicEaseIn,counter=1;window.onload=function(){var a=new jsMorph(),b=function(i,g,h,f){var e=Math.floor(Math.random()*2),d=Math.floor(Math.random()*4),c=Math.floor(Math.random()*5);a.reset();if(counter>30){counter=0}if(!counter++){current%=4;scewSlide(a,img,"demos/"+images[current++],ease,1,600,35,c,e,e,d)}else{if((current%=4)){ease=ease==backEaseIn?cubicEaseIn:backEaseIn}scewSlide(a,img,"demos/"+images[current++],ease,25,1300,35,c,e,e,d)}};img.onload=function(){a.start()};document.onclick=function(){if(a.onMorphEnd){a.onMorphEnd=null}else{a.onMorphEnd=b;a.start()}};a.onMorphEnd=b;scewSlide(a,img,"demos/"+images[current++],ease,1,600,35,Math.floor(Math.random()*5),Math.floor(Math.random()*2),Math.floor(Math.random()*2),Math.floor(Math.random()*4))}}var bounce=document.getElementById("bounce");if(bounce){var myMorph=new jsMorph(bounce,{left:"600px"},{duration:3000,delay:0},function(a){return --a*a*a+1}).concat(bounce,{top:(bounce.parentNode.offsetHeight-bounce.offsetTop-51)+"px"},{duration:1500,delay:0},function(a){if((a/=1)<(1/2.75)){return 7.5625*a*a}else{if(a<(2/2.75)){return 7.5625*(a-=(1.5/2.75))*a+0.75}else{if(a<(2.5/2.75)){return 7.5625*(a-=(2.25/2.75))*a+0.9375}else{return 7.5625*(a-=(2.625/2.75))*a+0.984375}}}}).concat(bounce,{height:"37px",width:"64px","margin-top":"24px"},{duration:80,delay:550}).concat(bounce,{height:"51px",width:"51px","margin-top":"0px"},{duration:100,delay:650}).concat(bounce,{height:"41px",width:"59px","margin-top":"12px"},{duration:80,delay:1020}).concat(bounce,{height:"51px",width:"51px","margin-top":"0px"},{duration:90,delay:1090});bounce.onclick=myMorph.start}var menu=document.getElementById("menu");if(menu){var links=menu.getElementsByTagName("a"),myMorph=new jsMorph(links,{height:"35px","border-bottom-width":"18px","border-top-width":"10px","margin-bottom":"-18px","margin-top":"-10px","padding-top":"24px"},{duration:300,delay:0,speed:1,doEnd:true},function(a){return --a*a*a*a*a+1});menu.onmouseout=menu.onmouseover=function(b){var b=b||window.event,a=b.target||b.srcElement;if(a.tagName.toLowerCase()=="a"){a.backwards=b.type=="mouseover"?false:true;myMorph.start(a)}}}var chart=document.getElementById("chart");if(chart){var bars=chart.getElementsByTagName("div"),delay=document.getElementById("delay"),bouncer=document.getElementById("bouncer"),myMorph=new jsMorph(),update=function(e,c,f,a,g,d,b){e.reset();for(var h=c.length;h--;){e.concat(c[h],{"margin-top":(f?f[h]*(a||1):(Math.random()*(a||1)))+"px"},{duration:(g!=undefined?g:800),delay:h*(d||0)},!b?function(i){return --i*i*i*i*i+1}:function(i){if((i/=1)<(1/2.75)){return 7.5625*i*i}else{if(i<(2/2.75)){return 7.5625*(i-=(1.5/2.75))*i+0.75}else{if(i<(2.5/2.75)){return 7.5625*(i-=(2.25/2.75))*i+0.9375}else{return 7.5625*(i-=(2.625/2.75))*i+0.984375}}}})}e.start()},adjBars=function(){var a=bars.length,b;for(var c=Math.abs(this.value-a);c--;){if(this.value<a){chart.removeChild(bars[c])}else{chart.insertBefore(document.createElement("div"),bars[0])}}};document.getElementById("amount").onchange=adjBars;update(myMorph,bars,null,200,800,delay.checked?100:0,bouncer.checked);window.setInterval(function(){update(myMorph,bars,null,200,800,delay.checked?100:0,bouncer.checked)},3500)}var loadSpinner=document.getElementById("loadSpinner");if(loadSpinner){var createSpin=function(f,a,g,c){var b="",e=(f.offsetHeight-g)/2;for(var h=a;h--;){b+='<div style="position:absolute;left:'+(e*Math.sin(h*2*Math.PI/a)+e)+"px;top:"+(e*Math.cos(h*2*Math.PI/a)+e)+"px;height:"+g+"px;width:"+g+"px;background-color:"+c+";border-radius:"+g+"px;-moz-border-radius:"+g+"px;-o-border-radius:"+g+'px;line-height:0;overflow:hidden;">&nbsp;</div>'}f.innerHTML=b}(loadSpinner,12,12,"#91B39F"),circles=loadSpinner.childNodes,cN=circles.length,count=0,myMorph=new jsMorph(circles,{opacity:0,width:"1px",height:"1px"},{duration:1000});window.setInterval(function(){myMorph.start(circles[count++]);if(count>=cN){count=0}},70)}var iPhone=document.getElementById("iPhone");if(iPhone){var leftScreen=document.getElementById("leftScreen"),dets=leftScreen.getElementsByTagName("div"),detButtons=[],rightScreen=document.getElementById("rightScreen"),bottomScreen=document.getElementById("bottomScreen"),bk=function(a){a.backwards=a.backwards?false:true},ease=function(a){return -(--a*a*a*a-1)},props={duration:300},myMorph=new jsMorph();for(var n=dets.length,m=0;n--;){if(dets[n].className.match(/list$/)){detButtons[m++]=dets[n]}}myMorph.concat(bottomScreen,{top:"0%"},null,ease,null,null,bk).concat(rightScreen,{left:"0%"},props,ease,null,null,bk).concat(leftScreen,{left:"-100%"},props,ease,null,null,bk).concat(detButtons,{height:"0px"},{duration:250},ease,null,null,bk);iPhone.onclick=function(b){var b=b||window.event,a=b.target||b.srcElement;if(a.id){if(a.id.match(/(edit|done)$/)){myMorph.start(bottomScreen)}else{if(a.id.match(/doneRight/)){myMorph.start([leftScreen,rightScreen])}else{if(a.id.match(/filter/)){myMorph.start(detButtons)}}}}else{if(a.className.match(/det/)||a.parentNode.className.match(/det/)){myMorph.start([leftScreen,rightScreen])}}}}var slides=document.getElementById("slides");if(slides){var dots=document.getElementById("dots"),slideInit=function(e,b){var d=e.children,c=b.children,a=d.length,g="";for(var f=a;f--;){d[f].style.cssText+=";left:"+(f*100)+"%;";if(f){g+="<div></div>"}}e.current=0;b.innerHTML='<div class="dots-high"></div>'+g;for(var f=c.length;f--;){c[f].current=f+1}},slide=function(b,e,a,d){var c=e.children,g=a.children;e.current=e.current>=c.length-1?0:e.current+1;for(var f=g.length;f--;){g[f].className=e.current==f?"dots-high":""}b.reset(c,{"margin-left":"-"+(e.current*100)+"%"},{duration:d,speed:6},function(h){if((h*=2)<1){return 0.5*h*h*h*h*h}return 0.5*((h-=2)*h*h*h*h+2)}).start()},slideTime,initInterval=function(){slideTime=window.setInterval(function(){slide(myMorph,slides,dots,900)},6000)},myMorph=new jsMorph();dots.onmouseout=dots.onclick=function(b){var b=b||window.event,a=b.target||b.srcElement;if(b.type=="click"){if(!a.current){return}window.clearInterval(slideTime);slideTime=null;slides.current=a.current-2;slide(myMorph,slides,dots,900);return false}else{if(!slideTime){initInterval()}}};slideInit(slides,dots);initInterval()};
