$(function(){if($.browser.msie&&$.browser.version<7){}$("#scrollableStores > ul li:nth-child(odd)").addClass("stripe");$("ul.storeFilters li").removeClass("stripe");$(".error a").hover(function(){$("#errorHint").show()},function(){$("#errorHint").hide()});$("#storeLocatorForm").submit(function(){var B=$("#locatorSearchError");var A="Please enter either your Zip/Postal Code or your City and State to search for a store.";if(($("#store_zip").val()=="")&&($("#store_city").val()==""||$("#store_state").val()=="")){B.html(A).css("visibility","visible");return false}});$(".pagination .pageLinks .current").each(function(){if($(this).text()=="1"){$(".pagination .paginationPrev").addClass("disabled").click(function(){return false})}});$(".getNewsletter").css("visibility","visible");$(window).load(function(){googleMapsInitialize()});$(window).unload(function(){GUnload()});$(".filter").click(function(){setTimeout("filterStores()",1)});generatePagination()});function filterStores(){var A="";$(".filter:checked").each(function(){A=A+$(this).attr("name").replace(/filter_/," ")});if(A.length>0){$("#scrollableStores .bgBlk > li").each(function(B){liClassSet=$(this).attr("class");if(liClassSet&&liClassSet!=""&&liClassSet!=" "){var C=new Array();C=liClassSet.split(" ");var D=false;for(k=0;k<C.length;k++){if(C[k]!=""&&C[k]!=" "&&A.indexOf(C[k])!=-1){D=true;k=C.length+1}}}if(!D){$(this).hide("slow");gMarkers[B].hide();map.setCenter(center,zoomLevel)}else{$(this).show("slow");gMarkers[B].show();map.setCenter(center,zoomLevel)}gMarkers[B].closeInfoWindow()})}else{$("#scrollableStores li").show("slow");for(m=0;m<gMarkers.length;m++){gMarkers[m].show();map.setCenter(center,zoomLevel);gMarkers[m].closeInfoWindow()}}}var gMarkers=new Array();var map;var center;var zoomLevel=13;function googleMapsInitialize(){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("map_canvas"));map.setCenter(new GLatLng(37.8716667,-122.2716667),13);map.addControl(new GSmallMapControl());var F=new GIcon(G_DEFAULT_ICON);F.image="http://cdn.thenorthface.com/wcsstore/ConsumerDirectStorefrontAssetStore/images/en_US/locator/pin_green.gif";F.shadowSize=new GSize(0,0);var E=new GIcon(G_DEFAULT_ICON);E.image="http://cdn.thenorthface.com/wcsstore/ConsumerDirectStorefrontAssetStore/images/en_US/locator/pin_red.gif";E.shadowSize=new GSize(0,0);var B={icon:F};var D={icon:E};var A=new Array();var C=new GLatLngBounds();$("#storesReturned .vcard").each(function(G){var I=$(this);var J=I.find(".latitude").html();var H=I.find(".longitude").html();if(I.children(":first").hasClass("retail")){markerType=D}else{markerType=B}gMarkers[G]=new GMarker(new GLatLng(J,H),markerType);A[G]=I.clone().find(".geo, .storeFilters").remove().end();A[G]='<div class="mapPopup">'+$(A[G]).find("div").addClass("minWidth").end().html()+"</div>";gMarkers[G].bindInfoWindowHtml(A[G]);map.addOverlay(gMarkers[G]);C.extend(gMarkers[G].getLatLng());GEvent.addListener(gMarkers[G],"infowindowopen",function(){$("#storesReturned li").removeClass("active");var K=I.parents("li");K.addClass("active");$("#scrollableStores").scrollTo(K,800)});GEvent.addListener(gMarkers[G],"infowindowclose",function(){$("#storesReturned li").removeClass("active")});I.parents("li").click(function(){$(this).siblings("li").removeClass("active").end().addClass("active");gMarkers[G].openInfoWindowHtml(A[G])})});if(gMarkers!=null&&gMarkers.length>0){center=C.getCenter();zoomLevel=map.getBoundsZoomLevel(C);if(map.getZoom()!=zoomLevel){map.setCenter(center,zoomLevel)}else{map.panTo(center)}}}}function cleanUpAddress(B){var A=B.replace(/^\s+|\s+$/g,"").replace(/\s+/g," ").replace(/\s/g," ");A=encodeURIComponent(A).replace(/\%20/g,"+");return A}(function(B){var C=B.scrollTo=function(E,D,F){C.window().scrollTo(E,D,F)};C.defaults={axis:"y",duration:1};C.window=function(){return B(B.browser.safari?"body":"html")};B.fn.scrollTo=function(E,D,F){if(typeof D=="object"){F=D;D=0}F=B.extend({},C.defaults,F);D=D||F.speed||F.duration;F.queue=F.queue&&F.axis.length>1;if(F.queue){D/=2}F.offset=A(F.offset);F.over=A(F.over);return this.each(function(){var I=this,G=B(I),J=E,N,M={},H=G.is("html,body");switch(typeof J){case"number":case"string":if(/^([+-]=)?\d+(px)?$/.test(J)){J=A(J);break}J=B(J,this);case"object":if(J.is||J.style){N=(J=B(J)).offset()}}B.each(F.axis.split(""),function(Q,S){var R=S=="x"?"Left":"Top",V=R.toLowerCase(),O="scroll"+R,U=I[O],T=S=="x"?"Width":"Height";if(N){M[O]=N[V]+(H?0:U-G.offset()[V]);if(F.margin){M[O]-=parseInt(J.css("margin"+R))||0;M[O]-=parseInt(J.css("border"+R+"Width"))||0}M[O]+=F.offset[V]||0;if(F.over[V]){M[O]+=J[T.toLowerCase()]()*F.over[V]}}else{M[O]=J[V]}if(/^\d+$/.test(M[O])){M[O]=M[O]<=0?0:Math.min(M[O],K(T))}if(!Q&&F.queue){if(U!=M[O]){L(F.onAfterFirst)}delete M[O]}});L(F.onAfter);function L(O){G.animate(M,D,F.easing,O&&function(){O.call(this,E)})}function K(P){var O=H?B.browser.opera?document.body:document.documentElement:I;return O["scroll"+P]-O["client"+P]}})};function A(D){return typeof D=="object"?D:{top:D,left:D}}})(jQuery);function generatePagination(){var A=generatePaginationControl();$(".pagination").html(A);$(".paginationNext").bind("click",function(B){if(currentPage==totalPages){return }currentPage++;refreshPage()});$(".paginationPrev").bind("click",function(B){if(currentPage==1){return }currentPage--;refreshPage()});$(".pageNum").bind("click",function(B){currentPage=$(this).text();refreshPage()});return }function refreshPage(){document.storeLocatorForm.currentPage.value=currentPage;document.storeLocatorForm.submit();generatePagination()};