/* Copyright 2009 FriendFeed */

(function(){var M=window.innerWidth||(document.documentElement&&document.documentElement.clientWidth);if(!window.__duckMyLife&&M){window.__duckMyLife=true;var V=9;var L=4000;var U=62;var E="/static/images/themes/duckhunt/";var R="?v=1";var S="__duckMyLifePlayer";var A=null;var P=null;var C=null;var N=null;var J=null;function H(a,X,Y,Z){var b=document.createElement("div");var W=b.style;W.position="fixed";W.border="0";W.padding="0";W.left="0";W.top="0";W.lineHeight="0";W.width=X+"px";W.height=Y+"px";W.background="url('"+E+a+R+"') no-repeat top left";W.zIndex=100000+(Z||0);W.display="none";document.body.appendChild(b);return b}function K(){if(window.innerWidth){return{width:window.innerWidth,height:window.innerHeight}}return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function D(){return(new Date()).getTime()}function I(){var X=K();J=Math.round(Math.random()*X.height/2);A.style.left=(X.width+U)+"px";A.style.top=J+"px";A.style.display="";if(N){window.clearInterval(N)}var W=D();var Y=X.width+U;var Z=X.width*9;N=window.setInterval(function(){var a=(D()-W)/Z;if(a>=1){window.clearInterval(N);A.style.display="none";window.setTimeout(I,L);return }A.style.left=Math.round((Y+U)*(1-a)-U)+"px"},10)}function Q(W){window.clearInterval(N);var W=W||window.event;C.style.left=(W.clientX-20)+"px";C.style.top=(W.clientY-20)+"px";C.style.display="";G("gunshot");window.setTimeout(T,150);window.setTimeout(function(){G("quack")},500)}function T(Y){A.style.display="none";P.style.left=A.style.left;P.style.top=A.style.top;P.style.display="";var W=D();var X=(K().height-J)*(V*0.4);window.setTimeout(B,1000);N=window.setInterval(function(){var Z=(D()-W)/X;if(Z>=1){window.clearInterval(N);P.style.display="none";window.setTimeout(I,L);return }P.style.top=Math.round(J+Z*(K().height-J))+"px"},10)}function B(){var W=D();fadeInterval=window.setInterval(function(){var X=(D()-W)/500;if(X>=1){C.style.display="none";window.clearInterval(fadeInterval);C.style.opacity=1;C.style.filter="alpha(opacity=100)";return }C.style.opacity=1-X;C.style.filter="alpha(opacity="+Math.round(100*(1-X))+")"},10)}function F(){A=H("duck.png",U,97);P=H("duck-dead.png",U,97);C=H("gunshot.png",40,40,1);O(S,E+"DuckMyLife.swf"+R);A.style.cursor="crosshair";A.onclick=Q;I()}function O(a,X){var Y="1px";var Z="1px";var W=document.createElement("div");W.style.width=Y;W.style.height=Z;document.getElementsByTagName("body")[0].appendChild(W);if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){W.innerHTML='<embed type="application/x-shockwave-flash" src="'+X+'" width="'+Y+'" height="'+Z+'" id="'+a+'" name="'+a+'" wmode="transparent" quality="high" menu="false" allowScriptAccess="always"/>'}else{W.innerHTML='<object id="'+a+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+Y+'" height="'+Z+'"><param name="movie" value="'+X+'"><param name="wmode" value="transparent"/><param name="quality" value="high"/><param name="menu" value="false"/><param name="allowScriptAccess" value="always"/></object>'}}function G(X){var W=document.getElementById(S);if(!W){return }try{W[X]()}catch(Y){}}window.setTimeout(F,100)}})();

