FLIR.init({path:epic.cdn_url+'facelift/'});(function($){function rotateSlide(span,list){var d=list.data('d');if(d.moving)return;if(span!=null&&span.className=='left')var dir='l';else var dir='r';d.moving=true;var items=list.children('li');margin='-'+d.width+'px';var item=items.get(0);if(dir=='l'){item=items.get(items.length-1);var p=item.parentNode;p.removeChild(item);$(item).css('marginLeft',margin);p.insertBefore(item,items.get(0));margin='0px';}
$(item).animate({marginLeft:margin},d.speed,'easeOutExpo',function(){d.moving=false;if(dir=='r'){var n=items.get(0);var p=n.parentNode;p.removeChild(n);$(n).css('marginLeft','');p.appendChild(n);}
if(d.autoRotate){d.timer=setTimeout(function(){rotateSlide(null,list);},d.autoRotate);}});if(span!=null){if(d.timer)clearTimeout(d.timer);d.autoRotate=false;}}
function makeSlide(list,options){var s=$(list);var h=0;var w=0;var tw=0;s.find('img').each(function(idx,item){var t=item.height;if(t>h)h=t;t=item.width;if(t>w)w=t;tw+=w;});s.wrap('<div class="slide" style="height: '+h+'px; width: '+w+'px;"></div>');s.before('<span class="left"></span>').after('<span class="right"></span>');s.css('width',tw+'px');var i=s.children();i.each(function(idx,o){$(o).css('float','left');});var d=$.extend({width:w,height:h,list:s,current:0,autoRotate:2000,speed:1000},options);var s=$(s).data('d',d);s.parent().find('span').click(function(){rotateSlide(this,s);});if(d&&d.autoRotate){s.data('d').timer=setTimeout(function(){rotateSlide(null,s);},d.autoRotate);}}
$.fn.quickSlide=function(options){this.each(function(idx,obj){makeSlide(obj,options);});}
$.fn.niceQuotes=function(){var fs=new FLIRStyle({cFont:'futura-book-oblique',realFontHeight:true,cSize:20,mode:'wrap'});this.each(function(idx,obj){var h=$(obj).html();$(obj).html($.trim(h).replace('`','<img src="/img/open-quote.png">').replace('´','<img src="/img/close-quote.png">'));FLIR.replace(this,fs);});};$('blockquote').niceQuotes();$('ul.slide').quickSlide();})(jQuery);;(function($){var c=$("#productsContainer");var h=$("#productsHolder");var ps=$("#productsHolder ul");var psw=ps.width();function scrollRight(){var cw=c.width();var hw=h.width();var m=c.css("margin-left");m=parseInt(m.substr(0,m.length-2),10)-106;if(m<(hw)-cw)
m=(hw)-cw;c.animate({marginLeft:m+'px'},250);}
function scrollLeft(){var hw=h.width();var m=c.css("margin-left");m=parseInt(m.substr(0,m.length-2),10)+106;if(m>0)
m=0;c.animate({marginLeft:m+'px'},250);}
function applyFilter(){var sc=0;$('.products_filter li').addClass('dis');var cat=$('#product-categories li');var org=$('#product-origins-1 li, #product-origins-2 li');var frm=$('#product-forms li');ps.each(function(index,element){var showc=false;for(var i=0;i<categories.length;i++){if(categories[i][1]&&products[index][1]==categories[i][0]){showc=true;break;}}
var showo=false;for(var i=0;i<origins.length;i++){if(origins[i][1]&&products[index][2]==origins[i][0]){showo=true;break;}}
var showf=false;for(var i=0;i<forms.length;i++){if(forms[i][1]&&products[index][3]==forms[i][0]){showf=true;break;}}
$(element).animate({width:(showc&&showo&&showf)?"52px":"0px"},500);products[index][4]=(showc&&showo&&showf);sc+=(showc&&showo&&showf)?1:0;});for(var i=0;i<products.length;i++){if(!products[i][4])continue;for(var j=0;j<categories.length;j++){if(products[i][1]==categories[j][0]){$(cat.get(j)).removeClass('dis');break;}}
for(var j=0;j<origins.length;j++){if(products[i][2]==origins[j][0]){$(org.get(j)).removeClass('dis');break;}}
for(var j=0;j<forms.length;j++){if(products[i][3]==forms[j][0]){$(frm.get(j)).removeClass('dis');break;}}}
c.animate({width:(sc*psw)+'px',marginLeft:'0px'},500);}
function toggleCategory(){var k=0,e=this;while(e=e.previousSibling){if(e.nodeType==1)++k;}
$(this).toggleClass('off');categories[k][1]=(categories[k][1]+1)%2;applyFilter();}
function toggleOrigin(offset){var k=0,e=this;while(e=e.previousSibling){if(e.nodeType==1)++k;}
$(this).toggleClass('off');origins[k+offset][1]=(origins[k+offset][1]+1)%2;applyFilter();}
function toggleForm(){var k=0,e=this;while(e=e.previousSibling){if(e.nodeType==1)++k;}
$(this).toggleClass('off');forms[k][1]=(forms[k][1]+1)%2;applyFilter();}
c.width(ps.length*psw);$("#rightArrow").click(scrollRight);$("#leftArrow").click(scrollLeft);$("#product-categories li").click(toggleCategory);$("#product-origins-1 li").click(function(){toggleOrigin.call(this,0)});$("#product-origins-2 li").click(function(){toggleOrigin.call(this,7)});$("#product-forms li").click(toggleForm);})(jQuery);FLIR.replace('h2.f1',new FLIRStyle({realFontHeight:true,mode:'wrap'}));FLIR.replace('h2.f2',new FLIRStyle({realFontHeight:true,mode:'wrap'}));FLIR.replace('h3',new FLIRStyle({realFontHeight:true}));