var DEBUG_MODE=false;var VERBOSE=false;var mylib={log:function(a){try{if(DEBUG_MODE&&typeof console!="undefined"){if(typeof a=="Exception"){console.error(a)}else{console.info(a)}}}catch(a){return false}},searchTool:function(){if(VERBOSE){mylib.log("Adding handlers to search box")}try{$("#q").focus(function(){$(this).attr("size",30)});$("#q").blur(function(){$(this).attr("size",20)})}catch(a){return false}}};var render={heading:function(h){var d=new Array(12,25,18,15,14);var c;var g;var f;var b;var a;$(h).each(function(){if($(this).parent().parent().hasClass("description")||$(this).parent().hasClass("award")){return}g=$.trim($(this).text());f=$.inArray(this.nodeName,["default","H1","H2","H3","H4"]);$elementNode=$(this);c=$elementNode.has("A");if(f>0){a=d[f]}else{a=d[0]}switch(this.nodeName.toLowerCase()){case"h2":case"h3":case"h4":g=g.toLowerCase();break;default:break}if(VERBOSE){mylib.log("Heading found = "+g)}b='<img src="/lib/ir/'+a.toString()+"/"+escape(g.replace(/ /g,"+"))+'" alt="'+g+'" />';if(c.length){$elementNode=$elementNode.find("a");$elementNode.parent().addClass("rendered")}else{$elementNode.addClass("rendered")}$elementNode.empty();$elementNode.append(b)})}};var slideshow={alt:Array,current:Number,el:Object,filetype:String,items:Array,placeholder:String,prefix:String,runningTime:Number,total:Number,urls:Array,load:function(b){if(document.images&&document.getElementById(b)){var a=new Image();this.timer(0);this.current=new Number(0);this.placeholder=new String(b);this.filetype=new String(".jpg");this.prefix=new String("/lib/img/banners/front/");this.items=new Array("body-moisturisers.jpg","peoples-hero.jpg","2012-heroes.jpg");this.alt=new Array("New Dr.Hauschka Body Moisturisers","Your favourite.. Once again Rose Day Cream has been voted the product that your skin can't live without.","View the 2012 Hero products collection!");this.urls=new Array("/products/body-care/moisturisers","/products/face-care/rose-day-cream","/products/hero");for(i=0;i<this.items.length;i++){this.items[i]=this.prefix.concat(this.items[i]);a.src=this.items[i]}this.total=this.items.length;return true}return false},run:function(){this.el=document.getElementById(this.placeholder);if(this.current==this.total){this.current=0}this.el.setAttribute("src",this.items[this.current]);this.el.setAttribute("alt",this.alt[this.current]);this.el.setAttribute("height","276");this.el.parentNode.setAttribute("href",this.urls[this.current]);this.blendimage(1000);this.current++;setTimeout("slideshow.run()",8000);return true},blendimage:function(a){var b=Math.round(a/100);var c=0;this.el.style.backgroundImage="url("+this.el.src+")";this.opacity(0);this.el.src=this.items[this.current];for(i=0;i<=100;i++){setTimeout("slideshow.opacity("+i+")",(c*b));c++}return true},opacity:function(b){var a=this.el.style;a.opacity=(b/100);a.MozOpacity=(b/100);a.KhtmlOpacity=(b/100);a.filter="alpha(opacity="+b+")"},timer:function(a){this.runningTime=a;a+=1;setTimeout("slideshow.timer("+a+")",1000)}};try{$("document").ready(function(){$("button, input:submit").button();mylib.searchTool();render.heading("H1");render.heading("H2");if(slideshow.load("rotating")){slideshow.run()}})}catch(e){mylib.log(e)};
