/*!
 * Add to Homescreen v2.0.7 ~ Copyright (c) 2013 Matteo Spinelli, http://cubiq.org
 * Released under MIT license, http://cubiq.org/license
 */
var addToHome=function(n){function ut(){if(b){var t=Date.now(),f;if(n.addToHomeConfig)for(f in n.addToHomeConfig)i[f]=n.addToHomeConfig[f];i.autostart||(i.hookOnLoad=!1),u=/ipad/gi.test(e.platform),k=n.devicePixelRatio&&n.devicePixelRatio>1,d=/Safari/i.test(e.appVersion)&&!/CriOS/i.test(e.appVersion),g=e.standalone,r=e.appVersion.match(/OS (\d+_\d+)/i),r=r&&r[1]?+r[1].replace("_","."):0,s=+n.localStorage.getItem("addToHome"),y=n.sessionStorage.getItem("addToHomeSession"),c=i.returningVisitor?s&&s+24192e5>t:!0,s||(s=t),v=c&&s<=t,i.hookOnLoad?n.addEventListener("load",a,!1):!i.hookOnLoad&&i.autostart&&a()}}function a(){if(n.removeEventListener("load",a,!1),c?i.expire&&v&&n.localStorage.setItem("addToHome",Date.now()+i.expire*6e4):n.localStorage.setItem("addToHome",Date.now()),nt||d&&v&&!y&&!g&&c){var f="",s=e.platform.split(" ")[0],o=e.language.replace("-","_");t=document.createElement("div"),t.id="addToHomeScreen",t.style.cssText+="left:-9999px;-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0;-webkit-transform:translate3d(0,0,0);position:"+(r<5?"absolute":"fixed"),i.message in l&&(o=i.message,i.message=""),i.message===""&&(i.message=o in l?l[o]:l.en_us),i.touchIcon&&(f=k?document.querySelector('head link[rel^=apple-touch-icon][sizes="114x114"],head link[rel^=apple-touch-icon][sizes="144x144"],head link[rel^=apple-touch-icon]'):document.querySelector('head link[rel^=apple-touch-icon][sizes="57x57"],head link[rel^=apple-touch-icon]'),f&&(f='<span style="background-image:url('+f.href+')" class="addToHomeTouchIcon"><\/span>')),t.className=(u?"addToHomeIpad":"addToHomeIphone")+(f?" addToHomeWide":""),t.innerHTML=f+i.message.replace("%device",s).replace("%icon",r>=4.2?'<span class="addToHomeShare"><\/span>':'<span class="addToHomePlus">+<\/span>')+(i.arrow?'<span class="addToHomeArrow"><\/span>':"")+(i.closeButton?'<span class="addToHomeClose">×<\/span>':""),document.body.appendChild(t),i.closeButton&&t.addEventListener("click",it,!1),!u&&r>=6&&window.addEventListener("orientationchange",rt,!1),setTimeout(ft,i.startDelay)}}function ft(){var e,s=208;if(u){r<5?(f=n.scrollY,o=n.scrollX):r<6&&(s=160),t.style.top=f+i.bottomOffset+"px",t.style.left=o+s-Math.round(t.offsetWidth/2)+"px";switch(i.animationIn){case"drop":e="0.6s",t.style.webkitTransform="translate3d(0,"+-(n.scrollY+i.bottomOffset+t.offsetHeight)+"px,0)";break;case"bubble":e="0.6s",t.style.opacity="0",t.style.webkitTransform="translate3d(0,"+(f+50)+"px,0)";break;default:e="1s",t.style.opacity="0"}}else{f=n.innerHeight+n.scrollY,r<5?(o=Math.round((n.innerWidth-t.offsetWidth)/2)+n.scrollX,t.style.left=o+"px",t.style.top=f-t.offsetHeight-i.bottomOffset+"px"):(t.style.left="50%",t.style.marginLeft=-Math.round(t.offsetWidth/2)-(n.orientation%180&&r>=6?40:0)+"px",t.style.bottom=i.bottomOffset+"px");switch(i.animationIn){case"drop":e="1s",t.style.webkitTransform="translate3d(0,"+-(f+i.bottomOffset)+"px,0)";break;case"bubble":e="0.6s",t.style.webkitTransform="translate3d(0,"+(t.offsetHeight+i.bottomOffset+50)+"px,0)";break;default:e="1s",t.style.opacity="0"}}t.offsetHeight,t.style.webkitTransitionDuration=e,t.style.opacity="1",t.style.webkitTransform="translate3d(0,0,0)",t.addEventListener("webkitTransitionEnd",w,!1),h=setTimeout(p,i.lifespan)}function et(n){b&&!t&&(nt=n,a())}function p(){if(clearInterval(tt),clearTimeout(h),h=null,t){var e=0,l=0,c="1",s="0";i.closeButton&&t.removeEventListener("click",it,!1),!u&&r>=6&&window.removeEventListener("orientationchange",rt,!1),r<5&&(e=u?n.scrollY-f:n.scrollY+n.innerHeight-f,l=u?n.scrollX-o:n.scrollX+Math.round((n.innerWidth-t.offsetWidth)/2)-o),t.style.webkitTransitionProperty="-webkit-transform,opacity";switch(i.animationOut){case"drop":u?(s="0.4s",c="0",e+=50):(s="0.6s",e+=t.offsetHeight+i.bottomOffset+50);break;case"bubble":u?(s="0.8s",e-=t.offsetHeight+i.bottomOffset+50):(s="0.4s",c="0",e-=50);break;default:s="0.8s",c="0"}t.addEventListener("webkitTransitionEnd",w,!1),t.style.opacity=c,t.style.webkitTransitionDuration=s,t.style.webkitTransform="translate3d("+l+"px,"+e+"px,0)"}}function it(){n.sessionStorage.setItem("addToHomeSession","1"),y=!0,p()}function w(){if(t.removeEventListener("webkitTransitionEnd",w,!1),t.style.webkitTransitionProperty="-webkit-transform",t.style.webkitTransitionDuration="0.2s",!h){t.parentNode.removeChild(t),t=null;return}r<5&&h&&(tt=setInterval(ot,i.iterations))}function ot(){var i=new WebKitCSSMatrix(n.getComputedStyle(t,null).webkitTransform),r=u?n.scrollY-f:n.scrollY+n.innerHeight-f,e=u?n.scrollX-o:n.scrollX+Math.round((n.innerWidth-t.offsetWidth)/2)-o;(r!=i.m42||e!=i.m41)&&(t.style.webkitTransform="translate3d("+e+"px,"+r+"px,0)")}function st(){n.localStorage.removeItem("addToHome"),n.sessionStorage.removeItem("addToHomeSession")}function rt(){t.style.marginLeft=-Math.round(t.offsetWidth/2)-(n.orientation%180&&r>=6?40:0)+"px"}var e=n.navigator,b="platform"in e&&/iphone|ipod|ipad/gi.test(e.platform),u,k,d,g,r,o=0,f=0,s=0,v,y,c,t,nt,tt,h,i={autostart:!0,returningVisitor:!1,animationIn:"drop",animationOut:"fade",startDelay:2e3,lifespan:15e3,bottomOffset:14,expire:0,message:"",touchIcon:!1,arrow:!0,hookOnLoad:!0,closeButton:!0,iterations:100},l={en_us:"Install this web app on your %device: tap %icon and then <strong>Add to Home Screen<\/strong>."};return ut(),{show:et,close:p,reset:st}}(window)