window.addEvent('domready',function(){time=7000;featured_options=[{},{'preview':'grove-cottages','url':'http://www.grove-cottages.co.uk/','info':'/projects/cottage agency/'},{'preview':'pet-prescription','url':'http://www.petprescription.co.uk/','info':'/projects/pet products/'},{'preview':'griptight','url':'http://www.griptight.com/','info':'/projects/baby products/'},{'preview':'which-warehouse','url':'http://www.whichwarehouse.com/','info':'/projects/warehouse space/'}];animation=animate.delay(time);morth=null});function animate(){animation=true;morth=new Fx.Morph($$('#featured .featured_content')[0],{onComplete:function(e){var eclone=e.clone();eclone.setStyle('margin-top',0);eclone.inject($$('#featured .wrapper')[0]);e.dispose();setCurrent($$('#featured .featured_content')[0].className.split(" ")[1]);if(animation)animation=animate.delay(time)},transition:Fx.Transitions.Quint.easeIn,duration:1000}).start({"margin-top":[0,-154]})}window.addEvent('domready',function(){$$('#featured_nav A').each(function(el){el.onclick=function(){viewService(el.id);return false}})});function setCurrent(target){$$('#featured_nav A').each(function(el){el.className=''});$(target).className="current";var inx=$$('#featured .featured_content')[0].className.split(" ")[1].substr(4);$('featured_image').src="http://images.ansta.co.uk/featured/"+featured_options[inx].preview+"-1.png";$('featured_links_more').href=featured_options[inx].info;$('featured_links_site').href=featured_options[inx].url}function viewService(target){clearTimeout(animation);animation=null;if(morth)morth.cancel();$$('#featured .featured_content').each(function(el){el.setStyle('margin-top',0)});while($$('#featured .featured_content')[0].className.split(" ")[1]!=target){$$('#featured .featured_content')[0].clone().inject($$('#featured .wrapper')[0]);$$('#featured .featured_content')[0].dispose()}setCurrent(target);animation=animate.delay(time*10)}window.addEvent('domready',function(){if(!$('facebook_iframe'))return;$('facebook_iframe').allowTransparency=true;$('facebook_iframe').style.backgroundColor='transparent'});var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-6881230-1']);_gaq.push(['_trackPageview']);window.addEvent('domready',function(){$$('a[href^=mailto:]').addEvent('click',function(el){var email=this.href.split(":")[1];try{_gaq.push(['_trackEvent','Links','mailto',email])}catch(e){if(console)console.log(e)}});$$('a[rel=external]').addEvent('click',function(el){var exit=this.href;try{_gaq.push(['_trackEvent','Links','external link',exit])}catch(e){if(console)console.log(e)}})});(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src=('https:'==document.location.protocol?'https://ssl':'http://www')+'.google-analytics.com/ga.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s)})();
