var _locale=window.location.pathname.match(/^\/((\w{2})-(\w{2}))/);_locale={language:_locale.length&&_locale.length>=3?_locale[2]:"en",region:_locale.length&&_locale.length>=4?_locale[3]:"us"};var setHeight=function(b,a){$(b).height(a)};var cufonize=function(a){Cufon.set("fontFamily","Bonnfire");if(a){switch(a){case"product-category":break;case"product-detail":Cufon.replace("#review-form form button",{hover:true,hoverables:{button:true}});Cufon.replace("#share-form form button",{hover:true,hoverables:{button:true}});Cufon.replace("a#review-link",{hover:true});break;case"community":Cufon.replace("li.filter a",{hover:true});Cufon.replace("#add-feedback",{hover:true});break;case"company":Cufon.replace("h5.cufon");break;case"team":Cufon.replace("li.filter a",{hover:true});break;case"team-detail":Cufon.replace("#gear h4");break;case"wishlist":Cufon.replace("#product-grid h4",{hover:false});Cufon.replace("#share-form form button",{hover:true,hoverables:{button:true}});break;case"search":Cufon.replace("#product-grid h4");break;default:break}}Cufon.replace("h1.cufon")("h2.cufon")("h3.cufon")("h4.cufon");Cufon.now()};$(document).ready(function(){var a=175,c=$("#nav-main .products"),b;$(document.body).addClass("js");initOverLabels();externalize();c.find("a:first").append('<span class="fade"></span>');b=c.find("#subnav, span.fade");c.mouseenter(function(d){b.stop(true,true);b.fadeIn(a)});c.mouseleave(function(d){b.stop(true,true);b.fadeOut(a)});$("#email-subscribe").submit(function(d){d.preventDefault();$.ajax({url:$(this).attr("action")+"?"+$(this).serialize(),success:function(){$("#email-subscribe").remove();$("#footer").prepend('<div id="email-subscribed">Thanks for signing up!</div>')}})})});var homepage=function(){var d=$('<a href="#prev">Previous</a>'),f=$('<a href="#next">Next</a>'),m=$('<ul><li><a href="#mens">Men</a></li><li><a href="#womens">Women</a></li><li><a href="#youth">Youth</a></li></ul>'),b=$("#best-of-bonfire ul"),j=b.find("li"),k,c,a=0,g;var n=48,l=5;$(document).ready(function(){k=j.width();c=j.size();b.css({visibility:"visible",position:"absolute",left:n+"px",margin:"0",top:"0",width:(k*c)+"px",zIndex:"1"})});var h=function(o){b.animate({left:(n-(k*(o)))+"px"},{duration:250});a=o;if(a<=0){d.hide()}else{d.show()}if(a+l>=c){f.hide()}else{f.show()}};var e=function(o){o.preventDefault();b.stop(true,true);if(o.target.href.split("#")[1]=="next"){h(a+1)}else{h(a-1)}};var i=function(o){o.preventDefault();b.stop(true,true);if(o.target.href){h(g[o.target.href.split("#")[1]])}};$("#best-of-bonfire").append($('<div id="best-prev"></div>').append(d)).append($('<div id="best-next"></div>').append(f));d.hide();d.click(e);f.click(e);g={mens:j.index(j.filter(".mens")),womens:j.index(j.filter(".womens")),youth:j.index(j.filter(".youth"))};$("#nav-best").append(m);m.click(i)};var productCategory=function(l,b,f,j){var a=$("#product-grid"),k=$('<div id="filters"></div>'),r,p,q,m,A,i,e=[],c=[],d="",o="",v="",z="",s=null,h={},y="a-z";var g=function(F,E){var C,G,D;if(F=="filter"){G=E.slice(0,E.indexOf("-"));D=E.slice(E.indexOf("-")+1);if(D=="all"){h[G]=null}else{h[G]=E}}C=e.clone(true);$.each(h,function(I,H){if(H){C=C.filter("li."+H)}});if(F=="sort"){y=E}else{E=y}var B=$(document.documentElement).hasClass("cufon-active")||$(document.body).hasClass("cufon-active")?".cufon-alt":"h4 a";switch(E){case"z-a":C.sort(function(I,H){return $(H).find(B).text().localeCompare($(I).find(B).text())});break;case"lowest":C.sort(function(I,H){return parseInt($(I).find(".likes span").text())-parseInt($(H).find(".likes span").text())});break;case"highest":C.sort(function(I,H){return parseInt($(H).find(".likes span").text())-parseInt($(I).find(".likes span").text())});break;case"a-z":default:C.sort(function(I,H){return $(I).find(B).text().localeCompare($(H).find(B).text())})}$("#product-grid").empty().append(C);if($(document.documentElement).hasClass("cufon-active")||$(document.body).hasClass("cufon-active")){C.find(".cufon").each(function(H,I){I.alt=$(I).children(".cufon-alt").text()})}Cufon.refresh("#product-grid h4")};var n=function(G){var F=$(G.target).closest("li"),C,B=F.find("ul"),E;if(F.size()){if(B.size()){F=null}else{B=F.closest("ul");F=F[0].tagName.toLowerCase()=="a"?F:F.find("a");C=F.closest("div").attr("id")}if(F&&C){g(C,F[0].href.split("#")[1])}if(s&&B[0]&&s[0]==B[0]){s.siblings("strong").removeClass("open");if(F&&C=="sort"){var D=$("#sort .on");D.text(D.siblings("ul")[0].className);D.removeClass("on")}if(F){if(F.text().toLowerCase()=="view all"){s.siblings("strong").text(s[0].className).removeClass("on");Cufon.replace("li.filter strong")}else{s.siblings("strong").text(F.text()).addClass("on");Cufon.replace("li.filter strong")}}s.slideUp("fast");s=null}else{if(s){s.siblings("strong").removeClass("open");s.slideUp("fast")}B.siblings("strong").addClass("open");B.slideDown("fast");s=B}Cufon.refresh("li.filter strong");G.stopPropagation();G.preventDefault()}};var w=function(B){if(s){s.siblings("strong").removeClass("open");s.slideUp("fast");s=null}Cufon.refresh("li.filter strong")};var x=function(){};$("#product-grid > li").each(function(C,D){var B=$(D).find("a:first").attr("href").split("#")[1]});$.each(l,function(B,C){d+='<li><a href="#color-'+B+'">'+C+"</a></li>"});r=$('<li class="filter"><strong>Colors</strong><ul class="colors"><li><a class="default" href="#color-all">View All</a></li>'+d+"</ul></li>");if(b){$.each(b,function(B,C){o+='<li><a href="#fabric-'+B+'">'+C+"</a></li>"});m=$('<li class="filter"><strong>Fabrics</strong><ul class="fabrics"><li><a class="default" href="#fabric-all">View All</a></li>'+o+"</ul></li>")}else{m=null}$.each(f,function(B,C){v+='<li><a href="#fit-'+B+'">'+C+"</a></li>"});p=$('<li class="filter'+(_locale.region!="us"?" last":"")+'"><strong>Fit</strong><ul class="fit"><li><a class="default" href="#fit-all">View All</a></li>'+v+"</ul></li>");if(_locale.region=="us"){$.each(j,function(B,C){z+='<li><a href="#price-'+B+'">'+C+"</a></li>"});q=$('<li class="filter last"><strong>Price</strong><ul class="price"><li><a class="default" href="#price-all">View All</a></li>'+z+"</ul></li>")}else{q=null}A=$('<li class="filter"><strong class="on">A-Z</strong><ul class="name"><li><a href="#a-z">A-Z</a></li><li><a href="#z-a">Z-A</a></li></ul></li>');i=$('<li class="filter last"><strong>Likes</strong><ul class="likes"><li><a href="#highest">Highest</a></li><li><a href="#lowest">Lowest</a></li></ul></li>');a.before(k);k.append($('<div id="filter"></div>').append($("<h4>Filter by</h4>")).append($("<ul></ul>").append(r).append(m).append(p).append(q)));k.append($('<div id="sort"></div>').append($("<h4>Sort by</h4>")).append($("<ul></ul>").append(A).append(i)));Cufon.replace("#filters h4");Cufon.replace("li.filter strong",{hover:true,hoverables:{strong:true}});Cufon.replace("#product-grid h4",{hover:false});e=$("#product-grid li").clone(true);$(document.body).click(w);k.click(n)};var productDetail=function(e){var c=null;$("#info-tabs .nav a").click(function(h){document.getElementById("info-tabs").className=this.href.split("#")[1];h.preventDefault()});var a=function(j){var i=$(this),h=$("#review-status"),k=0;j.preventDefault();h.hide();i.find(".required").each(function(l,m){if(!m.value){$(m).addClass("missing");k++}else{$(m).removeClass("missing")}if(/email/i.test(m.id)){if(!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(m.value)){$(m).addClass("incorrect");k++}else{$(m).removeClass("incorrect")}}});if(k==0){$.ajax({url:"/api/product_review.json",type:"POST",data:i.serialize(),dataType:"json",error:function(){h.removeClass("success");h.addClass("error");h.text("Your request could not be completed.");h.show()},success:function(n){var m=$("#top-reviews dl");var l=$("<dt>"+n.name+' &nbsp;|&nbsp; <span class="date">Just now</span></dt><dd>'+n.comments+"</dd>");if(!m.size()){m=$("<dl></dl>");$("#top-reviews").empty().append(m)}m.prepend(l);i[0].reset();i.hide();h.hide();$("#review-form img").hide();$("#review-form h4.thanks").show()},complete:function(){i[0].reset();resetOverLabels(i[0]);k=0;tok.r()}})}else{h.text("Some required fields are incorrect or missing.");h.removeClass("success");h.addClass("error");h.show()}j.preventDefault()};$("#review-form form").submit(a);var f=function(i){var j=this.href.match(/sku=(.*)$/)[1],h=$(this.parentNode);h.addClass("loading");$.ajax({url:"/extensions/update_wishlist/?do=add&sku="+j,type:"GET",success:function(){$("#description ul .wishlist a").remove();$("#description ul .wishlist").prepend("<div>Added</div>");$("#wishlist-count").text(parseInt($("#wishlist-count").text())+1);h.removeClass("loading")}});i.preventDefault()};$("#description .wishlist a").click(f);var b=function(j){var i=$(this),h=$("#share-status"),k=0;j.preventDefault();h.hide();i.find(".required").each(function(l,m){if(!m.value){$(m).addClass("missing");k++}else{$(m).removeClass("missing")}if(/email/i.test(m.id)){if(!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(m.value)){$(m).addClass("incorrect");k++}else{$(m).removeClass("incorrect")}}});if(k==0){$.ajax({url:"/api/pokoencephalon",type:"POST",data:i.serialize(),error:function(){h.removeClass("success");h.addClass("error");h.text("Your request could not be completed.");h.show()},success:function(){h.removeClass("error");h.addClass("success");h.text("This product has been sent to your friend.");h.show()},complete:function(){i[0].reset();resetOverLabels(i[0]);k=0;tok.r()}})}else{h.text("Some required fields are incorrect or missing.");h.removeClass("success");h.addClass("error");h.show()}};$("#share-form form").submit(b);var g=function(i){var h=this.parentNode;h.className="loading";$.ajax({url:this.href,type:"GET",success:function(){$("#like-this a").remove();$("#like-this").prepend("<div>I Like This</div>");$("#like-this span").text(parseInt($("#like-this span").text())+1);h.className=""}});i.preventDefault()};$("#like-this a").click(g);var d=function(h){h.preventDefault();$.ajax({url:this.href,dataType:"html",success:function(i){$("#top-reviews").empty().append(i);$("#review-prev").click(d);$("#review-next").click(d)}})};$("#description ul .print > a").click(function(h){window.print();h.preventDefault()});$("#description ul .facebook > a").click(fbs_click);$("#description ul .myspace > a").click(myspace_click);$(document).ready(function(){$("#review-prev").click(d);var h=$("#review-form").dialog({autoOpen:false,close:function(l,k){$("#review-form form").show();$("#review-form img").show();$("#review-form h4.thanks").hide();resetOverLabels($("#review-form form")[0])},dialogClass:"dialog-review",draggable:false,modal:true,position:"center",resizable:false,width:480});$("a#review-link").click(function(k){h.dialog("open");k.preventDefault()});var i=$('<div title="BUY NOW"><iframe name="buy-now"></iframe></div>');$("buy-like").after(i);i=$(i).dialog({autoOpen:false,dialogClass:"dialog-buy-now",draggable:false,height:550,modal:true,open:function(l,k){Cufon.replace(".ui-dialog-title");window.frames["buy-now"].location=c},position:"center",resizable:false,width:550});$("#buy-now a").click(function(k){c=this.href;i.dialog("open");k.preventDefault()});var j=$("#share-form").dialog({autoOpen:false,close:function(l,k){resetOverLabels($("#share-form form")[0])},dialogClass:"dialog-share",draggable:false,modal:true,position:"center",resizable:false,width:360});$("#description ul .email > a").click(function(k){j.dialog("open");k.preventDefault()})});return{zoom:function(h){tb_show(null,"/image_cache"+h+"?w=860&wx=true",false)},updatePage:function(k){$("#variation-color").empty().text(k.color+" / "+k.product_code);var j=$("#description li.wishlist"),m=j.children("a");$.ajax({type:"GET",url:"/extensions/check_wishlist?id="+k.id,dataType:"text",success:function(p){if(p=="false"){if(m.size()==0){j.empty().append('<a href="/extensions/update_wishlist?do=add&sku='+k.product_code+'">Add to Wishlist</a>');j.children("a").click(f)}else{m.attr("href","/extensions/update_wishlist?do=add&sku="+k.product_code)}}else{if(m.size()>0){m.remove();j.append("<div>Added</div>")}}}});var l=$("#share-form form");l.find('input[name="email[vname]"]').attr("value",k.color);l.find('input[name="email[url]"]').attr("value",window.location.pathname+window.location.hash);var o=$("#description li.myspace a"),n=o.attr("href").match(/(.*)u=(.*)/)[1]+"u="+encodeURIComponent(window.location.href);o.attr("href",n);var i=$("#description li.facebook a"),h=i.attr("href").match(/(.*)u=(.*)/)[1]+"u="+encodeURIComponent(window.location.href);i.attr("href",h);$("#buy-now a").attr("href","http://hosted.where2getit.com/salomonbonfire/etailer.html?sku="+k.product_code);$("#review-form img").attr("src",k.assets&&k.assets[0]&&k.assets[0].src?"/image_cache"+k.assets[0].src.path+"?w=175":"/image_cache/frontend/img/image-missing.png?w=175")}}};var wishlist=function(){$("a.remove").click(function(b){$.ajax({url:this.href,type:"GET",success:function(){var c=parseInt($("h3.cufon").text(),10)-1;$(b.target).parent().parent().fadeOut("fast");$("#wishlist-count").text(c);if(c>0){$("h3.cufon").text(c+(c==1?" Item":" Items"));Cufon.refresh("h3.cufon")}else{$("h3.cufon").remove();$("#share-options").remove();$("h2").after('<p id="empty">There are no items in your wishlist.</p>')}}});b.preventDefault()});var a=function(d){var c=$(this),b=$("#share-status"),f=0;d.preventDefault();b.hide();c.find(".required").each(function(e,g){if(!g.value){$(g).addClass("missing");f++}else{$(g).removeClass("missing")}if(/email/i.test(g.id)){if(!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(g.value)){$(g).addClass("incorrect");f++}else{$(g).removeClass("incorrect")}}});if(f==0){$.ajax({url:"/extensions/email_wishlist",type:"POST",data:c.serialize(),error:function(){b.removeClass("success");b.addClass("error");b.text("Your request could not be completed.");b.show()},success:function(){b.removeClass("error");b.addClass("success");b.text("This product has been sent to your friend.");b.show()},complete:function(){c[0].reset();resetOverLabels(c[0]);f=0;tok.r()}})}else{b.text("Some required fields are incorrect or missing.");b.removeClass("success");b.addClass("error");b.show()}};$("#share-form form").submit(a);$("#share-options .print > a").click(function(b){window.print();b.preventDefault()});$(document).ready(function(){var b=$("#share-form").dialog({autoOpen:false,close:function(d,c){resetOverLabels($("#share-form form")[0])},dialogClass:"dialog-share",draggable:false,modal:true,position:"center",resizable:false,width:360});$("#share-options .email > a").click(function(c){b.dialog("open");c.preventDefault()})})};var teamLanding=function(){var a="all";$("#filter a").click(function(c){var b=this.href.split("#")[1];if(a!=b){$("#filters a.on").removeClass("on");$(this).addClass("on");$("#team-members li").each(function(e,d){d=$(d);if(b=="all"||d.hasClass(b)){d.show()}else{d.hide()}});a=b}Cufon.refresh("li.filter a");c.preventDefault()})};var teamMember=function(){$("#member-videos ul a").click(function(b){var a=$("#player")[0];if(a&&a.setAssetID&&typeof a.setAssetID=="function"){a.setAssetID(this.href.split("#")[1])}$.scrollTo({top:0,left:0},250);b.preventDefault()})};var storeLocator=function(){var c=$("#country"),b=$("#state"),e=$("#city"),j=$("#radial"),i=$(".submit"),a;var h=function(){var o,n,m,p;m=G_DEFAULT_ICON;m.image="/frontend/img/pin.png";n={icon:m,clickable:true,draggable:false,labelOffset:new GSize(-9,-32)};function l(r,q){this.latlng=r;this.labelText=q.labelText||"";this.labelClass=q.labelClass||"markerLabel";this.labelOffset=q.labelOffset||new GSize(0,0);GMarker.apply(this,arguments)}l.prototype=new GMarker(new GLatLng(0,0));l.prototype.initialize=function(q){GMarker.prototype.initialize.call(this,q);var r=document.createElement("div");r.className=this.labelClass;r.innerHTML=this.labelText;r.style.position="absolute";q.getPane(G_MAP_MARKER_PANE).appendChild(r);this.map=q;this.div=r};l.prototype.redraw=function(q){GMarker.prototype.redraw.call(this,o);if(!q){return}var r=this.map.fromLatLngToDivPixel(this.latlng);var s=GOverlay.getZIndex(this.latlng.lat());this.div.style.left=(r.x+this.labelOffset.width)+"px";this.div.style.top=(r.y+this.labelOffset.height)+"px";this.div.style.zIndex=s+1};l.prototype.remove=function(){this.div.parentNode.removeChild(this.div);this.div=null;GMarker.prototype.remove.call(this)};return{init:function(q){o=new GMap2(q);o.setCenter(new GLatLng(37.0625,-95.67706),3);o.setUIToDefault();o.disableScrollWheelZoom();window.onunload=GUnload},reset:function(){o.clearOverlays();o.setZoom(4);o.panTo(new GLatLng(37.0625,-95.67706));p=[]},update:function(v){var q,s;o.clearOverlays();p=[];var r=new GLatLngBounds();$.each(v,function(w,x){s=new GLatLng(x.address.lat,x.address.lng);n.labelText=""+(w+1);q=new l(s,n);o.addOverlay(q);q.bindInfoWindowHtml('<div class="markerInfo"><h4>'+(x.url?'<a href="http://'+x.url+'" target="_blank">'+x.name+"</a>":x.name)+"</h4>"+(x.address.address?x.address.address+"<br />":"")+(x.address.city?x.address.city+(x.address.state?", ":"<br />"):"")+(x.address.state?x.address.state+"<br />":"")+(x.address.postal_code?x.address.postal_code+"<br />":"")+(x.address.phone?x.address.phone+"<br />":"")+(x.address.url?'<br /><a href=http://"'+x.address.url+'" target="_blank">'+x.address.url+"</a>":"")+"</div>");r.extend(q.getLatLng());p.push(q)});o.setZoom(o.getBoundsZoomLevel(r));o.panTo(r.getCenter())},goTo:function(q){o.panTo(p[q].getLatLng());GEvent.trigger(p[q],"click");$.scrollTo("#map",250)}}}();var f=function(){states=$("#states");$.ajax({type:"GET",url:"/extensions/get_retailer_states",dataType:"json",success:function(l){states.append('<option value="" selected="selected">Choose...</option>');$.each(l,function(m,n){states.append('<option value="'+n+'">'+n+"</option>")})}})};var d=function(n,l){var m=$("#cities");$.ajax({type:"GET",url:"/extensions/get_retailer_cities/?"+(l?"country="+$("#countries")[0].value:"state="+$("#states")[0].value),dataType:"json",success:function(o){m.append('<option value="" selected="selected">Choose...</option>');$.each(o,function(p,q){m.append('<option value="'+q+'">'+q+"</option>")})}})};var k=function(l){var m=$("#search-results"),n=$("<ol></ol>");h.update(l);$.each(l,function(o,p){n.append('<li><a href="#'+o+'">'+p.name+"</a></li>")});m.empty();m.append('<h3 class="cufon">Listings</h3>').append(n);n.find("a").click(function(o){o.preventDefault();h.goTo(parseInt(this.href.split("#")[1],10))});Cufon.refresh("h3.cufon")};var g=function(m){if(m.id=="radial"){var l=$("#code")[0].value,o=$("#distance")[0].value;if(l&&o){$(m).addClass("loading");$.ajax({type:"GET",url:"/extensions/geocode?origin="+l,dataType:"json",success:function(p){$.ajax({type:"GET",url:"/api/dealers.json?logic=(location within "+o+"mi of "+p.lat+","+p.lng+")",dataType:"json",success:function(q){$(m).removeClass("loading");k(q)}})}})}else{}}else{var n=[];$.each(["countries","states","cities"],function(p,s){var r=$("#"+s),q=r.size()?r[0].value:null;if(q){n.push("address."+r[0].parentNode.id+"!"+q)}});n=n.join("@");$(m).addClass("loading");$.ajax({type:"GET",url:"/api/dealers.json?logic=("+n+")",dataType:"json",success:function(p){$(m).removeClass("loading");k(p)}})}};$("#location select").change(function(l){switch(this.id){case"countries":$("#location").removeClass("divider");b.hide();$("#states").empty();e.hide();$("#cities").empty();j.hide();$("#code")[0].value="";i.hide();if(this.value){if(this.value=="USA"){$("#location").addClass("divider");f();b.show();j.show();i.show()}else{d(this.value,true);e.show();i.show()}}break;case"states":e.hide();$("#cities").empty();if(this.value){d(this.value,false);e.show()}break;case"cities":if(this.value){g(this.parentNode.parentNode)}break}});$("#retail-search form").submit(function(l){g(this);l.preventDefault()});$(document).ready(function(){c.children("select")[0].selectedIndex=0;h.init(document.getElementById("map"))})};var community=function(){var b="all";var a=function(){var g;var i=function(k){switch(this.id){case"feedback-gender":if(this.value!=""){if(this.value=="Youth"){$("#feedback-category-youth").show()}else{$("#feedback-category").show()}}else{$("#feedback-category").hide();$("#feedback-category-youth").hide();$("#feedback-products").empty().hide()}break;case"feedback-category":case"feedback-category-youth":if(this.value!=""){$.ajax({type:"GET",dataType:"json",url:"/api/products.json?logic=(gender!"+$("#feedback-gender")[0].value+"@category!"+this.value+")",success:h})}else{$("#feedback-products").empty().hide()}break;case"feedback-products":if(this.value!=""){$.ajax({type:"GET",dataType:"html",url:"/en-us/overlays/product-feedback/"+this.value+"/",success:e})}break}};var h=function(l){var k=$("#feedback-products");k.append('<option value="">Choose a product...</option>');$.each(l,function(m,n){k.append('<option value="'+n.id+'">'+n.title+"</option>")});k.show()};var f=function(m){var l=$(this),k=$("#feedback-status"),n=0;m.preventDefault();k.hide();l.find(".required").each(function(o,p){if(!p.value){$(p).addClass("missing");n++}else{$(p).removeClass("missing")}if(/email/i.test(p.id)){if(!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(p.value)){$(p).addClass("incorrect");n++}else{$(p).removeClass("incorrect")}}});if(n==0){$.ajax({url:"/api/product_feedback.json",type:"POST",data:l.serialize(),dataType:"json",error:function(){k.removeClass("success");k.addClass("error");k.text("Your request could not be completed.");k.show()},success:function(q){var p=$("#product-feedback dl"),o=$("<dt>"+q.name+' &nbsp;|&nbsp; <span class="date">Just now</span></dt><dd>'+q.feedback+"</dd>");if(p.size()==0){p=$("<dl></dl>");$("#product-feedback p").remove();$("#product-feedback").append(p)}p.prepend(o);l[0].reset();l.hide();$("#feedback-form img").hide();$("#feedback-form h4.thanks").show()},complete:function(){n=0;tok.r()}})}else{k.text("Some required fields are incorrect or missing.");k.removeClass("success");k.addClass("error");k.show()}};var e=function(k){$("#product-select").hide();$("#product-info").append(k);Cufon.replace("#feedback-form form button",{hover:true,hoverables:{button:true}});Cufon.refresh("h4.cufon");initOverLabels();tok.r();$("#feedback-form form").submit(f);$("#product-info").show()};var j=function(){$("#product-select select").each(function(k,l){switch(l.id){case"feedback-gender":l.selectedIndex=0;break;case"feedback-category":case"feedback-category-youth":l.selectedIndex=0;$(l).hide();break;case"feedback-products":$(l).empty().hide();break}});$("#product-select").show();$("#product-info").empty().hide()};$("#filter a").click(function(l){var k=this.href.split("#")[1];if(b!=k){$("#filters a.on").removeClass("on");$(this).addClass("on");$("td > .community-item").not("#weather-widget, .feedback").each(function(m,n){n=$(n);if(k=="all"||n.hasClass(k)){n.css("opacity","1")}else{n.css("opacity","0.3")}});b=k}Cufon.refresh("li.filter a");l.preventDefault()});return{init:function(){g=$("#feedback").dialog({autoOpen:false,close:j,dialogClass:"dialog-feedback",draggable:false,height:560,modal:true,open:function(){Cufon.replace(".ui-dialog-title")},resizable:false,width:550});$(".feedback .more").click(function(k){var l=this.href.split("#")[1];k.preventDefault();$.ajax({type:"GET",dataType:"html",url:"/en-us/overlays/product-feedback/"+l+"/",success:function(m){e(m);g.dialog("open")}})});$("#add-feedback").click(function(k){g.dialog("open");k.preventDefault()});$("#product-select select").change(i)}}}();var c=function(f){f.preventDefault();SWFAddress.setValue("full_"+$(this).closest(".community-item").attr("id"))};var d=function(){var e=SWFAddress.getValue().match(/^\/(.*)$/);if(e&&e.length&&e[1]&&e[1].length){e=$("#"+e[1])}else{e=null}if(e&&typeof e.dialog=="function"){e.dialog("open")}};$(document).ready(function(){a.init();var e={autoOpen:false,close:function(){SWFAddress.setValue("close")},dialogClass:"dialog-community",draggable:false,height:560,open:function(){Cufon.replace(".ui-dialog-title")},resizable:false,modal:true,width:550};$(".community-item.photo, .community-item.person, .community-item.blog, .community-item.event").each(function(f,g){$(g).children(".community-item-full").dialog(e);$(g).find("a.expand").click(c)});$(".community-item.video").each(function(f,g){$(g).children(".video_full").each(function(h,j){$(j).dialog({autoOpen:false,close:function(){$(j).find("object").each(function(i,k){if(k.stopVideo&&typeof k.stopVideo=="function"){k.stopVideo()}})},dialogClass:"dialog-community",draggable:false,height:560,modal:true,open:function(){Cufon.replace(".ui-dialog-title");$(j).find("object").each(function(i,l){var k=function(){if(l.isReady&&typeof l.isReady=="function"&&l.isReady()){l.playVideo()}else{window.setTimeout(k,50)}};k()})},resizable:false,width:550})});$(g).find("a.expand").click(c)});SWFAddress.addEventListener(SWFAddressEvent.CHANGE,d)});return{fetchWeather:function(e){$("#current-weather").load("/extensions/fetch_weather?query="+encodeURIComponent(e)+"&amp;region="+_locale.region)},switchWeatherLocation:function(){$("#location").html('<input type="text" id="set-loc" /><button onclick="community.fetchWeather($(\'#set-loc\').val())">Go</button>')}}};function initOverLabels(){if(!document.getElementById){return false}var d,c,b,a;d=document.getElementsByTagName("label");for(a=0;a<d.length;a++){if(d[a].className=="overlabel"){c=d[a].htmlFor||d[a].getAttribute("for");if(!c||!(b=document.getElementById(c))){continue}d[a].className="overlabel-apply";if(b.value!==""){hide_label(b.getAttribute("id"),true)}b.onfocus=function(){hide_label(this.getAttribute("id"),true)};b.onblur=function(){if(this.value===""){hide_label(this.getAttribute("id"),false)}};d[a].onclick=function(){var f,e;f=this.getAttribute("for");if(f&&(e=document.getElementById(f))){e.focus()}}}}b=d=null}function resetOverLabels(a){if(!document.getElementById){return false}var e,d,c,b;a=a||document;e=a.getElementsByTagName("label");for(b=0;b<e.length;b++){if(e[b].className=="overlabel-apply"){d=e[b].htmlFor||e[b].getAttribute("for");c=document.getElementById(d);if(c&&c.value===""){e[b].style.textIndent="0px"}else{if(c&&c.value!==""){e[b].style.textIndent="-1000px"}}}}}function hide_label(c,b){if(!document.getElementsByTagName){return false}var d,e,a;e=document.getElementsByTagName("label");for(a=0;a<e.length;a++){d=e[a].htmlFor||e[a].getAttribute("for");if(d==c){e[a].style.textIndent=(b)?"-1000px":"0px";return true}}}function fbs_click(){u=location.href;t=document.title;window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(u)+"&t="+encodeURIComponent(t),"sharer","toolbar=0,status=0,width=626,height=436");return false}function myspace_click(a){window.open(a.target.href);a.preventDefault()}function externalize(){$("a[rel=external]").each(function(c,b){$(b).attr("target","_blank")})};