if(typeof Object.create!=="function"){Object.create=function(o){var F=function(){};F.prototype=o;return new F();};}window.Modernizr=function(a,b,c){function B(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+o.join(c+" ")+c).split(" ");return A(d,b);}function A(a,b){for(var d in a){if(k[a[d]]!==c){return b=="pfx"?a[d]:!0;}}return !1;}function z(a,b){return !!~(""+a).indexOf(b);}function y(a,b){return typeof a===b;}function x(a,b){return w(n.join(a+";")+(b||""));}function w(a){k.cssText=a;}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),o="Webkit Moz O ms Khtml".split(" "),p={},q={},r={},s=[],t,u={}.hasOwnProperty,v;!y(u,c)&&!y(u.call,c)?v=function(a,b){return u.call(a,b);}:v=function(a,b){return b in a&&y(a.constructor.prototype[b],c);},p.rgba=function(){w("background-color:rgba(150,255,150,.5)");return z(k.backgroundColor,"rgba");},p.borderradius=function(){return B("borderRadius");},p.boxshadow=function(){return B("boxShadow");},p.textshadow=function(){return b.createElement("div").style.textShadow==="";},p.opacity=function(){x("opacity:.55");return/^0.55$/.test(k.opacity);},p.cssanimations=function(){return B("animationName");},p.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";w((a+n.join(b+a)+n.join(c+a)).slice(0,-a.length));return z(k.backgroundImage,"gradient");},p.cssreflections=function(){return B("boxReflect");},p.csstransitions=function(){return B("transitionProperty");};for(var C in p){v(p,C)&&(t=C.toLowerCase(),e[t]=p[C](),s.push((e[t]?"":"no-")+t));}w(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1;}()&&function(a,b){function s(a){var b=-1;while(++b<g){a.createElement(f[b]);}}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c){return"";}var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled){continue;}b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all";}return h.join("");},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null){b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);}return b.join("\n");},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d){c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a]);}}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font");},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML();},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r);},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText="";},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint));}(a,b),e._version=d,e._prefixes=n,e._domPrefixes=o,e.testProp=function(a){return A([a]);},e.testAllProps=B,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+s.join(" "):"");return e;}(this,this.document),function(a,b,c){function k(a){return !a||a=="loaded"||a=="complete";}function j(){var a=1,b=-1;while(p.length- ++b){if(p[b].s&&!(a=p[b].r)){break;}}a&&g();}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null);},m(function(){d||(d=1,j());},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n);}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d){try{a.sheet.cssRules.length?(d=1,j()):e(a);}catch(b){b.code==1000||b.message=="security"||b.message=="denied"?(d=1,m(function(){j();},0)):e(a);}}},0);};e(c);}else{c.onload=function(){d||(d=1,m(function(){j();},0));},a.e&&c.onload();}m(function(){d||(d=1,j());},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n);}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a);},0):(a(),j()):q=0;}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l);},0));}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g();}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j());},H.errorTimeout);}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this;}function d(){var a=H;a.loader={load:e,i:0};return a;}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance" in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance" in l.style,x=w&&"async" in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]";},B=function(a){return Object(a)===a;},C=function(a){return typeof a=="string";},D=function(a){return o.call(a)=="[object Function]";},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++){g=F[b[h]],g&&(f=g(f));}for(h=0;h<c;h++){f=E[h](f);}return f;}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead){return i.instead(a,b,e,g,h);}e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g);});}}function b(a,b){function c(a){if(C(a)){e(a,h,b,0,d);}else{if(B(a)){for(i in a){a.hasOwnProperty(i)&&e(a[i],h,b,i,d);}}}}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete);}var g,h,i=this.yepnope.loader;if(C(a)){e(a,0,i,0);}else{if(A(a)){for(g=0;g<a.length;g++){h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);}}else{B(a)&&b(a,i);}}},H.addPrefix=function(a,b){F[a]=b;},H.addFilter=function(a){E.push(a);},H.errorTimeout=10000,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete";},0)),a.yepnope=d();}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0));};(function(a){var c=(a.browser.msie?"paste":"input")+".mask";var b=(window.orientation!=undefined);a.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"}};a.fn.extend({caret:function(e,f){if(this.length==0){return;}if(typeof e=="number"){f=(typeof f=="number")?f:e;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(e,f);}else{if(this.createTextRange){var g=this.createTextRange();g.collapse(true);g.moveEnd("character",f);g.moveStart("character",e);g.select();}}});}else{if(this[0].setSelectionRange){e=this[0].selectionStart;f=this[0].selectionEnd;}else{if(document.selection&&document.selection.createRange){var d=document.selection.createRange();e=0-d.duplicate().moveStart("character",-100000);f=e+d.text.length;}}return{begin:e,end:f};}},unmask:function(){return this.trigger("unmask");},mask:function(j,d){if(!j&&this.length>0){var f=a(this[0]);var g=f.data("tests");return a.map(f.data("buffer"),function(l,m){return g[m]?l:null;}).join("");}d=a.extend({placeholder:"_",completed:null},d);var k=a.mask.definitions;var g=[];var e=j.length;var i=null;var h=j.length;a.each(j.split(""),function(m,l){if(l=="?"){h--;e=m;}else{if(k[l]){g.push(new RegExp(k[l]));if(i==null){i=g.length-1;}}else{g.push(null);}}});return this.each(function(){var r=a(this);var m=a.map(j.split(""),function(x,y){if(x!="?"){return k[x]?d.placeholder:x;}});var n=false;var q=r.val();r.data("buffer",m).data("tests",g);function v(x){while(++x<=h&&!g[x]){}return x;}function t(x){while(!g[x]&&--x>=0){}for(var y=x;y<h;y++){if(g[y]){m[y]=d.placeholder;var z=v(y);if(z<h&&g[y].test(m[z])){m[y]=m[z];}else{break;}}}s();r.caret(Math.max(i,x));}function u(y){for(var A=y,z=d.placeholder;A<h;A++){if(g[A]){var B=v(A);var x=m[A];m[A]=z;if(B<h&&g[B].test(x)){z=x;}else{break;}}}}function l(y){var x=a(this).caret();var z=y.keyCode;n=(z<16||(z>16&&z<32)||(z>32&&z<41));if((x.begin-x.end)!=0&&(!n||z==8||z==46)){w(x.begin,x.end);}if(z==8||z==46||(b&&z==127)){t(x.begin+(z==46?0:-1));return false;}else{if(z==27){r.val(q);r.caret(0,p());return false;}}}function o(B){if(n){n=false;return(B.keyCode==8)?false:null;}B=B||window.event;var C=B.charCode||B.keyCode||B.which;var z=a(this).caret();if(B.ctrlKey||B.altKey||B.metaKey){return true;}else{if((C>=32&&C<=125)||C>186){var x=v(z.begin-1);if(x<h){var A=String.fromCharCode(C);if(g[x].test(A)){u(x);m[x]=A;s();var y=v(x);a(this).caret(y);if(d.completed&&y==h){d.completed.call(r);}}}}}return false;}function w(x,y){for(var z=x;z<y&&z<h;z++){if(g[z]){m[z]=d.placeholder;}}}function s(){return r.val(m.join("")).val();}function p(y){var z=r.val();var C=-1;for(var B=0,x=0;B<h;B++){if(g[B]){m[B]=d.placeholder;while(x++<z.length){var A=z.charAt(x-1);if(g[B].test(A)){m[B]=A;C=B;break;}}if(x>z.length){break;}}else{if(m[B]==z[x]&&B!=e){x++;C=B;}}}if(!y&&C+1<e){r.val("");w(0,h);}else{if(y||C+1>=e){s();if(!y){r.val(r.val().substring(0,C+1));}}}return(e?B:i);}if(!r.attr("readonly")){r.one("unmask",function(){r.unbind(".mask").removeData("buffer").removeData("tests");}).bind("focus.mask",function(){q=r.val();var x=p();s();setTimeout(function(){if(x==j.length){r.caret(0,x);}else{r.caret(x);}},0);}).bind("blur.mask",function(){p();if(r.val()!=q){r.change();}}).bind("keydown.mask",l).bind("keypress.mask",o).bind(c,function(){setTimeout(function(){r.caret(p(true));},0);});}p();});}});})(jQuery);jQuery.bt={version:"0.9.5-rc1"};(function($){jQuery.fn.bt=function(content,options){if(typeof content!="string"){var contentSelect=true;options=content;content=false;}else{var contentSelect=false;}if(jQuery.fn.hoverIntent&&jQuery.bt.defaults.trigger=="hover"){jQuery.bt.defaults.trigger="hoverIntent";}return this.each(function(index){var opts=jQuery.extend(false,jQuery.bt.defaults,jQuery.bt.options,options);opts.spikeLength=numb(opts.spikeLength);opts.spikeGirth=numb(opts.spikeGirth);opts.overlap=numb(opts.overlap);var ajaxTimeout=false;if(opts.killTitle){$(this).find("[title]").andSelf().each(function(){if(!$(this).attr("bt-xTitle")){$(this).attr("bt-xTitle",$(this).attr("title")).attr("title","");}});}if(typeof opts.trigger=="string"){opts.trigger=[opts.trigger];}if(opts.trigger[0]=="hoverIntent"){var hoverOpts=jQuery.extend(opts.hoverIntentOpts,{over:function(){this.btOn();},out:function(){this.btOff();}});$(this).hoverIntent(hoverOpts);}else{if(opts.trigger[0]=="hover"){$(this).hover(function(){this.btOn();},function(){this.btOff();});}else{if(opts.trigger[0]=="now"){if($(this).hasClass("bt-active")){this.btOff();}else{this.btOn();}}else{if(opts.trigger[0]=="none"){}else{if(opts.trigger.length>1&&opts.trigger[0]!=opts.trigger[1]){$(this).bind(opts.trigger[0],function(){this.btOn();}).bind(opts.trigger[1],function(){this.btOff();});}else{$(this).bind(opts.trigger[0],function(){if($(this).hasClass("bt-active")){this.btOff();}else{this.btOn();}});}}}}}this.btOn=function(){if(typeof $(this).data("bt-box")=="object"){this.btOff();}opts.preBuild.apply(this);$(jQuery.bt.vars.closeWhenOpenStack).btOff();$(this).addClass("bt-active "+opts.activeClass);if(contentSelect&&opts.ajaxPath==null){if(opts.killTitle){$(this).attr("title",$(this).attr("bt-xTitle"));}content=$.isFunction(opts.contentSelector)?opts.contentSelector.apply(this):eval(opts.contentSelector);if(opts.killTitle){$(this).attr("title","");}}if(opts.ajaxPath!=null&&content==false){if(typeof opts.ajaxPath=="object"){var url=eval(opts.ajaxPath[0]);url+=opts.ajaxPath[1]?" "+opts.ajaxPath[1]:"";}else{var url=opts.ajaxPath;}var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}var cacheData=opts.ajaxCache?$(document.body).data("btCache-"+url.replace(/\./g,"")):null;if(typeof cacheData=="string"){content=selector?$("<div/>").append(cacheData.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):cacheData;}else{var target=this;var ajaxOpts=jQuery.extend(false,{type:opts.ajaxType,data:opts.ajaxData,cache:opts.ajaxCache,url:url,complete:function(XMLHttpRequest,textStatus){if(textStatus=="success"||textStatus=="notmodified"){if(opts.ajaxCache){$(document.body).data("btCache-"+url.replace(/\./g,""),XMLHttpRequest.responseText);}ajaxTimeout=false;content=selector?$("<div/>").append(XMLHttpRequest.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):XMLHttpRequest.responseText;}else{if(textStatus=="timeout"){ajaxTimeout=true;}content=opts.ajaxError.replace(/%error/g,XMLHttpRequest.statusText);}if($(target).hasClass("bt-active")){target.btOn();}}},opts.ajaxOpts);jQuery.ajax(ajaxOpts);content=opts.ajaxLoading;}}var shadowMarginX=0;var shadowMarginY=0;var shadowShiftX=0;var shadowShiftY=0;if(opts.shadow&&!shadowSupport()){opts.shadow=false;jQuery.extend(opts,opts.noShadowOpts);}if(opts.shadow){if(opts.shadowBlur>Math.abs(opts.shadowOffsetX)){shadowMarginX=opts.shadowBlur*2;}else{shadowMarginX=opts.shadowBlur+Math.abs(opts.shadowOffsetX);}shadowShiftX=(opts.shadowBlur-opts.shadowOffsetX)>0?opts.shadowBlur-opts.shadowOffsetX:0;if(opts.shadowBlur>Math.abs(opts.shadowOffsetY)){shadowMarginY=opts.shadowBlur*2;}else{shadowMarginY=opts.shadowBlur+Math.abs(opts.shadowOffsetY);}shadowShiftY=(opts.shadowBlur-opts.shadowOffsetY)>0?opts.shadowBlur-opts.shadowOffsetY:0;}if(opts.offsetParent){var offsetParent=$(opts.offsetParent);var offsetParentPos=offsetParent.offset();var pos=$(this).offset();var top=numb(pos.top)-numb(offsetParentPos.top)+numb($(this).css("margin-top"))-shadowShiftY;var left=numb(pos.left)-numb(offsetParentPos.left)+numb($(this).css("margin-left"))-shadowShiftX;}else{var offsetParent=($(this).css("position")=="absolute")?$(this).parents().eq(0).offsetParent():$(this).offsetParent();var pos=$(this).btPosition();var top=numb(pos.top)+numb($(this).css("margin-top"))-shadowShiftY;var left=numb(pos.left)+numb($(this).css("margin-left"))-shadowShiftX;}var width=$(this).btOuterWidth();var height=$(this).outerHeight();if(typeof content=="object"){var original=content;var clone=$(original).clone(true).show();var origClones=$(original).data("bt-clones")||[];origClones.push(clone);$(original).data("bt-clones",origClones);$(clone).data("bt-orig",original);$(this).data("bt-content-orig",{original:original,clone:clone});content=clone;}if(typeof content=="null"||content==""){return;}var $text=$('<div class="bt-content"></div>').append(content).css({padding:opts.padding,position:"absolute",width:(opts.shrinkToFit?"auto":opts.width),zIndex:opts.textzIndex,left:shadowShiftX,top:shadowShiftY}).css(opts.cssStyles);var $box=$('<div class="bt-wrapper"></div>').append($text).addClass(opts.cssClass).css({position:"absolute",width:opts.width,zIndex:opts.wrapperzIndex,visibility:"hidden"}).appendTo(offsetParent);if(jQuery.fn.bgiframe){$text.bgiframe();
$box.bgiframe();}$(this).data("bt-box",$box);var scrollTop=numb($(document).scrollTop());var scrollLeft=numb($(document).scrollLeft());var docWidth=numb($(window).width());var docHeight=numb($(window).height());var winRight=scrollLeft+docWidth;var winBottom=scrollTop+docHeight;var space=new Object();var thisOffset=$(this).offset();space.top=thisOffset.top-scrollTop;space.bottom=docHeight-((thisOffset+height)-scrollTop);space.left=thisOffset.left-scrollLeft;space.right=docWidth-((thisOffset.left+width)-scrollLeft);var textOutHeight=numb($text.outerHeight());var textOutWidth=numb($text.btOuterWidth());if(opts.positions.constructor==String){opts.positions=opts.positions.replace(/ /,"").split(",");}if(opts.positions[0]=="most"){var position="top";for(var pig in space){position=space[pig]>space[position]?pig:position;}}else{for(var x in opts.positions){var position=opts.positions[x];if((position=="left"||position=="right")&&space[position]>textOutWidth+opts.spikeLength){break;}else{if((position=="top"||position=="bottom")&&space[position]>textOutHeight+opts.spikeLength){break;}}}}var horiz=left+((width-textOutWidth)*0.5);var vert=top+((height-textOutHeight)*0.5);var points=new Array();var textTop,textLeft,textRight,textBottom,textTopSpace,textBottomSpace,textLeftSpace,textRightSpace,crossPoint,textCenter,spikePoint;switch(position){case"top":$text.css("margin-bottom",opts.spikeLength+"px");$box.css({top:(top-$text.outerHeight(true))+opts.overlap,left:horiz});textRightSpace=(winRight-opts.windowMargin)-($text.offset().left+$text.btOuterWidth(true));var xShift=shadowShiftX;if(textRightSpace<0){$box.css("left",(numb($box.css("left"))+textRightSpace)+"px");xShift-=textRightSpace;}textLeftSpace=($text.offset().left+numb($text.css("margin-left")))-(scrollLeft+opts.windowMargin);if(textLeftSpace<0){$box.css("left",(numb($box.css("left"))-textLeftSpace)+"px");xShift+=textLeftSpace;}textTop=$text.btPosition().top+numb($text.css("margin-top"));textLeft=$text.btPosition().left+numb($text.css("margin-left"));textRight=textLeft+$text.btOuterWidth();textBottom=textTop+$text.outerHeight();textCenter={x:textLeft+($text.btOuterWidth()*opts.centerPointX),y:textTop+($text.outerHeight()*opts.centerPointY)};points[points.length]=spikePoint={y:textBottom+opts.spikeLength,x:((textRight-textLeft)*0.5)+xShift,type:"spike"};crossPoint=findIntersectX(spikePoint.x,spikePoint.y,textCenter.x,textCenter.y,textBottom);crossPoint.x=crossPoint.x<textLeft+opts.spikeGirth/2+opts.cornerRadius?textLeft+opts.spikeGirth/2+opts.cornerRadius:crossPoint.x;crossPoint.x=crossPoint.x>(textRight-opts.spikeGirth/2)-opts.cornerRadius?(textRight-opts.spikeGirth/2)-opts.CornerRadius:crossPoint.x;points[points.length]={x:crossPoint.x-(opts.spikeGirth/2),y:textBottom,type:"join"};points[points.length]={x:textLeft,y:textBottom,type:"corner"};points[points.length]={x:textLeft,y:textTop,type:"corner"};points[points.length]={x:textRight,y:textTop,type:"corner"};points[points.length]={x:textRight,y:textBottom,type:"corner"};points[points.length]={x:crossPoint.x+(opts.spikeGirth/2),y:textBottom,type:"join"};points[points.length]=spikePoint;break;case"left":$text.css("margin-right",opts.spikeLength+"px");$box.css({top:vert+"px",left:((left-$text.btOuterWidth(true))+opts.overlap)+"px"});textBottomSpace=(winBottom-opts.windowMargin)-($text.offset().top+$text.outerHeight(true));var yShift=shadowShiftY;if(textBottomSpace<0){$box.css("top",(numb($box.css("top"))+textBottomSpace)+"px");yShift-=textBottomSpace;}textTopSpace=($text.offset().top+numb($text.css("margin-top")))-(scrollTop+opts.windowMargin);if(textTopSpace<0){$box.css("top",(numb($box.css("top"))-textTopSpace)+"px");yShift+=textTopSpace;}textTop=$text.btPosition().top+numb($text.css("margin-top"));textLeft=$text.btPosition().left+numb($text.css("margin-left"));textRight=textLeft+$text.btOuterWidth();textBottom=textTop+$text.outerHeight();textCenter={x:textLeft+($text.btOuterWidth()*opts.centerPointX),y:textTop+($text.outerHeight()*opts.centerPointY)};points[points.length]=spikePoint={x:textRight+opts.spikeLength,y:((textBottom-textTop)*0.5)+yShift,type:"spike"};crossPoint=findIntersectY(spikePoint.x,spikePoint.y,textCenter.x,textCenter.y,textRight);crossPoint.y=crossPoint.y<textTop+opts.spikeGirth/2+opts.cornerRadius?textTop+opts.spikeGirth/2+opts.cornerRadius:crossPoint.y;crossPoint.y=crossPoint.y>(textBottom-opts.spikeGirth/2)-opts.cornerRadius?(textBottom-opts.spikeGirth/2)-opts.cornerRadius:crossPoint.y;points[points.length]={x:textRight,y:crossPoint.y+opts.spikeGirth/2,type:"join"};points[points.length]={x:textRight,y:textBottom,type:"corner"};points[points.length]={x:textLeft,y:textBottom,type:"corner"};points[points.length]={x:textLeft,y:textTop,type:"corner"};points[points.length]={x:textRight,y:textTop,type:"corner"};points[points.length]={x:textRight,y:crossPoint.y-opts.spikeGirth/2,type:"join"};points[points.length]=spikePoint;break;case"bottom":$text.css("margin-top",opts.spikeLength+"px");$box.css({top:(top+height)-opts.overlap,left:horiz});textRightSpace=(winRight-opts.windowMargin)-($text.offset().left+$text.btOuterWidth(true));var xShift=shadowShiftX;if(textRightSpace<0){$box.css("left",(numb($box.css("left"))+textRightSpace)+"px");xShift-=textRightSpace;}textLeftSpace=($text.offset().left+numb($text.css("margin-left")))-(scrollLeft+opts.windowMargin);if(textLeftSpace<0){$box.css("left",(numb($box.css("left"))-textLeftSpace)+"px");xShift+=textLeftSpace;}textTop=$text.btPosition().top+numb($text.css("margin-top"));textLeft=$text.btPosition().left+numb($text.css("margin-left"));textRight=textLeft+$text.btOuterWidth();textBottom=textTop+$text.outerHeight();textCenter={x:textLeft+($text.btOuterWidth()*opts.centerPointX),y:textTop+($text.outerHeight()*opts.centerPointY)};points[points.length]=spikePoint={x:((textRight-textLeft)*0.5)+xShift,y:shadowShiftY,type:"spike"};crossPoint=findIntersectX(spikePoint.x,spikePoint.y,textCenter.x,textCenter.y,textTop);crossPoint.x=crossPoint.x<textLeft+opts.spikeGirth/2+opts.cornerRadius?textLeft+opts.spikeGirth/2+opts.cornerRadius:crossPoint.x;crossPoint.x=crossPoint.x>(textRight-opts.spikeGirth/2)-opts.cornerRadius?(textRight-opts.spikeGirth/2)-opts.cornerRadius:crossPoint.x;points[points.length]={x:crossPoint.x+opts.spikeGirth/2,y:textTop,type:"join"};points[points.length]={x:textRight,y:textTop,type:"corner"};points[points.length]={x:textRight,y:textBottom,type:"corner"};points[points.length]={x:textLeft,y:textBottom,type:"corner"};points[points.length]={x:textLeft,y:textTop,type:"corner"};points[points.length]={x:crossPoint.x-(opts.spikeGirth/2),y:textTop,type:"join"};points[points.length]=spikePoint;break;case"right":$text.css("margin-left",(opts.spikeLength+"px"));$box.css({top:vert+"px",left:((left+width)-opts.overlap)+"px"});textBottomSpace=(winBottom-opts.windowMargin)-($text.offset().top+$text.outerHeight(true));var yShift=shadowShiftY;if(textBottomSpace<0){$box.css("top",(numb($box.css("top"))+textBottomSpace)+"px");yShift-=textBottomSpace;}textTopSpace=($text.offset().top+numb($text.css("margin-top")))-(scrollTop+opts.windowMargin);if(textTopSpace<0){$box.css("top",(numb($box.css("top"))-textTopSpace)+"px");yShift+=textTopSpace;}textTop=$text.btPosition().top+numb($text.css("margin-top"));textLeft=$text.btPosition().left+numb($text.css("margin-left"));textRight=textLeft+$text.btOuterWidth();textBottom=textTop+$text.outerHeight();textCenter={x:textLeft+($text.btOuterWidth()*opts.centerPointX),y:textTop+($text.outerHeight()*opts.centerPointY)};points[points.length]=spikePoint={x:shadowShiftX,y:((textBottom-textTop)*0.5)+yShift,type:"spike"};crossPoint=findIntersectY(spikePoint.x,spikePoint.y,textCenter.x,textCenter.y,textLeft);crossPoint.y=crossPoint.y<textTop+opts.spikeGirth/2+opts.cornerRadius?textTop+opts.spikeGirth/2+opts.cornerRadius:crossPoint.y;crossPoint.y=crossPoint.y>(textBottom-opts.spikeGirth/2)-opts.cornerRadius?(textBottom-opts.spikeGirth/2)-opts.cornerRadius:crossPoint.y;points[points.length]={x:textLeft,y:crossPoint.y-opts.spikeGirth/2,type:"join"};points[points.length]={x:textLeft,y:textTop,type:"corner"};points[points.length]={x:textRight,y:textTop,type:"corner"};points[points.length]={x:textRight,y:textBottom,type:"corner"};points[points.length]={x:textLeft,y:textBottom,type:"corner"};points[points.length]={x:textLeft,y:crossPoint.y+opts.spikeGirth/2,type:"join"};points[points.length]=spikePoint;break;}var canvas=document.createElement("canvas");$(canvas).attr("width",(numb($text.btOuterWidth(true))+opts.strokeWidth*2+shadowMarginX)).attr("height",(numb($text.outerHeight(true))+opts.strokeWidth*2+shadowMarginY)).appendTo($box).css({position:"absolute",zIndex:opts.boxzIndex});if(typeof G_vmlCanvasManager!="undefined"){canvas=G_vmlCanvasManager.initElement(canvas);}if(opts.cornerRadius>0){var newPoints=new Array();var newPoint;for(var i=0;i<points.length;i++){if(points[i].type=="corner"){newPoint=betweenPoint(points[i],points[(i-1)%points.length],opts.cornerRadius);newPoint.type="arcStart";newPoints[newPoints.length]=newPoint;newPoints[newPoints.length]=points[i];newPoint=betweenPoint(points[i],points[(i+1)%points.length],opts.cornerRadius);newPoint.type="arcEnd";newPoints[newPoints.length]=newPoint;}else{newPoints[newPoints.length]=points[i];}}points=newPoints;}var ctx=canvas.getContext("2d");if(opts.shadow&&opts.shadowOverlap!==true){var shadowOverlap=numb(opts.shadowOverlap);switch(position){case"top":if(opts.shadowOffsetX+opts.shadowBlur-shadowOverlap>0){$box.css("top",(numb($box.css("top"))-(opts.shadowOffsetX+opts.shadowBlur-shadowOverlap)));}break;case"right":if(shadowShiftX-shadowOverlap>0){$box.css("left",(numb($box.css("left"))+shadowShiftX-shadowOverlap));}break;case"bottom":if(shadowShiftY-shadowOverlap>0){$box.css("top",(numb($box.css("top"))+shadowShiftY-shadowOverlap));}break;case"left":if(opts.shadowOffsetY+opts.shadowBlur-shadowOverlap>0){$box.css("left",(numb($box.css("left"))-(opts.shadowOffsetY+opts.shadowBlur-shadowOverlap)));}break;}}drawIt.apply(ctx,[points],opts.strokeWidth);ctx.fillStyle=opts.fill;if(opts.shadow){ctx.shadowOffsetX=opts.shadowOffsetX;ctx.shadowOffsetY=opts.shadowOffsetY;ctx.shadowBlur=opts.shadowBlur;ctx.shadowColor=opts.shadowColor;}ctx.closePath();ctx.fill();if(opts.strokeWidth>0){ctx.shadowColor="rgba(0, 0, 0, 0)";ctx.lineWidth=opts.strokeWidth;ctx.strokeStyle=opts.strokeStyle;ctx.beginPath();drawIt.apply(ctx,[points],opts.strokeWidth);ctx.closePath();ctx.stroke();}opts.preShow.apply(this,[$box[0]]);$box.css({display:"none",visibility:"visible"});opts.showTip.apply(this,[$box[0]]);if(opts.overlay){var overlay=$('<div class="bt-overlay"></div>').css({position:"absolute",backgroundColor:"blue",top:top,left:left,width:width,height:height,opacity:".2"}).appendTo(offsetParent);$(this).data("overlay",overlay);}if((opts.ajaxPath!=null&&opts.ajaxCache==false)||ajaxTimeout){content=false;}if(opts.clickAnywhereToClose){jQuery.bt.vars.clickAnywhereStack.push(this);$(document).click(jQuery.bt.docClick);}if(opts.closeWhenOthersOpen){jQuery.bt.vars.closeWhenOpenStack.push(this);}opts.postShow.apply(this,[$box[0]]);};this.btOff=function(){var box=$(this).data("bt-box");opts.preHide.apply(this,[box]);var i=this;i.btCleanup=function(){var box=$(i).data("bt-box");var contentOrig=$(i).data("bt-content-orig");var overlay=$(i).data("bt-overlay");if(typeof box=="object"){$(box).remove();$(i).removeData("bt-box");}if(typeof contentOrig=="object"){var clones=$(contentOrig.original).data("bt-clones");$(contentOrig).data("bt-clones",arrayRemove(clones,contentOrig.clone));}if(typeof overlay=="object"){$(overlay).remove();$(i).removeData("bt-overlay");}jQuery.bt.vars.clickAnywhereStack=arrayRemove(jQuery.bt.vars.clickAnywhereStack,i);jQuery.bt.vars.closeWhenOpenStack=arrayRemove(jQuery.bt.vars.closeWhenOpenStack,i);$(i).removeClass("bt-active "+opts.activeClass);opts.postHide.apply(i);};opts.hideTip.apply(this,[box,i.btCleanup]);};var refresh=this.btRefresh=function(){this.btOff();this.btOn();};});function drawIt(points,strokeWidth){this.moveTo(points[0].x,points[0].y);for(i=1;i<points.length;i++){if(points[i-1].type=="arcStart"){this.quadraticCurveTo(round5(points[i].x,strokeWidth),round5(points[i].y,strokeWidth),round5(points[(i+1)%points.length].x,strokeWidth),round5(points[(i+1)%points.length].y,strokeWidth));i++;}else{this.lineTo(round5(points[i].x,strokeWidth),round5(points[i].y,strokeWidth));}}}function round5(num,strokeWidth){var ret;strokeWidth=numb(strokeWidth);if(strokeWidth%2){ret=num;}else{ret=Math.round(num-0.5)+0.5;}return ret;}function numb(num){return parseInt(num)||0;}function arrayRemove(arr,elem){var x,newArr=new Array();for(x in arr){if(arr[x]!=elem){newArr.push(arr[x]);}}return newArr;}function canvasSupport(){var canvas_compatible=false;try{canvas_compatible=!!(document.createElement("canvas").getContext("2d"));}catch(e){canvas_compatible=!!(document.createElement("canvas").getContext);}return canvas_compatible;}function shadowSupport(){try{var userAgent=navigator.userAgent.toLowerCase();if(/webkit/.test(userAgent)){return true;}else{if(/gecko|mozilla/.test(userAgent)&&parseFloat(userAgent.match(/firefox\/(\d+(?:\.\d+)+)/)[1])>=3.1){return true;}}}catch(err){}return false;}function betweenPoint(point1,point2,dist){var y,x;if(point1.x==point2.x){y=point1.y<point2.y?point1.y+dist:point1.y-dist;return{x:point1.x,y:y};}else{if(point1.y==point2.y){x=point1.x<point2.x?point1.x+dist:point1.x-dist;return{x:x,y:point1.y};}}}function centerPoint(arcStart,corner,arcEnd){var x=corner.x==arcStart.x?arcEnd.x:arcStart.x;var y=corner.y==arcStart.y?arcEnd.y:arcStart.y;var startAngle,endAngle;if(arcStart.x<arcEnd.x){if(arcStart.y>arcEnd.y){startAngle=(Math.PI/180)*180;endAngle=(Math.PI/180)*90;}else{startAngle=(Math.PI/180)*90;endAngle=0;}}else{if(arcStart.y>arcEnd.y){startAngle=(Math.PI/180)*270;endAngle=(Math.PI/180)*180;}else{startAngle=0;endAngle=(Math.PI/180)*270;}}return{x:x,y:y,type:"center",startAngle:startAngle,endAngle:endAngle};}function findIntersect(r1x1,r1y1,r1x2,r1y2,r2x1,r2y1,r2x2,r2y2){if(r2x1==r2x2){return findIntersectY(r1x1,r1y1,r1x2,r1y2,r2x1);}if(r2y1==r2y2){return findIntersectX(r1x1,r1y1,r1x2,r1y2,r2y1);}var r1m=(r1y1-r1y2)/(r1x1-r1x2);var r1b=r1y1-(r1m*r1x1);var r2m=(r2y1-r2y2)/(r2x1-r2x2);var r2b=r2y1-(r2m*r2x1);var x=(r2b-r1b)/(r1m-r2m);var y=r1m*x+r1b;return{x:x,y:y};}function findIntersectY(r1x1,r1y1,r1x2,r1y2,x){if(r1y1==r1y2){return{x:x,y:r1y1};}var r1m=(r1y1-r1y2)/(r1x1-r1x2);var r1b=r1y1-(r1m*r1x1);var y=r1m*x+r1b;return{x:x,y:y};}function findIntersectX(r1x1,r1y1,r1x2,r1y2,y){if(r1x1==r1x2){return{x:r1x1,y:y};}var r1m=(r1y1-r1y2)/(r1x1-r1x2);var r1b=r1y1-(r1m*r1x1);var x=(y-r1b)/r1m;return{x:x,y:y};}};jQuery.fn.btPosition=function(){function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,"marginTop");offset.left-=num(this,"marginLeft");parentOffset.top+=num(offsetParent,"borderTopWidth");parentOffset.left+=num(offsetParent,"borderLeftWidth");results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;};jQuery.fn.btOuterWidth=function(margin){function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}return this["innerWidth"]()+num(this,"borderLeftWidth")+num(this,"borderRightWidth")+(margin?num(this,"marginLeft")+num(this,"marginRight"):0);};jQuery.fn.btOn=function(){return this.each(function(index){if(jQuery.isFunction(this.btOn)){this.btOn();}});};jQuery.fn.btOff=function(){return this.each(function(index){if(jQuery.isFunction(this.btOff)){this.btOff();}});};jQuery.bt.vars={clickAnywhereStack:[],closeWhenOpenStack:[]};jQuery.bt.docClick=function(e){if(!e){var e=window.event;}if(!$(e.target).parents().andSelf().filter(".bt-wrapper, .bt-active").length&&jQuery.bt.vars.clickAnywhereStack.length){$(jQuery.bt.vars.clickAnywhereStack).btOff();
$(document).unbind("click",jQuery.bt.docClick);}};jQuery.bt.defaults={trigger:"hover",clickAnywhereToClose:true,closeWhenOthersOpen:false,shrinkToFit:false,width:"200px",padding:"10px",spikeGirth:10,spikeLength:15,overlap:0,overlay:false,killTitle:true,textzIndex:9999,boxzIndex:9998,wrapperzIndex:9997,offsetParent:null,positions:["most"],fill:"rgb(255, 255, 102)",windowMargin:10,strokeWidth:1,strokeStyle:"#000",cornerRadius:5,centerPointX:0.5,centerPointY:0.5,shadow:false,shadowOffsetX:2,shadowOffsetY:2,shadowBlur:3,shadowColor:"#000",shadowOverlap:false,noShadowOpts:{strokeStyle:"#999"},cssClass:"",cssStyles:{},activeClass:"bt-active",contentSelector:"$(this).attr('title')",ajaxPath:null,ajaxError:"<strong>ERROR:</strong> <em>%error</em>",ajaxLoading:"<blink>Loading...</blink>",ajaxData:{},ajaxType:"GET",ajaxCache:true,ajaxOpts:{},preBuild:function(){},preShow:function(box){},showTip:function(box){$(box).show();},postShow:function(box){},preHide:function(box){},hideTip:function(box,callback){$(box).hide();callback();},postHide:function(){},hoverIntentOpts:{interval:300,timeout:500}};jQuery.bt.options={};})(jQuery);(function($){$.formatCurrency={};$.formatCurrency.regions=[];$.formatCurrency.regions[""]={symbol:"$",positiveFormat:"%s%n",negativeFormat:"(%s%n)",decimalSymbol:".",digitGroupSymbol:",",groupDigits:true};$.fn.formatCurrency=function(destination,settings){if(arguments.length==1&&typeof destination!=="string"){settings=destination;destination=false;}var defaults={name:"formatCurrency",colorize:false,region:"",global:true};defaults=$.extend(defaults,$.formatCurrency.regions[""]);settings=$.extend(defaults,settings);if(settings.region.length>0){settings=$.extend(settings,getRegionOrCulture(settings.region));}return this.each(function(){$this=$(this);var num="0";num=$this[$this.is("input, select, textarea")?"val":"html"]();var trimRegex=new RegExp("[^\\d"+settings.decimalSymbol+"-]","g");num=num.replace(trimRegex,"");if(settings.decimalSymbol!="."){num=num.replace(settings.decimalSymbol,".");}if(isNaN(num)){num="0";}var isPositive=(num==(num=Math.abs(num)));num=Math.floor(num*100);var cents=num%100;num=Math.floor(num/100).toString();if(cents<10){cents="0"+cents;}if(settings.groupDigits){for(var i=0;i<Math.floor((num.length-(1+i))/3);i++){num=num.substring(0,num.length-(4*i+3))+settings.digitGroupSymbol+num.substring(num.length-(4*i+3));}}num=num+settings.decimalSymbol+cents;var format=isPositive?settings.positiveFormat:settings.negativeFormat;var money=format.replace(/%s/g,settings.symbol);money=money.replace(/%n/g,num);if(!destination){destination=$this;}else{destination=$(destination);}destination[destination.is("input, select, textarea")?"val":"html"](money);if(settings.colorize){destination.css("color",isPositive?"black":"red");}});};$.fn.toNumber=function(settings){var defaults=$.extend({name:"toNumber",region:"",global:true},$.formatCurrency.regions[""]);settings=jQuery.extend(defaults,settings);if(settings.region.length>0){settings=$.extend(settings,getRegionOrCulture(settings.region));}return this.each(function(){var method=$(this).is("input, select, textarea")?"val":"html";var trimRegex=new RegExp("[^\\d"+settings.decimalSymbol+"-]","g");$(this)[method]($(this)[method]().replace(trimRegex,""));});};$.fn.asNumber=function(settings){var defaults=$.extend({name:"asNumber",region:"",parse:true,parseType:"Float",global:true},$.formatCurrency.regions[""]);settings=jQuery.extend(defaults,settings);if(settings.region.length>0){settings=$.extend(settings,getRegionOrCulture(settings.region));}settings.parseType=validateParseType(settings.parseType);var method=$(this).is("input, select, textarea")?"val":"html";var trimRegex=new RegExp("[^\\d"+settings.decimalSymbol+"-]","g");var num=$(this)[method]().replace(trimRegex,"");if(!settings.parse){return num;}if(num.length==0){num="0";}if(settings.decimalSymbol!="."){num=num.replace(settings.decimalSymbol,".");}return window["parse"+settings.parseType](num);};function getRegionOrCulture(region){var regionInfo=$.formatCurrency.regions[region];if(regionInfo){return regionInfo;}else{if(/(\w+)-(\w+)/g.test(region)){var culture=region.replace(/(\w+)-(\w+)/g,"$1");return $.formatCurrency.regions[culture];}}return null;}function validateParseType(parseType){switch(parseType.toLowerCase()){case"int":return"Int";case"float":return"Float";default:throw"invalid parseType";}}})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!="undefined"){options=options||{};if(value===null){value="";options.expires=-1;}var expires="";if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)){var date;if(typeof options.expires=="number"){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires="; expires="+date.toUTCString();}var path=options.path?"; path="+(options.path):"";var domain=options.domain?"; domain="+(options.domain):"";var secure=options.secure?"; secure":"";document.cookie=[name,"=",encodeURIComponent(value),expires,path,domain,secure].join("");}else{var cookieValue=null;if(document.cookie&&document.cookie!=""){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+"=")){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],"validator");if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],"validator",validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug){event.preventDefault();}function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is("form")){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,"validator").settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages){settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);}break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return !$.trim(""+a.value);},filled:function(a){return !!$.trim(""+a.value);},unchecked:function(a){return !a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1){return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};}if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(element)).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted){this.element(element);}else{if(element.parentNode.name in this.submitted){this.element(element.parentNode);}}},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler){$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);}},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid()){$(this.currentForm).triggerHandler("invalid-form",[this]);}this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return !(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm){$(this.currentForm).resetForm();}this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj){count++;}return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules())){return false;}rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name).not(this.settings.ignore)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(var method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch){return;}if(this.objectLength(rules)){this.successList.push(element);}return true;},customMetaMessage:function(element,method){if(!$.metadata){return;}var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();
return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined){return arguments[i];}}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else{if(theregex.test(message)){message=jQuery.format(message.replace(theregex,"{$1}"),rule.parameters);}}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper){toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));}return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length){this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr("for")==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case"select":return $("option:selected",element).length;case"input":if(this.checkable(element)){return this.findByName(element.name).filter(":checked").length;}}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return !!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return !$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0;}delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else{if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr("class");classes&&$.each(classes.split(" "),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(var method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata){return{};}var meta=$.data(element.form,"validator").settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,"validator");if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(["minlength","maxlength","min","max"],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(["rangelength","range"],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element)){return"dependency-mismatch";}switch(element.nodeName.toLowerCase()){case"select":var val=$(element).val();return val&&val.length>0;case"input":if(this.checkable(element)){return this.getLength(value,element)>0;}default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element)){return"dependency-mismatch";}var previous=this.previousValue(element);if(!this.settings.messages[element.name]){this.settings.messages[element.name]={};}previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(this.pending[element.name]){return"pending";}if(previous.old===value){return previous.valid;}previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element)){return"dependency-mismatch";}if(/[^0-9-]+/.test(value)){return false;}var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9){nDigit-=9;}}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);(function($){var pendingRequests={};if($.ajaxPrefilter){$.ajaxPrefilter(function(settings,_,xhr){var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}pendingRequests[port]=xhr;}});}else{var ajax=$.ajax;$.ajax=function(settings){var mode=("mode" in settings?settings:$.ajaxSettings).mode,port=("port" in settings?settings:$.ajaxSettings).port;if(mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};}})(jQuery);(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:"focusin",blur:"focusout"},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});}$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);(function($){$.rloader=function(args){var list=[];if(args&&!(args.propertyIsEnumerable("length"))&&typeof args==="object"&&typeof args.length==="number"){list=args;}else{list[0]=args;}$.each(list,function(i,res){function checkHist(src){if($.rloader.track[src].status){return $.rloader.track[src].status;}else{return 0;}}function loadCSS(options){var callback=null;var src=options.src,cache=true,arg=options.arg||{};if(options.callback){callback=options.callback;}if(typeof options.cache!="undefined"){cache=options.cache;}if(cache===false){var d=new Date();src=src+"?"+d.getTime();}if(checkHist(options.src)>0){return true;}$.rloader.track[options.src].status=0;var node=document.createElement("link");node.type="text/css";node.rel="stylesheet";node.href=src;node.media="screen";document.getElementsByTagName("head")[0].appendChild(node);$.rloader.track[options.src].status=1;if(callback){callback(arg);}}function loadJS(options){var callback=null;var src=options.src,async=options.async||false,cache=true,arg=options.arg||{};if(options.callback){callback=options.callback;}if(typeof options.cache!="undefined"){cache=options.cache;}if(checkHist(src)>0){return true;}$.rloader.track[src].status=0;$.ajax({type:"GET",url:src,async:async,cache:cache,dataType:"script",success:function(){$.rloader.track[src].status=1;if(callback){callback(arg);}}});}if(typeof res.type=="string"&&typeof res.src=="string"){if(!$.rloader.track[res.src]){$.rloader.track[res.src]={"status":0};
}if(res.type=="css"){loadCSS(res);}if(res.type=="js"){loadJS(res);}}});};$.rloader.track={};})(jQuery);(function(jQuery,undefined){var oldManip=jQuery.fn.domManip,tmplItmAtt="_tmplitem",htmlExpr=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,newTmplItems={},wrappedItems={},appendToTmplItems,topTmplItem={key:0,data:{}},itemKey=0,cloneIndex=0,stack=[];function newTmplItem(options,parentItem,fn,data){var newItem={data:data||(data===0||data===false)?data:(parentItem?parentItem.data:{}),_wrap:parentItem?parentItem._wrap:null,tmpl:null,parent:parentItem||null,nodes:[],calls:tiCalls,nest:tiNest,wrap:tiWrap,html:tiHtml,update:tiUpdate};if(options){jQuery.extend(newItem,options,{nodes:[],parent:parentItem});}if(fn){newItem.tmpl=fn;newItem._ctnt=newItem._ctnt||newItem.tmpl(jQuery,newItem);newItem.key=++itemKey;(stack.length?wrappedItems:newTmplItems)[itemKey]=newItem;}return newItem;}jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector),elems,i,l,tmplItems,parent=this.length===1&&this[0].parentNode;appendToTmplItems=newTmplItems||{};if(parent&&parent.nodeType===11&&parent.childNodes.length===1&&insert.length===1){insert[original](this[0]);ret=this;}else{for(i=0,l=insert.length;i<l;i++){cloneIndex=i;elems=(i>0?this.clone(true):this).get();jQuery(insert[i])[original](elems);ret=ret.concat(elems);}cloneIndex=0;ret=this.pushStack(ret,name,insert.selector);}tmplItems=appendToTmplItems;appendToTmplItems=null;jQuery.tmpl.complete(tmplItems);return ret;};});jQuery.fn.extend({tmpl:function(data,options,parentItem){return jQuery.tmpl(this[0],data,options,parentItem);},tmplItem:function(){return jQuery.tmplItem(this[0]);},template:function(name){return jQuery.template(name,this[0]);},domManip:function(args,table,callback,options){if(args[0]&&jQuery.isArray(args[0])){var dmArgs=jQuery.makeArray(arguments),elems=args[0],elemsLength=elems.length,i=0,tmplItem;while(i<elemsLength&&!(tmplItem=jQuery.data(elems[i++],"tmplItem"))){}if(tmplItem&&cloneIndex){dmArgs[2]=function(fragClone){jQuery.tmpl.afterManip(this,fragClone,callback);};}oldManip.apply(this,dmArgs);}else{oldManip.apply(this,arguments);}cloneIndex=0;if(!appendToTmplItems){jQuery.tmpl.complete(newTmplItems);}return this;}});jQuery.extend({tmpl:function(tmpl,data,options,parentItem){var ret,topLevel=!parentItem;if(topLevel){parentItem=topTmplItem;tmpl=jQuery.template[tmpl]||jQuery.template(null,tmpl);wrappedItems={};}else{if(!tmpl){tmpl=parentItem.tmpl;newTmplItems[parentItem.key]=parentItem;parentItem.nodes=[];if(parentItem.wrapped){updateWrapped(parentItem,parentItem.wrapped);}return jQuery(build(parentItem,null,parentItem.tmpl(jQuery,parentItem)));}}if(!tmpl){return[];}if(typeof data==="function"){data=data.call(parentItem||{});}if(options&&options.wrapped){updateWrapped(options,options.wrapped);}ret=jQuery.isArray(data)?jQuery.map(data,function(dataItem){return dataItem?newTmplItem(options,parentItem,tmpl,dataItem):null;}):[newTmplItem(options,parentItem,tmpl,data)];return topLevel?jQuery(build(parentItem,null,ret)):ret;},tmplItem:function(elem){var tmplItem;if(elem instanceof jQuery){elem=elem[0];}while(elem&&elem.nodeType===1&&!(tmplItem=jQuery.data(elem,"tmplItem"))&&(elem=elem.parentNode)){}return tmplItem||topTmplItem;},template:function(name,tmpl){if(tmpl){if(typeof tmpl==="string"){tmpl=buildTmplFn(tmpl);}else{if(tmpl instanceof jQuery){tmpl=tmpl[0]||{};}}if(tmpl.nodeType){tmpl=jQuery.data(tmpl,"tmpl")||jQuery.data(tmpl,"tmpl",buildTmplFn(tmpl.innerHTML));}return typeof name==="string"?(jQuery.template[name]=tmpl):tmpl;}return name?(typeof name!=="string"?jQuery.template(null,name):(jQuery.template[name]||jQuery.template(null,htmlExpr.test(name)?name:jQuery(name)))):null;},encode:function(text){return(""+text).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;");}});jQuery.extend(jQuery.tmpl,{tag:{"tmpl":{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},"wrap":{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},"each":{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},"html":{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(items){newTmplItems={};},afterManip:function afterManip(elem,fragClone,callback){var content=fragClone.nodeType===11?jQuery.makeArray(fragClone.childNodes):fragClone.nodeType===1?[fragClone]:[];callback.call(elem,fragClone);storeTmplItems(content);cloneIndex++;}});function build(tmplItem,nested,content){var frag,ret=content?jQuery.map(content,function(item){return(typeof item==="string")?(tmplItem.key?item.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+tmplItmAtt+'="'+tmplItem.key+'" $2'):item):build(item,tmplItem,item._ctnt);}):tmplItem;if(nested){return ret;}ret=ret.join("");ret.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(all,before,middle,after){frag=jQuery(middle).get();storeTmplItems(frag);if(before){frag=unencode(before).concat(frag);}if(after){frag=frag.concat(unencode(after));}});return frag?frag:unencode(ret);}function unencode(text){var el=document.createElement("div");el.innerHTML=text;return jQuery.makeArray(el.childNodes);}function buildTmplFn(markup){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;"+"with($data){__.push('"+jQuery.trim(markup).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(all,slash,type,fnargs,target,parens,args){var tag=jQuery.tmpl.tag[type],def,expr,exprAutoFnDetect;if(!tag){throw"Unknown template tag: "+type;}def=tag._default||[];if(parens&&!/\w$/.test(target)){target+=parens;parens="";}if(target){target=unescape(target);args=args?(","+unescape(args)+")"):(parens?")":"");expr=parens?(target.indexOf(".")>-1?target+unescape(parens):("("+target+").call($item"+args)):target;exprAutoFnDetect=parens?expr:"(typeof("+target+")==='function'?("+target+").call($item):("+target+"))";}else{exprAutoFnDetect=expr=def.$1||"null";}fnargs=unescape(fnargs);return"');"+tag[slash?"close":"open"].split("$notnull_1").join(target?"typeof("+target+")!=='undefined' && ("+target+")!=null":"true").split("$1a").join(exprAutoFnDetect).split("$1").join(expr).split("$2").join(fnargs||def.$2||"")+"__.push('";})+"');}return __;");}function updateWrapped(options,wrapped){options._wrap=build(options,true,jQuery.isArray(wrapped)?wrapped:[htmlExpr.test(wrapped)?wrapped:jQuery(wrapped).html()]).join("");}function unescape(args){return args?args.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null;}function outerHtml(elem){var div=document.createElement("div");div.appendChild(elem.cloneNode(true));return div.innerHTML;}function storeTmplItems(content){var keySuffix="_"+cloneIndex,elem,elems,newClonedItems={},i,l,m;for(i=0,l=content.length;i<l;i++){if((elem=content[i]).nodeType!==1){continue;}elems=elem.getElementsByTagName("*");for(m=elems.length-1;m>=0;m--){processItemKey(elems[m]);}processItemKey(elem);}function processItemKey(el){var pntKey,pntNode=el,pntItem,tmplItem,key;if((key=el.getAttribute(tmplItmAtt))){while(pntNode.parentNode&&(pntNode=pntNode.parentNode).nodeType===1&&!(pntKey=pntNode.getAttribute(tmplItmAtt))){}if(pntKey!==key){pntNode=pntNode.parentNode?(pntNode.nodeType===11?0:(pntNode.getAttribute(tmplItmAtt)||0)):0;if(!(tmplItem=newTmplItems[key])){tmplItem=wrappedItems[key];tmplItem=newTmplItem(tmplItem,newTmplItems[pntNode]||wrappedItems[pntNode]);tmplItem.key=++itemKey;newTmplItems[itemKey]=tmplItem;}if(cloneIndex){cloneTmplItem(key);}}el.removeAttribute(tmplItmAtt);}else{if(cloneIndex&&(tmplItem=jQuery.data(el,"tmplItem"))){cloneTmplItem(tmplItem.key);newTmplItems[tmplItem.key]=tmplItem;pntNode=jQuery.data(el.parentNode,"tmplItem");pntNode=pntNode?pntNode.key:0;}}if(tmplItem){pntItem=tmplItem;while(pntItem&&pntItem.key!=pntNode){pntItem.nodes.push(el);pntItem=pntItem.parent;}delete tmplItem._ctnt;delete tmplItem._wrap;jQuery.data(el,"tmplItem",tmplItem);}function cloneTmplItem(key){key=key+keySuffix;tmplItem=newClonedItems[key]=(newClonedItems[key]||newTmplItem(tmplItem,newTmplItems[tmplItem.parent.key+keySuffix]||tmplItem.parent));}}}function tiCalls(content,tmpl,data,options){if(!content){return stack.pop();}stack.push({_:content,tmpl:tmpl,item:this,data:data,options:options});}function tiNest(tmpl,data,options){return jQuery.tmpl(jQuery.template(tmpl),data,options,this);}function tiWrap(call,wrapped){var options=call.options||{};options.wrapped=wrapped;return jQuery.tmpl(jQuery.template(call.tmpl),call.data,options,call.item);}function tiHtml(filter,textOnly){var wrapped=this._wrap;return jQuery.map(jQuery(jQuery.isArray(wrapped)?wrapped.join(""):wrapped).filter(filter||"*"),function(e){return textOnly?e.innerText||e.textContent:e.outerHTML||outerHtml(e);});}function tiUpdate(){var coll=this.nodes;jQuery.tmpl(null,null,null,this).insertBefore(coll[0]);jQuery(coll).remove();}})(jQuery);(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],"validator");if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],"validator",validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug){event.preventDefault();}function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is("form")){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,"validator").settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages){settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);}break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return !$.trim(""+a.value);},filled:function(a){return !!$.trim(""+a.value);},unchecked:function(a){return !a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1){return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};}if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(element)).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted){this.element(element);}else{if(element.parentNode.name in this.submitted){this.element(element.parentNode);}}},highlight:function(element,errorClass,validClass){if(element.type==="radio"){this.findByName(element.name).addClass(errorClass).removeClass(validClass);}else{$(element).addClass(errorClass).removeClass(validClass);}},unhighlight:function(element,errorClass,validClass){if(element.type==="radio"){this.findByName(element.name).removeClass(errorClass).addClass(validClass);}else{$(element).removeClass(errorClass).addClass(validClass);}}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);
}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler){$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);}},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid()){$(this.currentForm).triggerHandler("invalid-form",[this]);}this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return !(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm){$(this.currentForm).resetForm();}this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj){count++;}return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules())){return false;}rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name).not(this.settings.ignore)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(var method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch){return;}if(this.objectLength(rules)){this.successList.push(element);}return true;},customMetaMessage:function(element,method){if(!$.metadata){return;}var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined){return arguments[i];}}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else{if(theregex.test(message)){message=jQuery.format(message.replace(theregex,"{$1}"),rule.parameters);}}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper){toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));}return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length){this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr("for")==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case"select":return $("option:selected",element).length;case"input":if(this.checkable(element)){return this.findByName(element.name).filter(":checked").length;}}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return !!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return !$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0;}delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else{if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr("class");classes&&$.each(classes.split(" "),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(var method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata){return{};}var meta=$.data(element.form,"validator").settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,"validator");if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(["minlength","maxlength","min","max"],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(["rangelength","range"],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element)){return"dependency-mismatch";}switch(element.nodeName.toLowerCase()){case"select":var val=$(element).val();return val&&val.length>0;case"input":if(this.checkable(element)){return this.getLength(value,element)>0;}default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element)){return"dependency-mismatch";}var previous=this.previousValue(element);if(!this.settings.messages[element.name]){this.settings.messages[element.name]={};}previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(this.pending[element.name]){return"pending";}if(previous.old===value){return previous.valid;}previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=response||validator.defaultMessage(element,"remote");errors[element.name]=previous.message=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element)){return"dependency-mismatch";}if(/[^0-9-]+/.test(value)){return false;}var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9){nDigit-=9;}}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);(function($){var pendingRequests={};if($.ajaxPrefilter){$.ajaxPrefilter(function(settings,_,xhr){var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}pendingRequests[port]=xhr;}});}else{var ajax=$.ajax;$.ajax=function(settings){var mode=("mode" in settings?settings:$.ajaxSettings).mode,port=("port" in settings?settings:$.ajaxSettings).port;if(mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};}})(jQuery);(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:"focusin",blur:"focusout"},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});}$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);jQuery.validator.addMethod("CombinedLength",function(value,element){var $form=jQuery(element).parents("form"),$firstName=$form.find('input[name="firstName"]'),$lastName=$form.find('input[name="lastName"]'),$overlay=null,full_name=$firstName.val()+" "+$lastName.val(),popup=null;if(full_name.length>34){if(!jQuery("#dialog_name_length").length){popup=new FL.dialog("dialog_name_length",{content:"First name and last name cannot be longer than 34 characters combined.  Please adjust either the first name or last name field to decrease the character length to below 34 characters."},{close:function(event,ui){$overlay=jQuery("#ship").find(".ui-widget-overlay");if($overlay.length>0){$overlay.remove();}},title:"Name Values Too Long"});FL.checkout.ship.popupHasDisplayed=true;}return false;}if($firstName.val().length>0&&$lastName.val().length>0){$firstName.parents(".formItem").find("div:not(input)").hide();$lastName.parents(".formItem").find("div:not(input)").hide();}return true;},"First and last name too long");var alternateColors=new Array();var currentColor=null;var clearImageTimer=null;function passOmniture(){var s=s_gi(scServerCode);s.eVar3="cross-sell";s.linkTrackVars="eVar3";s.tl(this,"o","CrossSell");}function decode64(input){var keyStr="ABCDEFGHIJKLMNOP"+"QRSTUVWXYZabcdef"+"ghijklmnopqrstuv"+"wxyz0123456789+/"+"=";var output="";var chr1,chr2,chr3="";var enc1,enc2,enc3,enc4="";var i=0;var base64test=/[^A-Za-z0-9\+\/\=]/g;if(base64test.exec(input)){alert("There were invalid base64 characters in the input text.\n"+"Valid base64 characters are A-Z, a-z, 0-9"+"Expect errors in decoding.");}input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}if(enc4!=64){output=output+String.fromCharCode(chr3);}chr1=chr2=chr3="";enc1=enc2=enc3=enc4="";}while(i<input.length);return output;}(function(){var initializing=false,fnTest=/xyz/.test(function(){xyz;})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(prop){var _super=this.prototype;initializing=true;var prototype=new this();initializing=false;for(var name in prop){prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])?(function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret;};})(name,prop[name]):prop[name];}function Class(){if(!initializing&&this.init){this.init.apply(this,arguments);}}Class.prototype=prototype;Class.constructor=Class;Class.extend=arguments.callee;return Class;};})();jQuery.getViewportHeight=function(){if(window.innerHeight!==window.undefined){return window.innerHeight;}if(document.compatMode==="CSS1Compat"){return document.documentElement.clientHeight;}if(document.body){return document.body.clientHeight;}return window.undefined;};jQuery.getViewportWidth=function(){if(window.innerWidth!==window.undefined){return window.innerWidth;}if(document.compatWidth==="CSS1Compat"){return document.documentELement.clientWidth;}if(document.body){return document.body.clientWidth;}return window.undefined;};jQuery.truncateText=function(text,length){return text.length>length?text.substring(0,(length-3))+"...":text;};jQuery.readCookie=function(name){var nameEQ=name+"=",ca=document.cookie.split(";"),caLength=ca.length,c;for(i=0;i<caLength;i++){c=ca[i];while(c.charAt(0)===" "){c=c.substring(1,c.length);}if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length);}}return null;};var GoogleMaps=Class.extend({data:{geocoder:null,map:null,mapId:"",latitude:0,longitude:0,point:null,icon:null,letters:new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"),markers:new Array()},init:function(options){options=jQuery.extend({mapId:"#map"},options);this.data.icon=new GIcon();this.data.icon.image="/store/images/instorepickup/icons_v3/marker_empty.png";this.data.icon.iconSize=new GSize(16,25);this.data.icon.shadowSize=new GSize(22,20);this.data.icon.iconAnchor=new GPoint(8,25);this.data.icon.infoWindowAnchor=new GPoint(5,1);this.data.geocoder=new GClientGeocoder();this.data.mapId=options.mapId;},addMarkerToArray:function(options){options=jQuery.extend({marker:null,index:null},options);if(options.marker!==null&&options.index!==null){this.data.markers[options.index]=options.marker;}},clearMap:function(){this.data.map.clearOverlays();},createMarker:function(options){options=jQuery.extend({image:"/store/images/instorepickup/icons_v3/marker_empty.png",latitude:0,longitude:0,marker:null,text:null},options);this.data.icon.image=options.image;if(options.marker===null){options.marker=new GMarker(new GLatLng(options.latitude,options.longitude),this.data.icon);}this.data.map.addOverlay(options.marker);if(options.text!==null){GEvent.addListener(options.marker,"click",function(){options.marker.openInfoWindowHtml(options.text);});}return options.marker;},getGeocoder:function(){return this.data.geocoder;},getLatitude:function(){return this.data.latitude;},getLongitude:function(){return this.data.longitude;},getLatLngFromPoint:function(options){options=jQuery.extend({point:null},options);if(options.point!==null){this.data.latitude=this.parseLatitude({point:options.point});this.data.longitude=this.parseLongitude({point:options.point});}},getMap:function(){return this.data.map;},getMarkerFromArray:function(options){options=jQuery.extend({index:0},options);return this.data.markers[options.index];},loadMap:function(){this.data.map=new GMap2(jQuery(this.data.mapId)[0]);this.data.map.addControl(new GSmallMapControl());this.data.map.addControl(new GMapTypeControl());},parseLatitude:function(options){options=jQuery.extend({point:null},options);if(options.point!==null){return parseInt(parseFloat(String(options.point).split(", ")[0].substring(1))*10000000)/10000000;}return 0;},parseLongitude:function(options){var longitudePoint;options=jQuery.extend({point:null},options);if(options.point!==null){longitudePoint=String(options.point).split(", ")[1];return parseInt(parseFloat(longitudePoint.substring(0,longitudePoint.length-1))*10000000)/10000000;}return 0;}});var StoreLocator=GoogleMaps.extend({init:function(options){options=jQuery.extend({mapId:"#map"},options);this._super(options);this.data.ajaxControls="/store/catalog/fragments/instore_controls.jsp";},clearForLoad:function(){jQuery("#ispu").find("#content").html('<div id="leftLoadingImage"></div>');},displayCountMessage:function(options){options=jQuery.extend({count:0,miles:10},options);var html=['<div id="countMessage" class="storeCount">',"We found "+options.count+" stores within "+options.miles+" miles","</div>"].join("");jQuery("#countMessage").remove();jQuery("#messageText").append(html);},displayMap:function(){var storeLocator=this;var address=storeLocator.getAddress();if(address!==null){storeLocator.loadMap();storeLocator.clearForLoad();storeLocator.data.geocoder.getLatLng(address,function(point){storeLocator.clearMap();storeLocator.data.map.setCenter(point,storeLocator.getZoom());storeLocator.getLatLngFromPoint({point:point});storeLocator.createMarker({latitude:storeLocator.getLatitude(),longitude:storeLocator.getLongitude(),text:"<strong>Starting Location</strong><br/>"+address});jQuery.ajax({data:{control:"loadStores",latitude:storeLocator.data.latitude,longitude:storeLocator.data.longitude,miles:storeLocator.getMiles()},dataType:"xml",type:"POST",url:storeLocator.data.ajaxControls,success:function(xml,textStatus,jqXHR){storeLocator.loadStores({stores:jQuery(xml).find("store")});}});});}},addFavoriteStore:function(options){var storeLocator=this;options=jQuery.extend({storeId:null},options);if(options.storeId!==null){jQuery.ajax({data:{control:"updateFavorites",retailerId:options.storeId},dataType:"xml",type:"POST",url:storeLocator.data.ajaxControls,success:function(xml,textStatus,jqXHR){var status=jQuery(xml).find("status");if(status==="error-exist"){alert("Selected store is already set as a favorite.  Please select another store.");}else{if(status==="error-max"){alert("Only three stores can be selected as favorites.  Remove a store from your favorites if you wish to add this store.");}else{storeLocator.displayFavoriteStores({addedStore:true});}}}});}},displayFavoriteStores:function(options){var storeLocator=this;options=jQuery.extend({addedStore:false},options);jQuery.ajax({data:{control:"loadFavorites"},dataType:"xml",type:"POST",url:storeLocator.data.ajaxControls,success:function(xml,textStatus,jqXHR){var stores=new Array();jQuery(xml).find("store").each(function(index){var storeId=jQuery(this).find("id").text();var storeName=jQuery(this).find("name").text();stores[index]=['<div class="favStore" id="favStore_'+storeId+'" storeId="'+storeId+'">','<div id="remove_'+storeId+'" class="remove">','<img src="/store/images/instorepickup/button_remove_transparent.gif" alt="Remove"/>',"</div>","<div>"+storeName+"</div>","</div>"].join("");});jQuery("#selectedStores").html(stores.join("")).find(".favStore").click(function(){storeLocator.removeFavoriteStore({storeId:jQuery(this).attr("storeId")});});}});},removeFavoriteStore:function(options){var storeLocator=this;options=jQuery.extend({storeId:null},options);if(options.storeId!==null){jQuery.ajax({data:{control:"removeFavorite",retailerId:options.storeId},dataType:"xml",type:"GET",url:storeLocator.data.ajaxControls,success:function(xml,textStatus,jqXHR){storeLocator.displayFavoriteStores();}});}},getAddress:function(){var defaults={zipCode:"Enter ZIP Code",city:"City",state:"-"};var values={zipCode:jQuery("#zipcode").val(),city:jQuery("#city").val(),state:jQuery("#state").val()};if(values.zipCode!==defaults.zipCode&&values.zipCode!==""){return values.zipCode;}else{if(values.state!==defaults.state&&values.state!==""){if(values.city!==defaults.city&&values.city!==""){return values.city+", "+values.state;}}}new FL.dialog("storelocator_error",{content:"Please enter a zip code or city/state so we can load the stores nearest you."},{height:130,title:"Information Required",width:300});return null;},getMiles:function(){return jQuery("#ispu").find('input[name="miles"]:checked').val();},getZoom:function(){var miles=this.getMiles();switch(miles){case 10:return 10;break;case 50:return 8;break;default:return 9;break;}},getImage:function(options){options=jQuery.extend({index:0},options);return"/store/images/instorepickup/icons_v3/marker_"+this.data.letters[options.index].toLowerCase()+".png";},getStoreInfo:function(options){var store,storeInfo;options=jQuery.extend({store:null},options);storeInfo="";if(options.store!==null){store={name:jQuery(options.store).find("name").text(),address1:jQuery(options.store).find("street1").text(),address2:jQuery(options.store).find("street2").text(),city:jQuery(options.store).find("city").text(),state:jQuery(options.store).find("state").text(),zip:jQuery(options.store).find("zip").text(),phone:jQuery(options.store).find("phone").text()};store.address2=store.address2!==" "?"<br/>"+store.address2:"";storeInfo=["<strong>"+store.name+"</strong><br/>",store.address1+store.address2+"<br/>",store.city+", "+store.state+" "+store.zip+"<br/>",store.phone+"<br/><br/>","<strong>Enter starting address</strong><br/>",'<form target="_blank" method="get" action="http://maps.google.com/maps">','<input id="saddr" type="text" value="" name="saddr" maxlength="40" size="30"/><br/>','<input type="image" src="/store/images/instorepickup/b_getdirections.jpg"/>','<input type="hidden" name="daddr" value="'+store.address1+", "+store.city+", "+store.state+" "+store.zip+'"/>',"</form>"].join("");}return storeInfo;},loadStores:function(options){var storeLocator=this;var currentStores=new Array();options=jQuery.extend({stores:null},options);storeLocator.data.stores=options.stores;jQuery(options.stores).each(function(index){var store={id:jQuery(this).find("id").text(),name:jQuery(this).find("name").text(),city:jQuery(this).find("city").text(),state:jQuery(this).find("state").text(),phone:jQuery(this).find("phone").text(),latitude:jQuery(this).find("latitude").text(),longitude:jQuery(this).find("longitude").text()};currentStores[index]=['<div id="store_'+index+'" class="store">','<div id="links_'+index+'" class="links">','<div><img id="addStore_'+store.id+'" class="favoriteStore" src="/store/images/instorepickup/button_addstore.jpg"/></div>','<div id="directions_'+index+'" class="directions">','<img src="/store/images/instorepickup/button_directions.jpg"/>',"</div>","</div>",'<div class="icon" style="background-position: -'+(index*20)+'px 0">','<img src="/store/images/instorepickup/icons_v3/transparent.gif"/>',"</div>",'<div id="demographics_'+index+'">','<div class="name">'+store.name+" - "+store.city+", "+store.state+"</div>","<div>Phone: "+store.phone+"</div>","</div>","</div>"].join("");storeLocator.addMarkerToArray({marker:storeLocator.createMarker({latitude:store.latitude,longitude:store.longitude,text:storeLocator.getStoreInfo({store:this}),image:storeLocator.getImage({index:index})}),index:index});});jQuery("#ispu").find("#content").html(currentStores.join('<div class="seperator"><img src="/store/images/instorepickup/seperator.gif"/></div>'));storeLocator.displayCountMessage({count:storeLocator.data.stores.length,miles:storeLocator.getMiles()});
jQuery("#content").find(".links").each(function(){jQuery(this).find(".favoriteStore").click(function(){storeLocator.addFavoriteStore({storeId:jQuery(this).attr("id").split("_")[1]});}).end().find(".directions").click(function(){var index=jQuery(this).attr("id").split("_")[1];storeLocator.getMarkerFromArray({index:index}).openInfoWindow(storeLocator.getStoreInfo({store:storeLocator.data.stores[index]}));});});}});var DropDownData={open:false};var DropDown=Class.extend({init:function(id){this.selectOn=false;this.container="#"+id+"Container";this.list="#"+id+"List";this.image="#"+id+"Img";this.imageOpen=jQuery(this.image).attr("src");this.imageClose=jQuery(this.image).attr("src").replace("open","close");jQuery("body").click(this.turnOffSearchSelects);jQuery(this.container).click(showHide);jQuery(this.list).click(showHide);},showHide:function(){if(jQuery(this.list).css("display")==="block"){jQuery(this.list).css({display:"none"});jQuery(this.image).attr("src",this.imageOpen);DropDownData.open=false;}else{jQuery(this.list).css({display:"block"});jQuery(this.image).attr("src",this.imageClose);setTimeout("DropDownData.open = true",1);}},turnOffSearchSelects:function(){if(DropDownData.open){jQuery(this.list).css({display:"none"});jQuery(this.image).attr("src",this.imageOpen);DropDownData.open=false;}}});var Product=Class.extend({init:function(product){if(product!==null){this.xml=product;this.active=jQuery(this.xml).find("active").text();this.productId=jQuery(this.xml).find("productId").text();this.colorDescription=jQuery(this.xml).find("colorDescription").text();this.description=jQuery(this.xml).find("description").text();this.instoreOnly=jQuery(this.xml).find("instoreOnly").text();this.colorId=jQuery(this.xml).find("colorId").text();this.image=jQuery(this.xml).find("image").text();this.thumbnail=jQuery(this.xml).find("image").text().replace("/lg","/sm").replace(".jpg",".gif");this.name=jQuery(this.xml).find("name").text();this.wasPrice=jQuery(this.xml).find("original").text()==="no-sale"?"":jQuery(this.xml).find("original").text();this.styleDescription=jQuery(this.xml).find("style").text()+" "+jQuery(this.xml).find("colorId").text();this.styleId=jQuery(this.xml).find("style").text();this.nowPrice=jQuery(this.xml).find("sale").text();this.salesText=jQuery(this.xml).find("original").text()!=="no-sale"?"SALE!":"";this.onSale=jQuery(this.xml).find("original").text()==="no-sale"?false:true;this.freeShipText=jQuery(this.xml).find("freeShipText").text();var otherDetails=[];var colors=[];var skus=[];var skuAvailable=[];if(this.colorDescription==="null"){this.colorDescription="&nbsp;";}jQuery(this.xml).find("otherdetails").find("details").each(function(index){this.otherDetails[index]=jQuery(this).text();});jQuery(this.xml).find("colors").find("color").each(function(index){colors[index]=this;});jQuery(this.xml).find("sizes").find("size").each(function(){skus.push({sku:jQuery(this).attr("sku"),available:jQuery(this).attr("available"),size:jQuery(this).text()});skuAvailable.push(jQuery(this).attr("available"));});this.otherDetails=otherDetails;this.colors=colors;this.skus=skus;this.skuAvailable=skuAvailable;}},getColorArray:function(index){return;[this.getColorName(index),this.getColorSelected(index),this.getColorProductId(index),this.getColorThumbnail(index)];},getColorName:function(index){return jQuery(this.colors[index]).text();},getColorProductId:function(index){return jQuery(this.colors[index]).attr("productId");},getColorSelected:function(index){return jQuery(this.colors[index]).prop("selected");},getSizeArray:function(index){return;[this.getSizeText(index),this.getSizeSku(index)];},getSizeText:function(index){return this.skus[index].size.replace(/=AMPERSAND=/g,"&");},getSizeSku:function(index){return this.skus[index].sku;}});var AlternateProduct=Class.extend({init:function(productId,index){jQuery.ajax({data:{productId:productId},dataType:"xml",type:"GET",url:"/store/results/fragments/productLookupXML.jsp",success:function(xml,textStatus,jqXHR){alternateColors[index]=new Product(jQuery(xml).find("product")[0]);}});}});var CurrentProduct=Class.extend({init:function(productId){jQuery.ajax({data:{productId:productId},dataType:"xml",type:"GET",url:"/store/results/fragments/productLookupXML.jsp",success:function(xml,textStatus,jqXHR){currentColor=new Product(jQuery(xml).find("product")[0]);}});}});var AlsoRecommendedProduct=Class.extend({init:function(productLink,containerId){var alsoRecommended=this;this.productId=productLink.split("=")[1];jQuery.ajax({data:{productId:this.productId},dataType:"xml",type:"GET",url:"/store/results/fragments/productLookupXML.jsp",success:function(xml,textStatus,jqXHR){var product=new Product(jQuery(xml).find("product")[0]);var pricing={};if(product.onSale){pricing.now='<div class="nowPrice">Now: '+product.nowPrice+"</div>";pricing.was='<div class="wasPrice">Was: '+product.wasPrice+"</div>";}else{pricing.now='<div class="origPrice">'+product.nowPrice+"</div>";pricing.was="";}var html=['<div id="suggest_'+product.productId+'" class="product">','<div class="thumbnail">','<a href="/store/catalog/product.jsp?productId='+product.productId+'">','<img src="http://www.finishline.com/store/'+product.thumbnail+'" alt="'+product.name+'"/>',"</a>","</div>",'<div class="details">','<div class="salesText">'+product.freeShipText+"</div>",'<div class="name">','<a href="/store/catalog/product.jsp?productId='+product.productId+'">',product.name,"</a>","</div>",pricing.now,pricing.was,"</div>","</div>"].join("");jQuery("#"+containerId).append(html).find("#suggest_"+product.productId).mouseover(alsoRecommended.hoverOn).mouseout(alsoRecommended.hoverOff).find(".name").click(passOmniture).end().find(".thumbnail").find("a").click(passOmniture);}});},hoverOn:function(){jQuery(this).addClass("hover");},hoverOff:function(){jQuery(this).removeClass("hover");}});var AlsoRecommendedSSCPrototype=Class.extend({init:function(productLink,containerId){jQuery.ajax({data:{productId:productLink.split("=")[1]},type:"GET",dataType:"json",url:"/store/results/fragments/productLookupJSON.jsp",success:function(data,textStatus,jqXHR){var displayPrice,suggest,thumbnail;if(data.product.prices.original==="no-sale"){displayPrice="Price: "+data.product.prices.sale;}else{displayPrice=["Price: ",'<span class="wasPrice">'+data.product.prices.original+"</span> ",'<span class="nowPrice">'+data.product.prices.sale+"</span>"].join("");}thumbnail=data.product.image.replace("/lg","/sm").replace(".jpg",".gif");suggest=['<div id="suggest_'+data.product.productId+'" class="product visualIEFloatFix">','<div class="addToCart visualIEFloatFix">','<a href="#">Add to cart</a>',"</div>",'<img src="http://www.finishline.com/store'+thumbnail+'" alt="'+data.product.name+'" class="prodImg visualIEFloatFix"/>','<div class="name">','<a href="/store/catalog/product.jsp?productId='+data.product.productId+'&eVar3=cross_sell">'+data.product.name+"</a>","</div>",'<div class="color">'+data.product.colorDescription+"</div>",'<div class="product">'+displayPrice+"</div>","</div>"].join("");jQuery("#"+containerId).append(suggest).find("#suggest_"+data.product.productId).find(".addToCart").find("a").click(function(){CartItem.addProduct(data.product.productId,"true");return false;});}});}});function instorePopup(height,width,title,text,frame){var s=s_gi(scServerCode);s.linkTrackVars="events";s.linkTrackEvents="event10";s.events="event10";s.tl(this,"o","SelectStores");new PngInstorePopup(height,width,title,text,frame);}var YellowMessage={messages:["We require an e-mail address for all online orders.<br/><br/>If you do not have an e-mail address, please call 1-888-777-3949 to place your order.","New customer registration","We are required to charge tax in states for which we have a physical store location.","Your CVV number is located...","We require a phone number in case there are problems with your order or shipping.","Phone numbers are necessary if we have any questions regarding delivery.","You must be 13 years old or older to participate in the rewards program."],display:function(obj,message,pos){var curleft=curtop=0;if(obj.offsetParent){do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}while(obj=obj.offsetParent);}curleft=pos==="left"?curleft-110:curleft+20;curtop-=20;jQuery("body").append('<div id="yellowMessage">'+YellowMessage.messages[message]+"</div>").find("#yellowMessage").css({left:curleft+"px",top:curtop+"px"});},hide:function(){jQuery("#yellowMessage").remove();}};var ImageControls={loadImage:function(name,height,width){var loadingImage=height!=null&&width!=null?new Image(height,width):new Image();loadingImage.src=name;},loadColorImage:function(name){ImageControls.loadImage(ImageControls.convertToLarge(name),255,255);},convertToLarge:function(name){return name.replace("/sm","/lg").replace("/xl","/lg").replace(".gif",".jpg");},convertToExtraLarge:function(name){return name.replace("/sm","/xl").replace("/lg","/xl").replace(".gif",".jpg");},convertToSmall:function(name){return name.replace("/lg","/sm").replace("/xl","/sm").replace(".jpg",".gif");}};var Form={adjustDefaultText:function(obj,defaultText,newText){if(obj.value==defaultText){obj.value=newText;}},clearIfEqual:function(obj,value){if(obj.value==value){obj.value="";}},getRadioValue:function(formName,radioName){return jQuery('form[name="'+formName+'"]').find('input:radio[name="'+radioName+'"]').first().val();},isEqual:function(obj,value){if(obj.value==text||text.value==""){return false;}return true;}};(function($){$.extend($.ui.tabs.prototype,{rotation:null,rotationDelay:null,continuing:null,rotate:function(ms,continuing){var self=this,o=this.options;if((ms>1||self.rotationDelay===null)&&ms!==undefined){self.rotationDelay=ms;}if(continuing!==undefined){self.continuing=continuing;}var rotate=self._rotate||(self._rotate=function(e){clearTimeout(self.rotation);self.rotation=setTimeout(function(){var t=o.selected;self.select(++t<self.anchors.length?t:0);},ms);if(e){e.stopPropagation();}});var stop=self._unrotate||(self._unrotate=!continuing?function(e){if(e.clientX){self.rotate(null);}}:function(e){t=o.selected;rotate();});if(ms){this.element.bind("tabsshow",rotate);this.anchors.bind(o.event+".tabs",stop);rotate();}else{clearTimeout(self.rotation);this.element.unbind("tabsshow",rotate);this.anchors.unbind(o.event+".tabs",stop);delete this._rotate;delete this._unrotate;}if(ms===1){ms=self.rotationDelay;}return this;},pause:function(){var self=this,o=this.options;self.rotate(0);},unpause:function(){var self=this,o=this.options;self.rotate(1,self.continuing);}});})(jQuery);(function($){$.extend($.ui.tabs.prototype,{hover:function(hoverOn,hoverOff){var self=this,o=this.options;self.element.find("li a").hover(hoverOn,hoverOff);}});})(jQuery);Array.prototype.last=function(){return this[this.length-1];};Array.prototype.unique=function(){var a=[];var l=this.length;for(var i=0;i<l;i++){for(var j=i+1;j<l;j++){if(this[i]===this[j]){j=++i;}}a.push(this[i]);}return a;};window.FL=window.FL||{};FL.RegEx=FL.RegEx||{};FL.RegEx.demographic={email:/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/};FL.RegEx.payment={cc_types:/AMEX|DISCOVER|MASTERCARD|VISA/,cards:{AMEX:{number:/^3[47][0-9]{13}|[X]+[0-9]{4}$/,securityCode:/^[0-9]{4}$/},DISCOVER:{number:/^6(?:011|5[0-9]{2})[0-9]{12}|[X]+[0-9]{4}$/,securityCode:/^[0-9]{3}$/},MASTERCARD:{number:/^5[1-5][0-9]{14}|[X]+[0-9]{4}$/,securityCode:/^[0-9]{3}$/},VISA:{number:/^4[0-9]{15}|[X]+[0-9]{4}$/,securityCode:/^[0-9]{3}$/}}};window.FL=window.FL||{};FL.ToolTipControls=Class.extend({data:{},display:{left:0,top:0},messageBox:{id:"#flToolTip"},init:function(options){var tooltip=this;options=jQuery.extend({closeButton:false,csBox:false,eventFocus:false,eventMouseOver:true,iconType:"icon",iconWidth:22,message:"",pos:"left",selector:"",top:-25,width:100},options);tooltip.data=options;if(tooltip.data.selector!==""){tooltip.verifyData();if(tooltip.data.eventMouseOver===true||tooltip.data.eventFocus){tooltip.mouseOverRules();}}},create:function(){var tooltip=this,messageHTML=['<div id="flToolTip">',"<div>",tooltip.data.message,"</div>","</div>"].join(""),closeButton='<div id="flToolTipClose">X</div>';jQuery(tooltip.messageBox.id).remove();tooltip.display.top=tooltip.data.top;tooltip.display.left=tooltip.data.pos==="left"?"-"+(parseInt(tooltip.data.width,10)+parseInt(tooltip.data.iconWidth,10)):parseInt(tooltip.data.iconWidth,10);switch(tooltip.data.iconType){case"icon":case"formfield":jQuery(tooltip.data.selector).append(messageHTML).find(tooltip.messageBox.id).css({left:tooltip.display.left+"px",top:tooltip.display.top+"px",width:tooltip.data.width+"px"});break;default:break;}if(tooltip.data.closeButton){jQuery(tooltip.data.selector).find("#flToolTip").prepend(closeButton).find("#flToolTipClose").click(function(){jQuery("#flToolTip").remove();});}},destroy:function(){var tooltip=this;jQuery(tooltip.messageBox.id).remove();},mouseOverRules:function(){var tooltip=this;jQuery(tooltip.data.selector).mouseover(function(){tooltip.create();}).mouseout(function(){tooltip.destroy();});},verifyData:function(){var tooltip=this;tooltip.data.closeButton=tooltip.data.closeButton===true?true:false;tooltip.data.csBox=tooltip.data.csBox===true?true:false;tooltip.data.message=tooltip.data.message===""?FL.toolTipMessages.error.generic:tooltip.data.message;tooltip.data.pos=tooltip.data.pos==="right"?"right":"left";tooltip.data.top=isNaN(tooltip.data.top)?-25:tooltip.data.top;tooltip.data.width=isNaN(tooltip.data.width)?100:tooltip.data.width;}});FL.ToolTipCSControls=FL.ToolTipControls.extend({customerServiceBadge:['<div class="tt_footer">','<div class="icon"></div>','<div class="subhead">Customer Service</div>','<div class="text">1-888-777-3949</div>',"</div>"].join(""),create:function(){var tooltip=this;tooltip.data.width=tooltip.data.width<200?200:tooltip.data.width;tooltip._super();jQuery(tooltip.data.selector).find(tooltip.messageBox.id).append(tooltip.customerServiceBadge);}});FL.ToolTipOneTimeCSControls=FL.ToolTipCSControls.extend({destroy:function(){var tooltip=this;tooltip._super();jQuery(tooltip.data.selector).unbind("mouseover").unbind("mouseout");},mouseOverRules:function(){}});FL.ToolTipErrorControls=FL.ToolTipControls.extend({create:function(){var tooltip=this;tooltip._super();jQuery(tooltip.data.selector).find(tooltip.messageBox.id).addClass("tooltipError");}});FL.ToolTipMinorControls=FL.ToolTipControls.extend({create:function(){var tooltip=this;tooltip._super();jQuery(tooltip.data.selector).find(tooltip.messageBox.id).addClass("tooltipMinor");}});FL.toolTip=function(options){var popup;options=jQuery.extend({asError:false,csBox:false,minor:false},options);popup=options.asError?new FL.ToolTipErrorControls(options):options.minor?new FL.ToolTipMinorControls(options):options.csBox?new FL.ToolTipCSControls(options):new FL.ToolTipControls(options);};FL.toolTipMessages={checkout:{email:["We require an e-mail address for all online orders.<br/><br/>If you do not have an e-mail address, ","please call customer service to place your order."].join(""),login_email:["You will receive important information about your order at this email address: <ul><li>Order ","confirmation</li><li>Shipping confirmation</li><li>Tracking number for your order</li></ul>The ","Finish Line will never spam or sell your e-mail address."].join(""),new_customer:"New customer registration",tax:"We are required to charge tax in states for which we have a physical store location."},email:{invalid:"You have entered an invalid e-mail address."},error:{generic:"An error occurred when creating this tooltip.",demographic:{first_name:"First name is a required field"}}};window.FL=window.FL||{};FL.MainMenu={init:function(){jQuery("#menu").find("ul.subnav").parent().hover(function(){jQuery(this).find("ul.subnav").slideDown("fast").show();},function(){jQuery(this).find("ul.subnav").slideUp("fast").hide();});}};window.FL=window.FL||{};FL.recommendations=FL.recommendations||{};
FL.recommendations.data=FL.recommendations.data||{};FL.recommendations.data.defaultErrors=[{message:"No error",code:0}];FL.recommendations.requiredPostVarNames=["host","appid","top1","top2","links","customerid","cv1","pageid","transactionid"];FL.recommendations.optionalPostVarNames=["event","itemid","qty","price","total"];FL.recommendations.data.error=[];FL.recommendations.data.errors=[];FL.recommendations.postVars={};FL.recommendations.addPostVar=function(param){if(typeof param==="object"){jQuery.each(param,function(key,value){if(jQuery.inArray(key,FL.recommendations.requiredPostVarNames)!=0){FL.recommendations.postVars[key]=value;}else{if(jQuery.inArray(key,FL.recommendations.optionalPostVarNames)!=0){FL.recommendations.postVars[key]=value;}else{}}});}else{}};FL.recommendations.setUpPostVars=function(options){if(typeof options==="object"){jQuery.each(options,function(key,value){_newVarPair={};_newVarPair[key]=value;FL.recommendations.addPostVar(_newVarPair);});}for(var i=0;i<FL.recommendations.requiredPostVarNames.length;i++){if(FL.recommendations.postVars[FL.recommendations.requiredPostVarNames[i]]===undefined){_newVarPair={};_newVarPair[FL.recommendations.requiredPostVarNames[i]]="";FL.recommendations.addPostVar(_newVarPair);}}};FL.recommendations.error={};FL.recommendations.error.setError=function(errorMap){var _error,_msg,_code;_error=FL.recommendations.data.defaultErrors[0];if(!errorMap){_error=FL.recommendations.data.defaultErrors[0];}else{if(typeof _error==="object"){if(typeof _error.message!=="undefined"){_msg=_error.message;}if(typeof _error.code!=="undefined"){_code=_error.code;}_error={_msg:_code};}}FL.recommendations.data.error=(_error);FL.recommendations.data.errors.unshift(_error);};FL.recommendations.error.currentError=function(){if(FL.recommendations.data.errors.length==0){FL.recommendations.data.errors=FL.recommendations.data.defaultErrors;}var _error=FL.recommendations.data.errors.shift();return _error;};FL.recommendations.error.currentErrorMessage=function(){var _error=FL.recommendations.data.error.currentError;return _error.message;};FL.recommendations.error.currentErrorCode=function(){var _error=FL.recommendations.data.error.currentError;return _error.code;};FL.recommendations.sendCustomEvent=function(productIDs,eventName){if(!eventName){eventName="";}if(!productIDs||!eventName){if(!productIDs){}if(!eventName){}}else{resx=resx||new Object();resx.event=eventName;resx.itemid=productIDs;certonaResx.run();}};FL.recommendations.init=function(postvars){FL.recommendations.error.setError();FL.recommendations.data.error=FL.recommendations.error.currentError;FL.recommendations.setUpPostVars(postvars);};window.FL=window.FL||{};FL.OrderReview={};FL.OrderReview.popup=null;FL.orderReview=function(){jQuery("#buttonProcess").click(FL.OrderReview.process);};FL.OrderReview.process=function(){jQuery("#buttonProcess").hide();jQuery("#dialog_orderreview_process").dialog({dialogClass:"no-close",draggable:false,height:120,modal:true,resizable:false,width:220});};FL.OrderReview.displayTaxInfo=function(){var current_state=jQuery("#shippingState").val(),$tax_footnote=jQuery("#tax_footnote"),$sales_tax=jQuery("#sales_tax");$tax_footnote.removeClass("display_footnote");$sales_tax.find(".display_footnote").removeClass("display_footnote");if($sales_tax.find("#"+current_state+"_sales_tax").length>0){$tax_footnote.addClass("display_footnote");$sales_tax.find("#"+current_state+"_sales_tax").addClass("display_footnote");}};var globalPageType="";function updateInfo(url,parameters){jQuery.ajax({data:parameters,dataType:"xml",type:"POST",url:url,success:function(xml,textStatus,jqXHR){var errorCode,message,results,successful;results=jQuery(xml).find("updateorder")[0];successful=jQuery(xml).find("result").text();if(successful==="true"){switch(jQuery(xml).find("type").text()){case"shipping":updateDisplayShipping(results);break;case"billing":updateDisplayBilling(results);break;case"creditcard":updateDisplayPayment(results);break;case"email":updateDisplayEmail(results);break;default:break;}}else{errorCode=jQuery(xml).find("errorCode").text();message=jQuery(xml).find("message").text();jQuery("#demographicErrorMessage").html(message);if(globalPageType==="updateShippingAddress"){window.location="/store/checkout/ship.jsp";}else{if(globalPageType==="updateBillingAddress"){window.location="/store/checkout/bill.jsp";}}if(errorCode==="PriceOrderTotalError"){jQuery("#shippingZip").html(jQuery(xml).find("zip").text()).focus();}}}});}function updateParameters(whichForm){var parameters=[];jQuery("#demographicForm"+whichForm).find("input").each(function(){parameters.push(jQuery(this).attr("id")+"="+jQuery(this).val());});jQuery("#demographicForm"+whichForm).find("select").each(function(){parameters.push(jQuery(this).attr("id")+"="+jQuery(this).val());});return"&"+parameters.join("&");}function editBilling(){jQuery("#dialog_billing").empty();FL.OrderReview.popup=new FL.dialog("dialog_billing",{ajax:true,ajaxData:{type:"billing"},url:"/store/checkout/fragments/orderreview_forms.jsp"},{dialogClass:"dialog-review-edit",height:290,resizable:false,title:"Edit Billing Information",width:350});}function updateDisplayBilling(xml){var address2,billingData,creditCardData;billingData=jQuery("#displayBillingData").detach();creditCardData=jQuery("#displayCreditCardData").detach();address2=jQuery(xml).find("address2").text()===""?"":jQuery(xml).find("address2").text()+"<br/>";jQuery(billingData).find("#displayBillingFirstName").html(jQuery(xml).find("firstName").text()).end().find("#displayBillingLastName").html(jQuery(xml).find("lastName").text()).end().find("#displayBillingAddress").html(jQuery(xml).find("address").text()).end().find("#displayBillingAddress2").html(address2).end().find("#displayBillingCity").html(jQuery(xml).find("city").text()).end().find("#displayBillingState").html(jQuery(xml).find("state").text()).end().find("#displayBillingPostalCode").html(jQuery(xml).find("zip").text()).end().find("#displayBillingPhone").html(jQuery(xml).find("phone").text()).end();jQuery(creditCardData).find("#displayCreditCardFirstName").html(jQuery(xml).find("firstName").text()).end().find("#displayCreditCardLastName").html(jQuery(xml).find("lastName").text()).end();jQuery("#displayBillingDataHolder").html(billingData);jQuery("#displayCreditCardDataHolder").html(creditCardData);jQuery(FL.OrderReview.popup.selector).dialog("close");}function updateBillingInfo(){if(!checkUpdateBillingForm()){return false;}globalPageType="updateBillingAddress";updateInfo("/store/checkout/update_shipping_address.jsp","type=updateBillingAddress"+updateParameters("Billing"));}function editShipping(){FL.OrderReview.popup=new FL.dialog("dialog_shipping",{ajax:true,ajaxData:{type:"shipping"},url:"/store/checkout/fragments/orderreview_forms.jsp"},{dialogClass:"dialog-review-edit",height:290,resizable:false,title:"Edit Shipping Information",width:350});}function updateDisplayShipping(xml){var address2,shippingData;shippingData=jQuery("#displayShippingData").detach();address2=jQuery(xml).find("address2").text()===""?"":jQuery(xml).find("address2").text()+"<br/>";jQuery(shippingData).find("#displayShippingFirstName").html(jQuery(xml).find("firstName").text()).end().find("#displayShippingLastName").html(jQuery(xml).find("lastName").text()).end().find("#displayShippingAddress").html(jQuery(xml).find("address").text()).end().find("#displayShippingAddress2").html(address2).end().find("#displayShippingCity").html(jQuery(xml).find("city").text()).end().find("#displayShippingState").html(jQuery(xml).find("state").text()).end().find("#displayShippingZip").html(jQuery(xml).find("zip").text()).end().find("#displayShippingPhoneNumber").html(jQuery(xml).find("phone").text()).end();jQuery("#displayShippingDataHolder").html(shippingData);jQuery(FL.OrderReview.popup.selector).dialog("close").dialog("destroy");jQuery(FL.OrderReview.popup.selector).remove();}function updateShippingInfo(){if(!checkUpdateShippingForm()){return false;}globalPageType="updateShippingAddress";FL.OrderReview.displayTaxInfo();updateInfo("/store/checkout/update_shipping_address.jsp","type=updateShippingAddress"+updateParameters("Shipping"));}function editPayment(){FL.OrderReview.popup=new FL.dialog("dialog_creditcard",{ajax:true,ajaxData:{type:"creditcard"},url:"/store/checkout/fragments/orderreview_forms.jsp"},{height:290,title:"Edit Payment Information",width:350});}function updatePaymentInfo(){updateInfo("/store/checkout/update_credit_card.jsp","type=updateCreditCard"+updateParameters("CreditCard"));}function updateDisplayPayment(xml){var creditCardData;creditCardData=jQuery("#displayCreditCardData").detach();jQuery(creditCardData).find("#displayCreditCardFirstName").html(jQuery(xml).find("firstName").text()).end().find("#displayCreditCardLastName").html(jQuery(xml).find("lastName").text()).end().find("#displayCreditCardNumber").html(jQuery(xml).find("cardNumber").text()).end().find("#displayCreditCardType").html(jQuery(xml).find("cardType").text()).end();jQuery("#dialog_creditcard").dialog("close");}function updateEmail(){updateInfo("/store/checkout/update_email.jsp","email="+jQuery("#formChangeEmailAddress").val());}function updateDisplayEmail(xml){var email=jQuery(xml).find("email").text();jQuery("#viewChangeEmailAddress").html(email);jQuery("#formChangeEmailAddress").val(email);jQuery("#billingEmail").val(email);jQuery("#emailView").show();jQuery("#emailForm").hide();}function editEmail(){jQuery("#emailView").hide();jQuery("#emailForm").show();}function registrationPopupNoSignup(){var url="/store/checkout/fragments/checkout_enhancement_registration.jsp";var parameters="?popupType=nosignup";registrationPopup(url,parameters);}function registrationPopupSignup(){var url="/store/checkout/fragments/checkout_enhancement_registration.jsp";var parameters="?popupType=signup";registrationPopup(url,parameters);}function registrationPopup(pUrl,pParameters){var path=pUrl+pParameters;FL.OrderReview.popup=new FL.dialog("dialog_save_information",{iframe:true,url:path},{height:430,title:"Save Your Information",width:700});}function winnerCirclePopup(){FL.OrderReview.popup=new FL.dialog("dialog_winners_circle",{iframe:true,url:"/store/checkout/fragments/winnerscircle_registration.jsp"},{height:420,title:"Complete Your Winners Circle Registration",width:600});}function validateLoginAndCheckoutForm(){var requiredFields=["signinemail","signinpassword"];var requiredFieldNames=["signinemail","signinpassword"];var errorBox=["bottomError","bottomError"];if(!checkRequired(requiredFields,requiredFieldNames,errorBox)){return false;}if(!checkEmail("signinemail","bottomError")){return false;}return true;}function checkLoginForm(){var requiredFields=new Array("signinemail");var requiredFieldNames=new Array("E-mail Address");var errorBox=new Array("topError");if(!checkRequired(requiredFields,requiredFieldNames,errorBox)){return false;}if(!checkEmail("signinemail","topError")){return false;}if(!checkRadioButton("choice","bottomError")){return false;}return true;}function checkShippingForm(){var requiredFields,requiredFieldNames,errorBox;requiredFields=["shippingFirstName","shippingLastName","shippingAddress1","shippingCity","shippingState","shippingZip"];requiredFieldNames=["First Name","Last Name","Street Address","City","State","Zip"];errorBox=["topError","topError","topError","topError","topError","topError"];if(!checkRequired(requiredFields,requiredFieldNames,errorBox)){return false;}if(!checkName("shippingFirstName","topError")){return false;}if(!checkName("shippingLastName","topError")){return false;}if(!checkName("shippingAddress1","topError")){return false;}if(!checkZipCode("shippingZip","topError")){return false;}if(!checkPhoneNumber("shippingPhone","topError")){return false;}if(jQuery("#shipping_method_holder").find('input[name="shippingMethod"]:checked').length===0){jQuery("#bottomError").html("Please make a selection");displayError("shippingMethod","bottomError");return false;}return true;}function checkUpdateShippingForm(){var requiredFields,requiredFieldNames,errorBox,selectFields,selectDefaultValues,selectFieldNames,selectErrorBox;requiredFields=["shippingFirstName","shippingLastName","shippingAddress","shippingCity","shippingState","shippingZip"];requiredFieldNames=["First Name","Last Name","Street Address","City","State","Zip"];errorBox=["shipError","shipError","shipError","shipError","shipError","shipError"];selectFields=["shippingState"];selectDefaultValues=["-"];selectFieldNames=["State"];selectErrorBox=["shipError"];if(!checkRequired(requiredFields,requiredFieldNames,errorBox)){return false;}if(!checkDefaultValues(selectFields,selectDefaultValues,selectFieldNames,selectErrorBox)){return false;}if(!checkZipCode("shippingZip","shipError")){return false;}if(!checkPhoneNumber("shippingPhone","shipError")){return false;}if(jQuery("#shippingFirstName").val().length+jQuery("#shippingLastName").val().length>34){if(!jQuery("#dialog_name_length").length){popup=new FL.dialog("dialog_name_length",{content:"First name and last name cannot be longer than 34 characters combined.  Please adjust either the first name or last name field to decrease the character length to below 34 characters."},{close:function(event,ui){jQuery("#dialog_name_length").remove();},title:"Name Values Too Long"});}jQuery("#shipError").html("First and last name too long");displayError("shippingFirstName","shipError");return false;}return true;}function transferTempValues(transactionType){var successField=document.getElementsByName("moveToConfirmationSuccessURL")[0];var creditCardType=document.getElementsByName("creditCardType")[0];var expirationMonth=document.getElementsByName("expirationMonth")[0];var expirationYear=document.getElementsByName("expirationYear")[0];var creditCardNumber=document.getElementsByName("creditCardNumber")[0];var securityCode=document.getElementsByName("securityCode")[0];if(transactionType=="BML"){var currentDate=new Date();var thisYear=currentDate.getFullYear();var nextMonth=currentDate.getMonth()+2;thisYear=(nextMonth>12)?thisYear+1:thisYear;nextMonth=(nextMonth>12)?nextMonth-12:nextMonth;nextMonth=(nextMonth<10)?"0"+nextMonth:nextMonth;creditCardType.value="Visa";expirationMonth.value=nextMonth;expirationYear.value=thisYear;creditCardNumber.value="4111111111111111";securityCode.value="111";successField.value="/store/checkout/billmelater.jsp";}else{var creditCardTypeTemp=document.getElementsByName("creditCardTypeTemp")[0];var expirationMonthTemp=document.getElementsByName("expirationMonthTemp")[0];var expirationYearTemp=document.getElementsByName("expirationYearTemp")[0];var creditCardNumberTemp=document.getElementsByName("creditCardNumberTemp")[0];var securityCodeTemp=document.getElementsByName("securityCodeTemp")[0];creditCardType.value=creditCardTypeTemp.value;expirationMonth.value=expirationMonthTemp.value;expirationYear.value=expirationYearTemp.value;creditCardNumber.value=creditCardNumberTemp.value;securityCode.value=securityCodeTemp.value;successField.value="/store/checkout/orderreview.jsp";}}function transactionFlag(){var transactionType=document.getElementsByName("transactionType");var transactionFlag="";for(var i=0;i<transactionType.length;i++){if(transactionType[i].checked){transactionFlag=transactionType[i].value;}}if(transactionFlag==""){transactionFlag="CC";}return transactionFlag;}function checkBillingForm(){var requiredFields;var requiredFieldNames;var errorBox;var transactionType=transactionFlag();if(transactionType=="BML"){requiredFields=new Array("billingFirstName","billingLastName","billingAddress1","billingCity","billingState","billingZip","billingPhone");requiredFieldNames=new Array("First Name","Last Name","Street Address","City","State","Zip","Telephone");errorBox=new Array("topError","topError","topError","topError","topError","topError","topError");}else{requiredFields=new Array("billingFirstName","billingLastName","billingAddress1","billingCity","billingState","billingZip","billingPhone","billingCardType","billingCardNumber","billingExpirationMonth","billingExpirationYear","billingSecurityCode");
requiredFieldNames=new Array("First Name","Last Name","Street Address","City","State","Zip","Telephone","Card Type","Card Number","Expiration Month","Expiration Year","Security Code");errorBox=new Array("topError","topError","topError","topError","topError","topError","topError","bottomError","bottomError","bottomError","bottomError","bottomError");}if(!checkRequired(requiredFields,requiredFieldNames,errorBox)){return false;}if(!checkName("billingFirstName","topError")){return false;}if(!checkName("billingLastName","topError")){return false;}if(!checkName("billingAddress1","topError")){return false;}if(!checkZipCode("billingZip","topError")){return false;}if(!checkPhoneNumber("billingPhone","topError")){return false;}transferTempValues(transactionType);return true;}function checkUpdateBillingForm(){var requiredFields=new Array("billingFirstName","billingLastName","billingAddress","billingCity","billingState","billingZip","billingPhone");var requiredFieldNames=new Array("First Name","Last Name","Street Address","City","State","Zip","Telephone");var errorBox=new Array("billError","billError","billError","billError","billError","billError","billError");if(!checkRequired(requiredFields,requiredFieldNames,errorBox)){return false;}if(!checkZipCode("billingZip","billError")){return false;}if(!checkPhoneNumber("billingPhone","billError")){return false;}if(jQuery("#billingFirstName").val().length+jQuery("#billingLastName").val().length>34){if(!jQuery("#dialog_name_length").length){popup=new FL.dialog("dialog_name_length",{content:"First name and last name cannot be longer than 34 characters combined.  Please adjust either the first name or last name field to decrease the character length to below 34 characters."},{close:function(event,ui){jQuery("#dialog_name_length").remove();},title:"Name Values Too Long"});}jQuery("#billError").html("First and last name too long");displayError("billingFirstName","billError");return false;}return true;}function checkWinnersCircleForm(){var leftFields=new Array("wcEmail","wcPassword","wcPassword2");var leftFieldNames=new Array("Username","Password","Confirm");var leftErrorBox=new Array("wcLeftError","wcLeftError","wcLeftError");var birthDateFields=new Array("wcBirthMonth","wcBirthDay","wcBirthYear");var birthDateDefaultValues=new Array("-1","-1","-1");var birthDateFieldNames=new Array("Month","Day","Year");var birthDateErrorBox=new Array("wcBottomError","wcBottomError","wcBottomError");if(!checkRequired(leftFields,leftFieldNames,leftErrorBox)){return false;}if(!checkDefaultValues(birthDateFields,birthDateDefaultValues,birthDateFieldNames,birthDateErrorBox)){return false;}return true;}function checkName(id,errorBox){var i,name;name=jQuery("#"+id).val();var objRegExp=/[^0-9a-zA-Z-\.\s,@]/;for(i=0;i<name.length;i++){if(name.charAt(i).match(objRegExp)){jQuery("#"+errorBox).html('&nbsp;"&nbsp;&nbsp;'+name.charAt(i)+'&nbsp;&nbsp;"&nbsp;&nbsp;is an invalid character');displayError(id,errorBox);return false;}}return true;}function checkZipCode(id,errorBox){var zipcode,objRegExp;zipcode=jQuery("#"+id).val();objRegExp=/(^\d{5}$)|(^\d{5}-\d{4}$)/;if(!objRegExp.test(zipcode)){jQuery("#"+errorBox).html("Please enter a valid zip code");displayError(id,errorBox);return false;}return true;}function checkPhoneNumber(id,errorBox){var phoneNumber,objRegExp;phoneNumber=jQuery("#"+id).val();objRegExp=/(^\d{3}\-\s?\d{3}\-\d{4}$)/;if(!objRegExp.test(phoneNumber)){jQuery("#"+errorBox).html("Incorrect phone number format");displayError(id,errorBox);return false;}return true;}function checkEmail(elementId,errorBox){var email=jQuery("#"+elementId).val();var emailRegex=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!emailRegex.test(email)){jQuery("#"+errorBox).html("Incorrect e-mail format");displayError(elementId,errorBox);return false;}return true;}function checkRequired(fields,fieldNames,errorBox,optionalErrorBoxList){var i;if(optionalErrorBoxList!=null){for(i=0;i<optionalErrorBoxList.length;i++){jQuery("#"+optionalErrorBoxList[i]).hide();}}else{for(i=0;i<errorBox.length;i++){jQuery("#"+errorBox[i]).hide();}}for(i=0;i<fields.length;i++){if(jQuery("#"+fields[i]).val()===""){jQuery("#"+errorBox[i]).html(fieldNames[i]+" is a required field.");displayError(fields[i],errorBox[i]);return false;}}return true;}function checkDefaultValues(fields,defaultValues,fieldNames,errorBox,optionalErrorBoxList){var i;if(optionalErrorBoxList!=null){for(i=0;i<optionalErrorBoxList.length;i++){jQuery("#"+optionalErrorBoxList[i]).hide();}}else{for(i=0;i<errorBox.length;i++){jQuery("#"+errorBox[i]).hide();}}for(i=0;i<fields.length;i++){if(jQuery("#"+fields[i]).val()===defaultValues[i]){jQuery("#"+errorBox).html(fieldNames[i]+" is a required field.");displayError(fields[i],errorBox[i]);return false;}}return true;}function checkRadioButton(id,errorBox){var selectedOne=false;if(jQuery("#"+id+":checked").length){selectedOne=true;}if(!selectedOne){jQuery("#"+errorBox).html("Please make a selection");displayError(id,errorBox);return false;}jQuery("#"+errorBox).hide();return true;}function displayError(id,errorBox){var extraOffset,left,top;switch(id){case"billingExpirationMonth":extraOffset=80;break;case"choice":case"shippingMethod":extraOffset=200;break;case"shippingPhone":case"billingPhone":extraOffset=20;break;case"billingSecurityCode":extraOffset=160;break;case"wcBirthMonth":extraOffset=131;break;case"wcBirthDate":extraOffset=72;break;default:extraOffset=10;break;}left=jQuery("#"+id).position().left+jQuery("#"+id).width()+extraOffset;top=jQuery("#"+id).position().top;jQuery("#"+errorBox).css({left:left,top:top}).show().click(removeErrorBox);jQuery("#"+id).focus();}function removeErrorBox(e){jQuery(this).hide();}function updateWinnersCircleInfo(){var title="Add Winner's Circle Number";var wcNum=jQuery("#wcCustomerId").val();if(wcNum!=null&&wcNum.length==8){var url="/store/checkout/update_winnerscircle.jsp";var data={"winnersCircleNumber":wcNum};jQuery.get(url,data,function(data){var returnCode=data.return_code;if(returnCode>-1){jQuery("#wcNumber").html(wcNum);jQuery("#wcFormItem").hide();jQuery("#wcTextItem").show();}else{var description="";var errorStack=data.error_stack;for(i=0;i<errorStack.length;i++){var errorCode=errorStack[i].error_code;switch(errorCode){case"-1000":description+="Unable to assign the Winner's Circle Number. Please retry.";break;default:description+="An error has occurred. Please retry.";break;}}FL.OrderReview.popup=new FL.dialog("fl_winners_circle_error",{content:description},{height:150,title:title,width:300});}},"json");}else{var description="Winner's Circle number must be eight digits in length. Please retry.";FL.OrderReview.popup=new FL.dialog("fl_winners_circle_error",{content:description},{height:150,title:title,width:300});}}function displayWinnersCircleForm(){jQuery("#wcTextItem").hide();jQuery("#wcFormItem").show();}function couponClick(){var s=s_gi(scServerCode);s.linkTrackVars="events";s.linkTrackEvents="event11";s.events="event11";s.tl(this,"o","ApplyCoupon");}function priceMaskPopUp(productId,source){jQuery.post("/store/results/fragments/productLookupJSON.jsp",{"productId":productId,"source":source},function(data){jsonPopUp(data);},"json");}function jsonPopUp(data){removePriceMaskPopUp();var oldPrice=data.product.prices.original;var newPrice=data.product.prices.sale;var priceDisplay="";var productAvailable=true;if(oldPrice!="no-sale"){if(newPrice!="no-sale"){priceDisplay+='<span style="text-decoration: line-through; font-size: 180%; color: #AAA;">'+oldPrice+'</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: 200%;">'+newPrice+"</span>";}else{productAvailable=false;}}else{if(newPrice!="no-sale"){priceDisplay+=newPrice;}else{productAvailable=false;}}var prodName=data.product.name;var prodStyle=data.product.style;var prodColor=data.product.color;if(prodStyle=="undefined"||prodStyle==null){prodStyle="";}if(prodColor=="undefined"||prodColor==null){prodColor="";}var addToCartOnClick="";if(data.source=="quickLooks"||data.source=="quicklooks"){addToCartOnClick="addItemToCart();";}else{addToCartOnClick="addProductToDynamicCart();";}var popUp='<div id="priceMaskPopUp">';popUp+='<div id="priceMaskPopUpHeader"><div id="priceMaskPopUpTitle">Shopping Cart</div><img style="margin: 5px 10px; float: right;" onclick="removePriceMaskPopUp(); closeQuickLookPopup();" src="/store/images/enhancements/b_close.gif" /></div>';popUp+='<div id="qlContent" class="qlContent"><div id="priceMaskPopUpContent" style="margin: 20px;"><p>&nbsp;</p><p>&nbsp;</p>';if(productAvailable){popUp+='<p style="text-align: center; font-weight: bold;">When we choose to sell items for less, certain vendors require us to display the sale price only in the cart.</p>';popUp+='<img style="margin: 15px; width: 100px; height: 100px; float: left;" src="http://www.finishline.com/store'+data.product.image+'" alt="Image of the shoe" />';popUp+='<p style="font-size: 120%; font-weight: bold;">'+prodName+"</p>";popUp+=priceDisplay;popUp+='<p style="clear:both; text-align: center;"><input type="image" onclick="removePriceMaskPopUp(); closeQuickLookPopup();" value="Remove From Cart" src="/store/images/enhancements/removeFromCart.png"/>';popUp+='<input type="image" onclick="'+addToCartOnClick+' showAddingToCart();" value="Keep in Cart" src="/store/images/enhancements/keepInCart.png" alt="Keep In Cart" /></p>';}else{popUp+='<p style="clear:both; text-align: center;">We are sorry, but this product is currently unavailable';popUp+='<br /><input type="image" onclick="removePriceMaskPopUp();" value="Remove From Cart" src="/store/images/enhancements/removeFromCart.png"/></p>';}popUp+='</div></div><div id="transparentBackground"></div></div>';var top="300px";var left="300px";if(data.source=="quickLooks"||data.source=="quicklooks"){top=jQuery("#quicklook").css("top");left=jQuery("#quicklook").css("left");}else{}jQuery("body").append(popUp);jQuery("#priceMaskPopUp").show();jQuery("#priceMaskPopUp").css({"position":"absolute","top":top,"left":left,"width":"470px","z-index":"5000"});}function showAddingToCart(){window.location.href="/store/checkout/cart.jsp";}function removePriceMaskPopUp(){if(jQuery("#priceMaskPopUp")){jQuery("#priceMaskPopUp").remove();}}window.FL=window.FL||{};FL.DynamicCart={products:null,oldProducts:null,dcSubtotal:null,productMsgText:null,resetTimer:null,dcClosenessQualifier:null,dcProductsNum:0,dcItemsPlural:"items",dcProductDisplayCount:3,displayDC:false,productMsg:false,addedNewProduct:false,toggleEffectNumber:0,pageLoadInfo:null,toggleEffects:["blind"],init:function(){if(jQuery("body.checkout").length){return;}FL.DynamicCart.loadDynamicCartInfoJSON(FL.DynamicCart.pageLoadInfo);FL.DynamicCart.updateDynamicCartHeader();FL.DynamicCart.loadDynamicCartProductsJSON();jQuery("#dynamicCart").hover(function(){FL.DynamicCart.setDisplayDC(true);FL.DynamicCart.showDynamicCart();},function(){FL.DynamicCart.setDisplayDC(false);FL.DynamicCart.hideDynamicCart();});jQuery(".viewCartButton").live("click",function(){window.location="/store/checkout/cart.jsp";});},displayNewProduct:function(dynamicCart,newProductId,newProductSkuId){FL.DynamicCart.oldProducts=FL.DynamicCart.products;FL.DynamicCart.loadDynamicCartInfoJSON(dynamicCart);FL.DynamicCart.productMsg=true;if(FL.DynamicCart.checkForNewProductJSON(newProductId,newProductSkuId)){FL.DynamicCart.productMsgText="Just Added to Cart!";}else{FL.DynamicCart.productMsgText="Quantity has been updated!";}FL.DynamicCart.updateDynamicCartHeader();FL.DynamicCart.loadDynamicCartProductsJSON();FL.DynamicCart.showDynamicCart();FL.DynamicCart.resetNewProduct();},siteCatalystAddToCart:function(productId,quantity){var s=s_gi(scServerCode);s.linkTrackVars="events,products";s.linkTrackEvents="scAdd";s.events="scAdd";s.products=";"+productId+";"+quantity;s.tl(this,"o","Shopping Cart: Checkout");},checkForNewProduct:function(pProductId,pSkuId){if(FL.DynamicCart.oldProducts.size()!=FL.DynamicCart.products.size()){return true;}for(i=0,ii=FL.DynamicCart.products.size();i<ii;i++){var product=FL.DynamicCart.products[i];if(jQuery(product).find("skuId").text()==pSkuId){FL.DynamicCart.products.splice(i,1);FL.DynamicCart.products.unshift(product);return false;}}return false;},checkForNewProductJSON:function(pProductId,pSkuId){var justAdded=false;if(FL.DynamicCart.oldProducts.size!=FL.DynamicCart.products.size){justAdded=true;}for(i=0,ii=FL.DynamicCart.products.length;i<ii;i++){var product=FL.DynamicCart.products[i];if(product.skuId==pSkuId){FL.DynamicCart.products.splice(i,1);FL.DynamicCart.products.unshift(product);}}return justAdded;},loadDynamicCartInfo:function(pDynamicCartXML){FL.DynamicCart.products=jQuery.makeArray(jQuery(pDynamicCartXML).find("product")).reverse();FL.DynamicCart.dcProductsNum=jQuery(pDynamicCartXML).find("totalQuantity").text();FL.DynamicCart.dcSubtotal=jQuery(pDynamicCartXML).find("subtotal").text();FL.DynamicCart.dcItemsPlural=FL.DynamicCart.dcProductsNum==1?"item":"items";FL.DynamicCart.dcClosenessQualifier=jQuery(pDynamicCartXML).find("closenessQualifier").text();},loadDynamicCartInfoJSON:function(dynamicCart){FL.DynamicCart.products=dynamicCart.products;FL.DynamicCart.dcProductsNum=dynamicCart.totals.totalQuantity;FL.DynamicCart.dcSubtotal=dynamicCart.totals.subtotal;FL.DynamicCart.dcItemsPlural=dynamicCart.products.length==1?"item":"items";FL.DynamicCart.dcClosenessQualifier=dynamicCart.closenessQualifier;},loadDynamicCartProducts:function(){var dynamicCartContentsHTML,productData,productMessage,cartMessage;if(FL.DynamicCart.products.length>0){productData=FL.DynamicCart.convertProductXMLtoJSON();productMessage={display:FL.DynamicCart.productMsg,text:FL.DynamicCart.productMsgText};cartMessage={number:FL.DynamicCart.dcProductNum,plural:FL.DynamicCart.dcItemsPlural};jQuery.tmpl(jQuery("#dynamicCart_tmpl"),{cart:cartMessage,data:productData,message:productMessage,ClosenessQualifier:FL.DynamicCart.dcClosenessQualifier,Subtotal:FL.DynamicCart.dcSubtotal}).appendTo(jQuery("#dynamicCartContentsWrapper").empty());if(FL.DynamicCart.productMsg){FL.DynamicCart.setNewProductAsDisplayed();}if(FL.DynamicCart.addedNewProduct){jQuery("#product0").hide();jQuery("#product0").show("fast");FL.DynamicCart.addedNewProduct=false;}}},loadDynamicCartProductsJSON:function(){var dynamicCartContentsHTML,productData,productMessage,cartMessage;if(FL.DynamicCart.products!="undefined"&&FL.DynamicCart.products.length>0){productData={"products":FL.DynamicCart.products};productMessage={display:FL.DynamicCart.productMsg,text:FL.DynamicCart.productMsgText};cartMessage={number:FL.DynamicCart.dcProductNum,plural:FL.DynamicCart.dcItemsPlural};jQuery.tmpl(jQuery("#dynamicCart_tmpl"),{cart:cartMessage,data:productData,message:productMessage,ClosenessQualifier:FL.DynamicCart.dcClosenessQualifier,Subtotal:FL.DynamicCart.dcSubtotal}).appendTo(jQuery("#dynamicCartContentsWrapper").empty());if(FL.DynamicCart.productMsg){FL.DynamicCart.setNewProductAsDisplayed();}if(FL.DynamicCart.addedNewProduct){jQuery("#product0").hide();jQuery("#product0").show("fast");FL.DynamicCart.addedNewProduct=false;}}},convertProductXMLtoJSON:function(){var productsJSON={"products":[]};jQuery.each(FL.DynamicCart.products,function(index,product){productsJSON.products[index]={};productsJSON.products[index].listPrice=jQuery(product).find("listPrice").text();productsJSON.products[index].originalPrice=jQuery(product).find("originalPrice").text();productsJSON.products[index].thumbnail=jQuery(product).find("thumbnail").text();productsJSON.products[index].name=jQuery(product).find("name").text();productsJSON.products[index].color=jQuery(product).find("color").text();productsJSON.products[index].size=jQuery(product).find("size").text();productsJSON.products[index].quantity=jQuery(product).find("quantity").text();productsJSON.products[index].freeShipText=jQuery(product).find("freeShipText").text();productsJSON.products[index].isFreeShipping=jQuery(product).find("isFreeShipping").text();
});return productsJSON;},setNewProductAsDisplayed:function(){FL.DynamicCart.productMsg=false;FL.DynamicCart.addedNewProduct=true;},resetNewProduct:function(){if(FL.DyanmicCart&&FL.DynamicCart!=="undefined"){if(FL.DyanmicCart.resetTimer&&FL.DynamicCart.resetTimer!=="undefined"){clearTimeout(FL.DynamicCart.resetTimer);}}FL.DynamicCart.resetTimer=window.setTimeout(FL.DynamicCart.hideDynamicCart,7000);},hideDynamicCart:function(){if(!FL.DynamicCart.getDisplayDC()){jQuery("#dynamicCartContentsWrapper").hide();}},getToggleEffectNumber:function(){var currNum,nextNum;currNum=FL.DynamicCart.toggleEffectNumber;if(currNum+1>=FL.DynamicCart.toggleEffects.length){FL.DynamicCart.toggleEffectNumber=0;}else{FL.DynamicCart.toggleEffectNumber=currNum+1;}return currNum;},showDynamicCart:function(){jQuery("#dynamicCartContentsWrapper").show();},updateDynamicCartHeader:function(){jQuery("#dynamicCartCheckoutText").html(FL.DynamicCart.dcProductsNum+" "+FL.DynamicCart.dcItemsPlural+' in <a href="/store/checkout/cart.jsp">your cart</a>');jQuery("#dynamicCartCheckoutTotal").html(FL.DynamicCart.dcSubtotal);},setDisplayDC:function(pDisplayValue){FL.DynamicCart.displayDC=pDisplayValue;},getDisplayDC:function(){return FL.DynamicCart.displayDC;}};window.FL=window.FL||{};FL.SignUpForDeals={dType:"Promotional",elem:null,suffix:(location.protocol==="https:")?"_secure":"",fauxPhBlur:function(el){if(el.value==""){el.value=el.placeholder||jQuery(el).attr("placeholder");}},fauxPhFocus:function(el){if(el.value==el.placeholder||el.value==jQuery(el).attr("placeholder")){el.value="";}},fbPopup:function(msg){var THIS=this;THIS.popup=new FL.dialog("dialog_"+THIS.dType.toLowerCase()+"_signup",{content:msg},{height:150,title:THIS.dType+" Signup",width:350});},init:function(){var THIS=this;if(document.getElementById("signUpForEmailsButton")&&document.getElementById("signUpForTextsButton")){jQuery("#demographicForm button").click(function(){THIS.dType=(/email/i.test(this.id))?"Email":"Mobile";THIS.elem=(THIS.dType=="Email")?document.getElementById("emailSignupEmail"):document.getElementById("emailSignupMobile");THIS.signup();});jQuery("[id^=emailSignup]").focus(function(){THIS.fauxPhFocus(this);}).blur(function(){THIS.fauxPhBlur(this);});FL.PhoneMask.init("#emailSignupMobile");}},signup:function(){var THIS=this,dType=THIS.dType.toLowerCase(),aData={onRegisterPage:Boolean(document.getElementById("register"))},aUrl="/store/global/fragments/"+dType+"_signup"+THIS.suffix+".jsp";aData[dType]=THIS.elem.value;if(dType=="mobile"&&!/^\d{3}-\d{3}-\d{4}$/.test(THIS.elem.value)){THIS.fbPopup("Mobile numbers must be of the format:<br/> ###-###-#### <em>(e.g. 555-123-4567)</em>.");return;}jQuery.ajax({data:aData,dataType:"xml",type:"POST",url:aUrl,success:function(xml,textStatus,jqXHR){var $xml=jQuery(xml),$res=$xml.find("result"),resTxt=$res.text(),isError=$xml.find("isError").text(),resHtml="";if(isError==="true"){jQuery(THIS.elem).css("background-color","#FF8888");if(!resTxt.length){resTxt="<p>Sorry, an error occurred while processing your request. Please try again.</p>";}THIS.fbPopup(resTxt);}else{if(aData.onRegisterPage){$res.find("*").each(function(ndx){resHtml+=(!ndx)?'<h2 class="main_title">'+jQuery(this).text()+"</h2>":"<p>"+jQuery(this).text()+"</p>";});jQuery("#wcSignupHeadingWrap").html(resHtml);jQuery(THIS.elem).css("background-color","#88FF88");if(aData.email){document.getElementById("email").value=aData.email;}else{document.getElementById("cellPhone").value=aData.mobile;}window.scrollTo(0,170);}else{window.location="/store/my_account/register.jsp";}}}});}};jQuery(document).ready(function(){FL.common();jQuery.each(document.body.className.split(/\s+/),function(i,classnm){if(classnm!==document.body.id){if(typeof FL[classnm]==="function"){FL[classnm]();}else{if(typeof FL[classnm]==="object"&&typeof FL[classnm].init==="function"){FL[classnm].init();}}if(typeof FL[classnm]==="object"&&typeof FL[classnm][document.body.id]==="object"&&typeof FL[classnm][document.body.id].init==="function"){FL[classnm][document.body.id].init();}}});if(typeof FL[document.body.id]==="function"){FL[document.body.id]();}else{if(typeof FL[document.body.id]==="object"&&typeof FL[document.body.id].init==="function"){FL[document.body.id].init();}}FL.init();});window.FL=window.FL||{};FL.common=function(){typeof pixels==="object"&&typeof pixels.init==="function"&&pixels.init();typeof pixels==="object"&&typeof pixels.confirm==="object"&&typeof pixels.confirm.init==="function"&&pixels.confirm.init();FL.MainMenu.init();FL.SignUpForDeals.init();};FL.init=function(){FL.DynamicCart.init();FL.utils.growsVertically();if(typeof largeImagePopup==="function"){jQuery("body").delegate("#productDetailsViewLargeImage","click",largeImagePopup);}if(typeof maskClicked==="function"){jQuery("body").delegate("#popupMask","click",maskClicked);}if(typeof findYourShoe==="function"){jQuery("#fysGoButton").bind("click",findYourShoe);}};FL.utils={growsVertically:function(){jQuery(".grows-vertically").each(function(index){var $elem,$myParent,diffpbeb,newh;$elem=jQuery(this);$myParent=$elem.closest(".equalize");if($myParent.length>0){diffpbeb=($myParent.height()+$myParent.position().top)-($elem.position().top+$elem.height());newh=diffpbeb+$elem.height()+1;$elem.height(newh);}});}};window.FL=window.FL||{};FL.home={init:function(){jQuery("#searchBarSearchBox").focus();jQuery.extend(jQuery.ui.tabs.prototype,{_tabify:function(init){var self=this,o=this.options,fragmentId=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=jQuery(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return jQuery("a",this)[0];});this.panels=jQuery([]);this.anchors.each(function(i,a){var href=jQuery(a).attr("href");var hrefBase=href.split("#")[0],baseEl;if(hrefBase&&(hrefBase===location.toString().split("#")[0]||(baseEl=jQuery("base")[0])&&hrefBase===baseEl.href)){href=a.hash;a.href=href;}if(fragmentId.test(href)){self.panels=self.panels.add(self._sanitizeSelector(href));}else{if(href!=="#"){jQuery.data(a,"href.tabs",href);jQuery.data(a,"load.tabs",href.replace(/#.*$/,""));var id=self._tabId(a);a.href="#"+id;var jQuerypanel=jQuery("#"+id);if(!jQuerypanel.length){jQuerypanel=jQuery(o.panelTemplate).attr("id",id).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(self.panels[i-1]||self.list);jQuerypanel.data("destroy.tabs",true);}self.panels=self.panels.add(jQuerypanel);}else{o.disabled.push(i);}}});if(init){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(o.selected===undefined){if(location.hash){this.anchors.each(function(i,a){if(a.hash==location.hash){o.selected=i;return false;}});}if(typeof o.selected!=="number"&&o.cookie){o.selected=parseInt(self._cookie(),10);}if(typeof o.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length){o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));}o.selected=o.selected||(this.lis.length?0:-1);}else{if(o.selected===null){o.selected=-1;}}o.selected=((o.selected>=0&&this.anchors[o.selected])||o.selected<0)?o.selected:0;o.disabled=jQuery.unique(o.disabled.concat(jQuery.map(this.lis.filter(".ui-state-disabled"),function(n,i){return self.lis.index(n);}))).sort();if(jQuery.inArray(o.selected,o.disabled)!=-1){o.disabled.splice(jQuery.inArray(o.selected,o.disabled),1);}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(o.selected>=0&&this.anchors.length){this.panels.eq(o.selected).removeClass("ui-tabs-hide");this.lis.eq(o.selected).addClass("ui-tabs-selected ui-state-active");self.element.queue("tabs",function(){self._trigger("show",null,self._ui(self.anchors[o.selected],self.panels[o.selected]));});this.load(o.selected);}jQuery(window).bind("unload",function(){self.lis.add(self.anchors).unbind(".tabs");self.lis=self.anchors=self.panels=null;});}else{o.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));}this.element[o.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(o.cookie){this._cookie(o.selected,o.cookie);}for(var i=0,li;(li=this.lis[i]);i++){jQuery(li)[jQuery.inArray(i,o.disabled)!=-1&&!jQuery(li).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");}if(o.cache===false){this.anchors.removeData("cache.tabs");}this.lis.add(this.anchors).unbind(".tabs");if(o.event!=="mouseover"){var addState=function(state,el){if(el.is(":not(.ui-state-disabled)")){el.addClass("ui-state-"+state);}};var removeState=function(state,el){el.removeClass("ui-state-"+state);};this.lis.bind("mouseover.tabs",function(){addState("hover",jQuery(this));});this.lis.bind("mouseout.tabs",function(){removeState("hover",jQuery(this));});this.anchors.bind("focus.tabs",function(){addState("focus",jQuery(this).closest("li"));});this.anchors.bind("blur.tabs",function(){removeState("focus",jQuery(this).closest("li"));});}var hideFx,showFx;if(o.fx){if(jQuery.isArray(o.fx)){hideFx=o.fx[0];showFx=o.fx[1];}else{hideFx=showFx=o.fx;}}function resetStyle($el,fx){$el.css("display","");if(!jQuery.support.opacity&&fx.opacity){$el[0].style.removeAttribute("filter");}}var showTab=showFx?function(clicked,$show){jQuery(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.hide().removeClass("ui-tabs-hide").animate(showFx,showFx.duration||"normal",function(){resetStyle($show,showFx);self._trigger("show",null,self._ui(clicked,$show[0]));});}:function(clicked,$show){jQuery(clicked).closest("li").addClass("ui-tabs-selected ui-state-active");$show.removeClass("ui-tabs-hide");self._trigger("show",null,self._ui(clicked,$show[0]));};var hideTab=hideFx?function(clicked,$hide){$hide.animate(hideFx,hideFx.duration||"normal",function(){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");resetStyle($hide,hideFx);self.element.dequeue("tabs");});}:function(clicked,$hide,$show){self.lis.removeClass("ui-tabs-selected ui-state-active");$hide.addClass("ui-tabs-hide");self.element.dequeue("tabs");};this.anchors.bind(o.event+".tabs",function(){var el=this,$li=jQuery(el).closest("li"),$hide=self.panels.filter(":not(.ui-tabs-hide)"),$show=jQuery(self._sanitizeSelector(el.hash));if(($li.hasClass("ui-tabs-selected")&&!o.collapsible)||$li.hasClass("ui-state-disabled")||$li.hasClass("ui-state-processing")||self.panels.filter(":animated").length||self._trigger("select",null,self._ui(this,$show[0]))===false){this.blur();return false;}o.selected=self.anchors.index(this);self.abort();if(o.collapsible){if($li.hasClass("ui-tabs-selected")){o.selected=-1;if(o.cookie){self._cookie(o.selected,o.cookie);}self.element.queue("tabs",function(){hideTab(el,$hide);}).dequeue("tabs");this.blur();return false;}else{if(!$hide.length){if(o.cookie){self._cookie(o.selected,o.cookie);}self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));this.blur();return false;}}}if(o.cookie){self._cookie(o.selected,o.cookie);}if($show.length){if($hide.length){self.element.queue("tabs",function(){hideTab(el,$hide);});}self.element.queue("tabs",function(){showTab(el,$show);});self.load(self.anchors.index(this));}else{throw"jQuery UI Tabs: Mismatching fragment identifier.";}if(jQuery.browser.msie){this.blur();}});this.anchors.bind("click.tabs",function(){return false;});}});jQuery("#rotator").tabs({fx:{opacity:"toggle"},select:function(event,ui){},show:function(event,ui){var $img;$img=jQuery(this).find("li.ui-tabs-nav-item img.hoverIndicator");$img.attr("src",FL.home.rotator.rotatorButtonOffImg);$img=jQuery(this).find("li.ui-tabs-nav-item.ui-tabs-selected img.hoverIndicator");$img.data("nonHoveredImage",$img.attr("src"));$img.attr("src",FL.home.rotator.rotatorButtonOnImg);},enable:function(event,ui){}}).tabs("rotate",4000,true);jQuery("#rotator .ui-tabs-pause-button").bind("click",function(){var $img;$img=jQuery(this).find(".pauseButton");if($img.hasClass("paused")){jQuery("#rotator").tabs("unpause");FL.home.rotator.togglePauseButtonImg("unpaused");$img.removeClass("paused");}else{jQuery("#rotator").tabs("pause");FL.home.rotator.togglePauseButtonImg("paused");$img.addClass("paused");}});},rotator:{pauseButtonOnImg:"/media/images/buttons/pause_button_on.png",pauseButtonOffImg:"/media/images/buttons/pause_button_off.png",rotatorButtonOnImg:"/media/images/buttons/rotator_button_on.png",rotatorButtonOffImg:"/media/images/buttons/rotator_button_off.png",togglePauseButtonImg:function(toThis){var $pauseButton;$pauseButton=jQuery("#rotator .pauseButton");if(toThis=="paused"||toThis===true){$pauseButton.attr("src",this.pauseButtonOnImg);}else{$pauseButton.attr("src",this.pauseButtonOffImg);}}}};window.FL=window.FL||{};FL.rolloverLP={targets:{},init:function(){jQuery(".rollTargetMessage").each(function(i,elem){$(this).attr("id","rollTarget-"+i+"-Message");});jQuery(".rollTarget").each(function(i,elm){$(this).attr("id","rollTarget-"+i);FL.rolloverLP.targets[elm.id]={target:elm,$message:jQuery("#"+elm.id+"-Message")};}).bind({"mousemove":function(e){currentTarget=FL.rolloverLP.targets[e.currentTarget.id];width=currentTarget.$message.width();height=currentTarget.$message.height();newLeft=(e.pageX-width-3);newTop=(e.pageY-height-3);currentTarget.$message.css({"left":newLeft+"px","top":newTop+"px","position":"fixed"}).stop(true,true).fadeIn();},"mouseleave":function(e){FL.rolloverLP.targets[e.currentTarget.id].$message.stop(true,true).fadeOut();}});}};var file="/store/catalog/fragments/store_availability.jsp";var request;var page="";var storeIds="";var skuId="";var quantity="";var productId="";var xmlDOM;window.FL=window.FL||{};FL.DialogDefaults={options:{ajax:false,ajaxData:{},async:true,content:null,iframe:false,style:"",trigger:"",url:""},dialog:{modal:true,zIndex:9999}};FL.dialog=Class.extend({id:"",selector:"",dialog:{},options:{},init:function(dialog_id,options,dialog){this.preInit();this.setDialogId(dialog_id);this.setDialogOptions(dialog);this.setOptions(options);this.checkDialogExists();this.applyOptions();jQuery(this.selector).dialog(this.dialog);pixels.init(this.options.trigger);this.postInit();},applyOptions:function(){this.preApplyOptions();if(this.options.content!==null){this.setContent();}if(this.options.iframe){this.createIframe();}if(this.options.ajax){this.createAjaxCall();}this.postApplyOptions();},checkDialogExists:function(){this.preCheckDialogExists();if(jQuery(this.selector).length===0){jQuery.tmpl(jQuery("#dialog_tmpl"),{id:this.id}).appendTo(jQuery("body"));}this.postCheckDialogExists();},createAjaxCall:function(){var popup=this;this.preCreateAjaxCall();jQuery.ajax({async:this.options.async,data:this.options.ajaxData,dataType:"html",type:"GET",url:this.options.url,success:function(data,textStatus,jqXHR){popup.preAjaxSuccess();jQuery(popup.selector).html(data);popup.postAjaxSuccess();}});this.postCreateAjaxCall();},createIframe:function(){this.preCreateIframe();jQuery.tmpl(jQuery("#dialog_iframe_tmpl"),{page:this.options.url}).appendTo(jQuery(this.selector).empty());jQuery(this.selector).addClass("iframe");this.postCreateIframe();},setContent:function(){this.preSetContent();jQuery(this.selector).html(this.options.content);this.postSetContent();},setDialogId:function(dialog_id){this.preSetDialogId();this.id=dialog_id;this.selector="#"+dialog_id;this.postSetDialogId();},setDialogOptions:function(dialog){this.preSetDialogOptions();this.dialog=jQuery.extend({},FL.DialogDefaults.dialog,dialog);this.postSetDialogOptions();},setOptions:function(options){this.preSetOptions();this.options=jQuery.extend({},FL.DialogDefaults.options,options);this.postSetOptions();},preInit:function(){},postInit:function(){},preAjaxSuccess:function(){},postAjaxSuccess:function(){},preApplyOptions:function(){},postApplyOptions:function(){},preCheckDialogExists:function(){},postCheckDialogExists:function(){},preCreateAjaxCall:function(){},postCreateAjaxCall:function(){},preCreateIframe:function(){},postCreateIframe:function(){},preSetContent:function(){},postSetContent:function(){},preSetDialogId:function(){},postSetDialogId:function(){},preSetDialogOptions:function(){},postSetDialogOptions:function(){},preSetOptions:function(){},postSetOptions:function(){}});
window.FL=window.FL||{};FL.DialogControls={defaults:{height:200,id:"fl_dialogcontrols",style:"",title:"",width:200},init:function(){var data=jQuery(this).data("dialog"),url=data.url||jQuery(this).attr("href")||"",popup=null,id=data.id||FL.DialogControls.defaults.id,options={style:data.style||FL.DialogControls.defaults.style},dialog={dialogClass:data.style||FL.DialogControls.defaults.style,height:data.height||FL.DialogControls.defaults.height,title:data.title||FL.DialogControls.defaults.title,width:data.width||FL.DialogControls.defaults.width};if(data.content!==undefined){options.content=data.content;}else{if(data.load==="iframe"){options.iframe=true;}else{options.ajax=true;}options.url=url;}popup=new FL.dialog(id,options,dialog);return false;},close:function(id){jQuery("#"+id).dialog("close");}};windowPop=function(path,name,width,height,scroll,location,resize){var popup=new FL.dialog(name,{iframe:true,url:path},{height:height,resizable:resize==null?true:resize=="yes"?true:false,width:width});};window.FL=window.FL||{};FL.Autotab={ignoreKeys:[8,9,16,17,18,19,20,27,33,34,35,36,37,38,39,40,45,46,144,145],apply:function(e){var keyCode=e.keyCode||e.which,target=e.data.target||null,maxLength=parseInt(jQuery(this).attr("maxlength"))||null;if(target!==null&&maxLength!==null){if(jQuery.inArray(keyCode,FL.Autotab.ignoreKeys)===-1&&jQuery(this).val().length>=maxLength){jQuery(target).focus();}}}};function _MaskAPI(){this.version="0.4b";this.instances=0;this.objects={};}MaskAPI=new _MaskAPI();function Mask(m,t){this.mask=m;this.type=(typeof t=="string")?t:"string";this.error=[];this.errorCodes=[];this.value="";this.strippedValue="";this.allowPartial=false;this.id=MaskAPI.instances++;this.ref="MaskAPI.objects['"+this.id+"']";MaskAPI.objects[this.id]=this;}Mask.prototype.attach=function(o){$addEvent(o,"onkeydown","return "+this.ref+".isAllowKeyPress(event, this);",true);$addEvent(o,"onkeyup","return "+this.ref+".getKeyPress(event, this);",true);$addEvent(o,"onblur","this.value = "+this.ref+".format(this.value);",true);};Mask.prototype.isAllowKeyPress=function(e,o){try{if(this.type!="string"){return true;}var xe=new qEvent(e);if(((xe.keyCode>47)&&(o.value.length>=this.mask.length))&&!xe.ctrlKey){return false;}return true;}catch(err){}};Mask.prototype.getKeyPress=function(e,o,_u){try{this.allowPartial=true;var xe=new qEvent(e);if((xe.keyCode>47)||(_u==true)||(xe.keyCode==8||xe.keyCode==46)){var v=o.value,d;if(xe.keyCode==8||xe.keyCode==46){d=true;}else{d=false;}if(this.type=="number"){this.value=this.setNumber(v,d);}else{if(this.type=="date"){this.value=this.setDateKeyPress(v,d);}else{this.value=this.setGeneric(v,d);}}o.value=this.value;}this.allowPartial=false;return true;}catch(err){}};Mask.prototype.format=function(s){if(this.type=="number"){this.value=this.setNumber(s);}else{if(this.type=="date"){this.value=this.setDate(s);}else{this.value=this.setGeneric(s);}}return this.value;};Mask.prototype.throwError=function(c,e,v){this.error[this.error.length]=e;this.errorCodes[this.errorCodes.length]=c;if(typeof v=="string"){return v;}return true;};Mask.prototype.setGeneric=function(_v,_d){var v=_v,m=this.mask;var r="x#*",rt=[],nv="",t,x,a=[],j=0,rx={"x":"A-Za-z","#":"0-9","*":"A-Za-z0-9"};v=v.replace(new RegExp("[^"+rx["*"]+"]","gi"),"");if((_d==true)&&(v.length==this.strippedValue.length)){v=v.substring(0,v.length-1);}this.strippedValue=v;var b=[];for(var i=0;i<m.length;i++){x=m.charAt(i);t=(r.indexOf(x)>-1);if(x=="!"){x=m.charAt(i++);}if((t&&!this.allowPartial)||(t&&this.allowPartial&&(rt.length<v.length))){rt[rt.length]="["+rx[x]+"]";}a[a.length]={"chr":x,"mask":t};}var hasOneValidChar=false;if(!this.allowPartial&&!(new RegExp(rt.join(""))).test(v)){return this.throwError(1,'The value "'+_v+'" must be in the format '+this.mask+".",_v);}else{if((this.allowPartial&&(v.length>0))||!this.allowPartial){for(i=0;i<a.length;i++){if(a[i].mask){while(v.length>0&&!(new RegExp(rt[j])).test(v.charAt(j))){v=(v.length==1)?"":v.substring(1);}if(v.length>0){nv+=v.charAt(j);hasOneValidChar=true;}j++;}else{nv+=a[i].chr;}if(this.allowPartial&&(j>v.length)){break;}}}}if(this.allowPartial&&!hasOneValidChar){nv="";}if(this.allowPartial){if(nv.length<a.length){this.nextValidChar=rx[a[nv.length].chr];}else{this.nextValidChar=null;}}return nv;};Mask.prototype.setNumber=function(_v,_d){var v=String(_v).replace(/[^\d.-]*/gi,""),m=this.mask;v=v.replace(/\./,"d").replace(/\./g,"").replace(/d/,".");if(!/^[\$]?((\$?[\+-]?([0#]{1,3},)?[0#]*(\.[0#]*)?)|([\+-]?\([\+-]?([0#]{1,3},)?[0#]*(\.[0#]*)?\)))$/.test(m)){return this.throwError(1,"An invalid mask was specified for the \nMask constructor.",_v);}if((_d==true)&&(v.length==this.strippedValue.length)){v=v.substring(0,v.length-1);}if(this.allowPartial&&(v.replace(/[^0-9]/,"").length==0)){return v;}this.strippedValue=v;if(v.length==0){v=NaN;}var vn=Number(v);if(isNaN(vn)){return this.throwError(2,"The value entered was not a number.",_v);}if(m.length==0){return v;}var vi=String(Math.abs((v.indexOf(".")>-1)?v.split(".")[0]:v));var vd=(v.indexOf(".")>-1)?v.split(".")[1]:"";var _vd=vd;var isNegative=(vn!=0&&Math.abs(vn)*-1==vn);var show={"$":/^[\$]/.test(m),"(":(isNegative&&(m.indexOf("(")>-1)),"+":((m.indexOf("+")!=-1)&&!isNegative)};show["-"]=(isNegative&&(!show["("]||(m.indexOf("-")!=-1)));m=m.replace(/[^#0.,]*/gi,"");var dm=(m.indexOf(".")>-1)?m.split(".")[1]:"";if(dm.length==0){vi=String(Math.round(Number(vi)));vd="";}else{var md=dm.lastIndexOf("0")+1;if(vd.length>dm.length){vd=String(Math.round(Number(vd.substring(0,dm.length+1))/10));}else{while(vd.length<md){vd+="0";}}}var im=(m.indexOf(".")>-1)?m.split(".")[0]:m;im=im.replace(/[^0#]+/gi,"");var mv=im.indexOf("0")+1;if(mv>0){mv=im.length-mv+1;while(vi.length<mv){vi="0"+vi;}}if(/[#0]+,[#0]{3}/.test(m)){var x=[],i=0,n=Number(vi);while(n>999){x[i]="00"+String(n%1000);x[i]=x[i].substring(x[i].length-3);n=Math.floor(n/1000);i++;}x[i]=String(n%1000);vi=x.reverse().join(",");}if((vd.length>0&&!this.allowPartial)||((dm.length>0)&&this.allowPartial&&(v.indexOf(".")>-1)&&(_vd.length>=vd.length))){v=vi+"."+vd;}else{if((dm.length>0)&&this.allowPartial&&(v.indexOf(".")>-1)&&(_vd.length<vd.length)){v=vi+"."+_vd;}else{v=vi;}}if(show["$"]){v=this.mask.replace(/(^[\$])(.+)/gi,"$")+v;}if(show["+"]){v="+"+v;}if(show["-"]){v="-"+v;}if(show["("]){v="("+v+")";}return v;};Mask.prototype.setDate=function(_v){var v=_v,m=this.mask;var a,e,mm,dd,yy,x,s;a=m.split(/[^mdy]+/);s=m.split(/[mdy]+/);e=v.split(/[^0-9]/);if(s[0].length==0){s.splice(0,1);}for(var i=0;i<a.length;i++){x=a[i].charAt(0).toLowerCase();if(x=="m"){mm=parseInt(e[i],10)-1;}else{if(x=="d"){dd=parseInt(e[i],10);}else{if(x=="y"){yy=parseInt(e[i],10);}}}}if(String(yy).length<3){yy=2000+yy;if((new Date()).getFullYear()+5<yy){yy=yy-100;}}var d=new Date(yy,mm,dd);if(d.getDate()!=dd){return this.throwError(1,"An invalid day was entered.",_v);}else{if(d.getMonth()!=mm){return this.throwError(2,"An invalid month was entered.",_v);}}var nv="";for(i=0;i<a.length;i++){x=a[i].charAt(0).toLowerCase();if(x=="m"){mm++;if(a[i].length==2){mm="0"+mm;mm=mm.substring(mm.length-2);}nv+=mm;}else{if(x=="d"){if(a[i].length==2){dd="0"+dd;dd=dd.substring(dd.length-2);}nv+=dd;}else{if(x=="y"){if(a[i].length==2){nv+=d.getYear();}else{nv+=d.getFullYear();}}}}if(i<a.length-1){nv+=s[i];}}return nv;};Mask.prototype.setDateKeyPress=function(_v,_d){var v=_v,m=this.mask,k=v.charAt(v.length-1);var a,e,c,ml,vl,mm="",dd="",yy="",x,p,z;if(_d==true){while((/[^0-9]/gi).test(v.charAt(v.length-1))){v=v.substring(0,v.length-1);}if((/[^0-9]/gi).test(this.strippedValue.charAt(this.strippedValue.length-1))){v=v.substring(0,v.length-1);}if(v.length==0){return"";}}a=m.split(/[^mdy]/);s=m.split(/[mdy]+/);if(s[0].length==0){s.splice(0,1);}e=v.split(/[^0-9]/);p=(e.length>0)?e.length-1:0;c=a[p].charAt(0);ml=a[p].length;for(var i=0;i<e.length;i++){x=a[i].charAt(0).toLowerCase();if(x=="m"){mm=parseInt(e[i],10)-1;}else{if(x=="d"){dd=parseInt(e[i],10);}else{if(x=="y"){yy=parseInt(e[i],10);}}}}var nv="";var j=0;for(i=0;i<e.length;i++){x=a[i].charAt(0).toLowerCase();if(x=="m"){z=((/[^0-9]/).test(k)&&c=="m");mm++;if((e[i].length==2&&mm<10)||(a[i].length==2&&c!="m")||(mm>1&&c=="m")||(z&&a[i].length==2)){mm="0"+mm;mm=mm.substring(mm.length-2);}vl=String(mm).length;ml=2;nv+=mm;}else{if(x=="d"){z=((/[^0-9]/).test(k)&&c=="d");if((e[i].length==2&&dd<10)||(a[i].length==2&&c!="d")||(dd>3&&c=="d")||(z&&a[i].length==2)){dd="0"+dd;dd=dd.substring(dd.length-2);}vl=String(dd).length;ml=2;nv+=dd;}else{if(x=="y"){z=((/[^0-9]/).test(k)&&c=="y");if(c=="y"){yy=String(yy);}else{if(a[i].length==2){yy=d.getYear();}else{yy=d.getFullYear();}}if((e[i].length==2&&yy<10)||(a[i].length==2&&c!="y")||(z&&a[i].length==2)){yy="0"+yy;yy=yy.substring(yy.length-2);}ml=a[i].length;vl=String(yy).length;nv+=yy;}}}if(((ml==vl||z)&&(x==c)&&(i<s.length))||(i<s.length&&x!=c)){nv+=s[i];}}if(nv.length>m.length){nv=nv.substring(0,m.length);}this.strippedValue=(nv=="NaN")?"":nv;return this.strippedValue;};function qEvent(e){if(window.Event){var isKeyPress=(e.type.substring(0,3)=="key");this.keyCode=(isKeyPress)?parseInt(e.which,10):0;this.button=(!isKeyPress)?parseInt(e.which,10):0;if(!this.keyCode){this.keyCode=(isKeyPress)?parseInt(e.keyCode,10):0;}this.srcElement=e.target;this.type=e.type;this.x=e.pageX;this.y=e.pageY;this.screenX=e.screenX;this.screenY=e.screenY;if(document.layers){this.altKey=((e.modifiers&Event.ALT_MASK)>0);this.ctrlKey=((e.modifiers&Event.CONTROL_MASK)>0);this.shiftKey=((e.modifiers&Event.SHIFT_MASK)>0);this.keyCode=this.translateKeyCode(this.keyCode);}else{this.altKey=e.altKey;this.ctrlKey=e.ctrlKey;this.shiftKey=e.shiftKey;}}else{e=window.event;this.keyCode=parseInt(e.keyCode,10);this.button=e.button;this.srcElement=e.srcElement;this.type=e.type;if(document.all){this.x=e.clientX+document.body.scrollLeft;this.y=e.clientY+document.body.scrollTop;}else{this.x=e.clientX;this.y=e.clientY;}this.screenX=e.screenX;this.screenY=e.screenY;this.altKey=e.altKey;this.ctrlKey=e.ctrlKey;this.shiftKey=e.shiftKey;}if(this.button==0){this.setKeyPressed(this.keyCode);this.keyChar=String.fromCharCode(this.keyCode);}}qEvent.prototype.translateKeyCode=function(i){var l={};if(!!document.layers){if(this.keyCode>96&&this.keyCode<123){return this.keyCode-32;}l={96:192,126:192,33:49,64:50,35:51,36:52,37:53,94:54,38:55,42:56,40:57,41:48,92:220,124:220,125:221,93:221,91:219,123:219,39:222,34:222,47:191,63:191,46:190,62:190,44:188,60:188,45:189,95:189,43:187,61:187,59:186,58:186,"null":null};}return(!!l[i])?l[i]:i;};qEvent.prototype.setKP=function(i,s){this.keyPressedCode=i;this.keyNonChar=(typeof s=="string");this.keyPressed=(this.keyNonChar)?s:String.fromCharCode(i);this.isNumeric=(parseInt(this.keyPressed,10)==this.keyPressed);this.isAlpha=((this.keyCode>64&&this.keyCode<91)&&!this.altKey&&!this.ctrlKey);return true;};qEvent.prototype.setKeyPressed=function(i){var b=this.shiftKey;if(!b&&(i>64&&i<91)){return this.setKP(i+32);}if(i>95&&i<106){return this.setKP(i-48);}switch(i){case 49:case 51:case 52:case 53:if(b){i=i-16;}break;case 50:if(b){i=64;}break;case 54:if(b){i=94;}break;case 55:if(b){i=38;}break;case 56:if(b){i=42;}break;case 57:if(b){i=40;}break;case 48:if(b){i=41;}break;case 192:if(b){i=126;}else{i=96;}break;case 189:if(b){i=95;}else{i=45;}break;case 187:if(b){i=43;}else{i=61;}break;case 220:if(b){i=124;}else{i=92;}break;case 221:if(b){i=125;}else{i=93;}break;case 219:if(b){i=123;}else{i=91;}break;case 222:if(b){i=34;}else{i=39;}break;case 186:if(b){i=58;}else{i=59;}break;case 191:if(b){i=63;}else{i=47;}break;case 190:if(b){i=62;}else{i=46;}break;case 188:if(b){i=60;}else{i=44;}break;case 106:case 57379:i=42;break;case 107:case 57380:i=43;break;case 109:case 57381:i=45;break;case 110:i=46;break;case 111:case 57378:i=47;break;case 8:return this.setKP(i,"[backspace]");case 9:return this.setKP(i,"[tab]");case 13:return this.setKP(i,"[enter]");case 16:case 57389:return this.setKP(i,"[shift]");case 17:case 57390:return this.setKP(i,"[ctrl]");case 18:case 57388:return this.setKP(i,"[alt]");case 19:case 57402:return this.setKP(i,"[break]");case 20:return this.setKP(i,"[capslock]");case 32:return this.setKP(i,"[space]");case 91:return this.setKP(i,"[windows]");case 93:return this.setKP(i,"[properties]");case 33:case 57371:return this.setKP(i*-1,"[pgup]");case 34:case 57372:return this.setKP(i*-1,"[pgdown]");case 35:case 57370:return this.setKP(i*-1,"[end]");case 36:case 57369:return this.setKP(i*-1,"[home]");case 37:case 57375:return this.setKP(i*-1,"[left]");case 38:case 57373:return this.setKP(i*-1,"[up]");case 39:case 57376:return this.setKP(i*-1,"[right]");case 40:case 57374:return this.setKP(i*-1,"[down]");case 45:case 57382:return this.setKP(i*-1,"[insert]");case 46:case 57383:return this.setKP(i*-1,"[delete]");case 144:case 57400:return this.setKP(i*-1,"[numlock]");}if(i>111&&i<124){return this.setKP(i*-1,"[f"+(i-111)+"]");}return this.setKP(i);};function $addEvent(o,_e,c,_b){var e=_e.toLowerCase(),b=(typeof _b=="boolean")?_b:true,x=(o[e])?o[e].toString():"";x=x.substring(x.indexOf("{")+1,x.lastIndexOf("}"));x=((b)?(x+c):(c+x))+"\n";return o[e]=(!!window.Event)?new Function("event",x):new Function(x);}window.FL=window.FL||{};FL.PhoneMask=jQuery.extend(true,{init:function(selector){oStringMask=new Mask("###-###-####");jQuery(selector).live("blur",FL.PhoneMask.onblur).live("keydown",FL.PhoneMask.onkeydown).live("keyup",FL.PhoneMask.onkeyup);},onblur:function(){this.value=MaskAPI.objects[0].format(this.value);},onkeydown:function(event){return MaskAPI.objects[0].isAllowKeyPress(event,this);},onkeyup:function(event){return MaskAPI.objects[0].getKeyPress(event,this);}},FL.PhoneMask);function validateNumbers(field,minValue,maxValue){var numbers="0123456789";var input=""+field.value;var numberValue=field.value;if(input.length>0){if((field.value<minValue)||(field.value>maxValue)){field.value="";alert("Please enter a valid date.  Do not use any spaces.");field.focus();}for(var i=0;i<input.length;i++){if(numbers.indexOf(input.charAt(i))==-1){alert("Please enter a valid date.  Do not use any spaces.");field.value="";field.focus();break;}}}}function validateNotNull(field){var space=" ";var input=field.value;if(input.length<=0){alert("error");field.focus();}}function checkValueOnFocus(element){if(element.value==element.defaultValue){element.value="";}}function checkValueOnBlur(element){if(element.value==""){element.value=element.defaultValue;}}function checkNullOnSubmit(element,errorDivId){if(element.value==""||element.value==element.defaultValue){document.getElementById(errorDivId).style.display="block";element.focus();return false;}}jQuery(".searchResultsProductDetail").live("mouseover mouseout",function(event){if(event.type=="mouseover"){var thisProductID=jQuery(this).data("productid");displayQuickLook(jQuery(this),thisProductID);}else{var thisProductID=jQuery(this).attr("id");hideQuickLookButton(thisProductID);}return false;});var maxQuantity=5;var POPUPWIDTH=475;var POPUPHEIGHT=425;var popupDisplayTimer;var dimmerTimer;var contentTimer;var errorTimer;var product;var productDiv;var productId;var tempProductId;var movePosition=true;var currentProduct=null;var selectedSku="";var selectedSkuValue="";var brands=false;ImageControls.loadImage("/media/images/product-grid/quick_looks_background.gif",255,255);ImageControls.loadImage("/store/images/enhancements/b_addtocart_waiting.gif");function getCurrentColor(productId){jQuery.ajax({data:{productId:productId},dataType:"xml",type:"GET",url:"/store/results/fragments/productLookupXML.jsp",success:function(xml,textStatus,jqXHR){var product=jQuery(xml).find("product").get(0);currentProduct=new Product(product);}});}var howManyTimesTried=0;var lastErrorReturned=null;function addItemToCart(){howManyTimesTried++;if(howManyTimesTried<=3){jQuery("#addToCartImg").attr({src:"/store/images/enhancements/b_addtocart_waiting.gif",alt:"Please wait for product to be added to your cart"}).removeClass().unbind("click");var _thisProdID=productId;jQuery.ajax({data:{productId:productId,quantity:jQuery("#quantity").val(),skuSelection:selectedSkuValue},type:"GET",dataType:"json",url:"/store/global/fragments/addItemToDynamicCart.jsp",success:function(data,textStatus,jqXHR){var returnCode,description,errorStack;
FL.recommendations.sendCustomEvent(_thisProdID,"shopping+cart");returnCode=data.addToCart.return_code;howManyTimesTried=0;if(returnCode>-1){if(brands===true){window.parent.location="/store/checkout/cart.jsp";}else{closeQuickLookPopup();FL.DynamicCart.siteCatalystAddToCart(productId,jQuery("#quantity").val());FL.DynamicCart.displayNewProduct(data.dynamicCart,productId,selectedSkuValue);}}else{description="";errorStack=data.addToCart.error_stack;reenableButton=true;$sizeBox=null;for(var i=0;i<errorStack.length;i++){switch(errorStack[i].error_code){case"-1000":description+="Order amount exceeds available inventory.  Please reduce the requested quantity";break;case"-2000":description+="You have exceeded the maximum number of allowed items per customer. Please reduce the requested quantity.";break;case"atg.droplet.DropletFormException":case"-3000":description+="You have selected an item that is out of stock.  Please select another item.";reenableButton=false;break;case"-4000":description+="You have selected an invalid quantity. Please change the requested quantity.";break;default:description+="An error has occurred. Please retry.";break;}}jQuery('<div id="addItemToCartError">'+description+"</div>").dialog({title:"Error",zIndex:9999,modal:true,draggable:true,close:function(event,ui){jQuery("#addItemToCartError").dialog("destroy").remove();}});if(reenableButton){jQuery("#addToCartImg").attr({alt:"Add to Cart",src:"/store/images/enhancements/b_addtocart.gif"}).removeClass().addClass("addToCartImg");addOnClickForAddToCart();}else{$sizeBox=jQuery("#size_"+selectedSkuValue);$sizeBox.removeClass("sizeBoxSelected").addClass("sizeBoxUnavailable");$sizeBox.unbind();addOnMouseOverForUnavailable("size_"+selectedSkuValue,selectedSkuValue,$sizeBox.text());addOnClickForSelectSizeCart();jQuery("#addToCart").html('<img id="addToCartImg" src="/store/images/enhancements/b_addtocart_off.gif" alt="You must select a size to add to cart"/>');}}},error:function(jqXHR,textStatus,errorThrown){lastErrorReturned={"errorThrown":errorThrown,"textStatus":textStatus};addItemToCart();}});}else{if(confirm('There was a problem adding your item to the cart.\nClick OK to refresh the page and try again, or contact customer service for assistance.\n\nCustomer Service: 1-888-777-3949\nOr e-mail us by clicking "Customer Service" at the bottom of the page\n\nError Information: '+lastErrorReturned.textStatus+" "+lastErrorReturned.errorThrown)){location.reload(true);}else{jQuery("#addToCartImg").attr({alt:"Add to Cart",src:"/store/images/enhancements/b_addtocart.gif"}).removeClass().addClass("addToCartImg");addOnClickForAddToCart();howManyTimesTried=0;}}}function addItemToWishList(){jQuery.ajax({data:{productId:productId,skuId:selectedSkuValue},dataType:"xml",type:"GET",url:"/store/catalog/fragments/addToGiftList.jsp",success:function(xml,textStatus,jqXHR){if(jQuery(xml).find("result").text()==="success"){window.location=jQuery(xml).find("redirectURL").text();}}});}function loadProduct(productId){jQuery.ajax({data:{productId:productId},dataType:"xml",type:"GET",url:"/store/results/fragments/productLookupXML.jsp",success:function(xml,textStatus,jqXHR){var product=jQuery(xml).find("product").get(0);loadDefaultPopup(product);populateQuickLook(product);var quickLookForTeaLeaf={tl_ql_product_name:jQuery(product).find("name").text(),tl_ql_product_productid:jQuery(product).find("productid").text(),tl_ql_product_colordescription:jQuery(product).find("colordescription").text(),tl_ql_product_style:jQuery(product).find("style").text(),tl_ql_product_colorid:jQuery(product).find("colorid").text()};subtype="MyQuickLookEvent";TeaLeaf.Event.tlAddCustomEvent(subtype,quickLookForTeaLeaf);}});}function addOnClickForQLTab(){jQuery("#detailImg").click(function(){changeQuickLookPopupTab("detailTab","tab_details","detailInfo");});}function addOnClickForAddToCart(){jQuery("#addToCartImg").click(addItemToCart);showSeeItemInCartLink();}function addOnClickForClose(){jQuery("#closeImg").click(closeQuickLookPopup);}function addOnClickForColor(objName,tProductId,colorImage,iterator){ImageControls.loadColorImage(colorImage);jQuery("#"+objName).click(function(){onClickColorChange(tProductId,iterator);}).mouseover(function(){changeColorOver(objName,iterator);clearTimeout(clearImageTimer);jQuery("#imageOver").html('<img id="imageOverImg" src="'+ImageControls.convertToLarge(colorImage)+'"/>').show();hideSelectSizeError();}).mouseout(function(){changeColorOut(objName);clearImageTimer=setTimeout("jQuery('#imageOver').hide()",125);});}function addOnClickForSelectSizeCart(){jQuery("#addToCartImg").click(displaySelectSizeError);}window.QuickLooks=window.QuickLooks||{};QuickLooks.sizeIsSelected=false;function displaySelectSizeError(){if(!window.QuickLooks.sizeIsSelected){jQuery("#errorSelectSizeCart").fadeIn();jQuery("#errorSelectSize").fadeIn();errorTimer=setTimeout(hideSelectSizeError,5000);}else{}}function hideSelectSizeError(){clearTimeout(errorTimer);jQuery("#errorSelectSizeCart").fadeOut();jQuery("#errorSelectSize").fadeOut();}function addOnMouseOverForSize(objName,tSkuId,tSize){jQuery("#"+objName).click(function(){updateSize(objName,tSkuId,tSize);}).mouseover(function(){changeSizeOver(objName);hideSelectSizeError();}).mouseout(function(){changeSizeOut(objName);});}function addOnMouseOverForUnavailable(objName,pSkuId,pSize){jQuery("#"+objName).mouseover(displayUnavailableMessage).mouseout(hideUnavailableMessage);}function displayUnavailableMessage(){jQuery("#errorSizeUnavailable").css({visibility:"visible"});}function hideUnavailableMessage(){jQuery("#errorSizeUnavailable").css({visibility:"hidden"});}function changeTabForIE(){changeQuickLookPopupTab("detailTab","tab_details","detailInfo");}function changeColorOver(objName,iterator){displayProductInfo(alternateColors[iterator]);jQuery("#"+objName).removeClass().addClass("colorHover");jQuery("#sizeText").hide();clearTimeout(dimmerTimer);clearTimeout(contentTimer);jQuery("#sizeText").fadeOut();jQuery("#sizeDimmer").show();}function displayProductInfo(product){var nowPrice,sizes;nowPrice=product.wasPrice===""?product.nowPrice:"<span>"+product.nowPrice+"</span>";sizes=[];jQuery(product.skus).each(function(index){if(product.instoreOnly!=="In-Store Exclusive"&&product.skuAvailable[index]==="true"){sizes[index]='<span id="size_'+index+'" data="available">'+product.getSizeText(index)+"</span>";}else{sizes[index]='<span id="size_'+index+'" data="unavailable">'+product.getSizeText(index)+"</span>";}});jQuery("#quicklook").find("#title").html(product.name).end().find("#colorDescripition").html(product.colorDescription).end().find("#style").html("Style: "+product.styleDescription).end().find("#wasPrice").html(product.wasPrice).end().find("#nowPrice").html(nowPrice).end().find("#sizeDimmer").html(sizes.join("")).find('span[data="available"]').addClass("sizeBox").end().find('span[data="unavailable"]').addClass("sizeBoxUnavailable").end().end().find("#salesText").html(product.salesText).end().find("#sizeText").css({display:"inline"}).end().find("#addToCart").html("").end();if(product.instoreOnly!=="In-Store Exclusive"){jQuery("#quicklook").find("#addToCart").append('<img id="addToCartImg" src="/store/images/enhancements/b_addtocart_off.gif" alt="You must select a size to add to cart"/>').end().find("#quantityHeader").show().end().find("#qtyText").show().end().find("#quantity").show().end();addOnClickForSelectSizeCart();}else{jQuery("#quicklook").find("#addToCart").append('<div id="addToCartTxt">Click "more details" link below to see in-store availability.').end().find("#quantityHeader").hide().end().find("#qtyText").hide().end().find("#quantity").hide().end();}}function changeColorOut(objName){jQuery("#"+objName).removeClass();dimmerTimer=setTimeout("jQuery('#sizeDimmer').hide()",125);contentTimer=setTimeout(function(){displayProductInfo(currentProduct);},125);}function changeSizeOver(objName){if(objName!=selectedSku){jQuery("#"+objName).removeClass().addClass("sizeBoxHover");}}function changeSizeOut(objName){if(selectedSku!=objName){jQuery("#"+objName).removeClass().addClass("sizeBox");}else{jQuery("#"+objName).removeClass().addClass("sizeBoxSelected");}}function imageLoaded(loadingImage,loadedImage){jQuery("#"+loadingImage).hide();jQuery("#"+loadedImage).show();}function updateSize(objName,tSkuId,tSize){window.QuickLooks.sizeIsSelected=true;if(jQuery.browser.msie){jQuery("#addToCartImg").unbind("click");}jQuery("#sizeImages").find("span").removeClass("sizeBoxSelected").addClass("sizeBox");selectedSku=objName;selectedSkuValue=tSkuId;jQuery("#"+objName).removeClass().addClass("sizeBoxSelected");jQuery("#sizeHeader").html("Select Size ");jQuery('<span id="sizeText">'+tSize+"</span>").appendTo("#sizeHeader");jQuery("#addToCartImg").attr({src:"/store/images/enhancements/b_addtocart.gif",alt:"Add to Cart"}).removeClass().addClass("addToCartImg");addOnClickForAddToCart();}function addQuantityOptions(highNum){var html=[];for(var i=1;i<=highNum;i++){html.push('<option value="',i,'">',i,"</option>");}jQuery("#quantity").append(html.join(""));}function setProductImage(productImage){var productImageInfo='<img id="loadingImg" src="/media/images/product-grid/quick_looks_background.gif"/><img id="productImg" onload="imageLoaded(\'loadingImg\', \'productImg\')" src="'+productImage+'"/>';if(window.opera){productImageInfo='<img id="productImg" src="'+productImage+'" style="display:block"/>';}jQuery("#image").html(productImageInfo);}function loadDefaultPopup(product){var html=['<div id="errorSelectSizeCart"></div>','<div id="errorSelectSize"></div>','<div id="qlHeader">','<div id="closeTab"><img id="closeImg" src="/store/images/enhancements/b_close.gif"/></div>','<div id="qlPopupHeader"></div>',"</div>",'<div id="imagePrice" class="imagePrice">','<div id="salesText"></div>','<div id="errorSizeUnavailable">Sorry. Size Unavailable.</div>','<div id="image"></div>','<div id="imageOver"></div>','<div id="title"></div>','<div id="colorDescription"></div>','<div id="style"></div>','<div id="wasPrice"></div>','<div id="nowPrice"></div>','<div id="moreDetails"></div>',"</div>",'<div id="unavailableInfo"></div>','<div id="displayInfo">','<div id="sizeColorTab">','<img id="sizeColorImg" src="/store/images/enhancements/tab_sizecolor.gif"/>',"</div>",'<div id="detailTab">','<img id="detailImg" src="/store/images/enhancements/tab_details_grey.gif" style="cursor: pointer"/>',"</div>",'<div id="detailBox">','<div id="sizeColorInfo">','<h2 id="colorHeader">Select Color</h2>','<div id="colorImages"></div>','<h2 id="sizeHeader">Select Size <span id="sizeText"></span></h2>','<div id="sizeDimmer">','<div id="dimmerText">Select color to view<br/>size availability</div>',"</div>",'<div id="sizeImages"></div>','<h2 id="quantityHeader">Select Quantity</h2>','<span id="qtyText">Qty: <span>','<select id="quantity" name="quantity"></select>','<div id="addToCart" class="addToCart"></div>',"</div>",'<div id="detailInfo"></div>',"</div>","</div>"].join("");jQuery("#qlContent").html(html);if(jQuery.browser.msie){jQuery("#errorSelectSize").hide();jQuery("#errorSelectSizeCart").hide();}else{jQuery("#errorSelectSize").css({visibility:"visible"}).hide();jQuery("#errorSelectSizeCart").css({visibility:"visible"}).hide();}addOnClickForClose();addOnClickForQLTab();jQuery("#sizeDimmer").hide();var maxUnitsPerOrder=jQuery(product).find("maxUnitsPerOrder").text();if(parseInt(maxUnitsPerOrder)<parseInt(maxQuantity)){addQuantityOptions(maxUnitsPerOrder);}else{addQuantityOptions(maxQuantity);}}function populateQuickLook(product){jQuery("#quicklook").find("#sizeDimmer").hide().end().find("#qlPopupHeader").html("&nbsp;").end().find("#title").html(jQuery(product).find("name").text()).end().find("#image").html('<img id="loadingImg" src="/media/images/product-grid/quick_looks_background.gif"/><img id="productImg" src="'+jQuery(product).find("image").text()+'"/>').end().find("#colorDescripition").html(jQuery(product).find("colorDescription").text()).end().find("#style").html("Style: "+jQuery(product).find("style").text()+" "+jQuery(product).find("colorId").text());jQuery("#productImg").load(function(){imageLoaded("loadingImg","productImg");});clearImageTimer=setTimeout("jQuery('#imageOver').hide()",125);if(jQuery(product).find("active").text()==="false"||jQuery(product).find("price").find("sale").text()==="no-sale"){jQuery("#quicklook").find("#unavailableInfo").html("This product is unavailable").end().find("#displayInfo").remove().end().find("#wasPrice").remove().end().find("#nowPrice").remove().end();}else{jQuery("#unavailableInfo").remove();if(jQuery(product).find("price").find("original").text()!=="no-sale"){jQuery("#quicklook").find("#wasPrice").html(jQuery(product).find("price").find("original").text()).end().find("#nowPrice").html("<span>"+jQuery(product).find("price").find("sale").text()).end().find("#salesText").html("SALE!");}else{jQuery("#quicklook").find("#salesText").html("").end().find("#wasPrice").html("").end().find("#nowPrice").html(jQuery(product).find("price").find("sale").text());}var detailsInfo="<div>"+jQuery(product).find("description").text()+"</div>";jQuery(product).find("otherdetails").find("detail").each(function(){detailsInfo+="<div>"+jQuery(this).text()+"</div>";});detailsInfo+='<div id="detailsMoreDetails"><a href="/store/catalog/product.jsp?productId='+jQuery(product).find("productId").text()+'" id="moreDetailsLinks">more details</a></div>';jQuery("#quicklook").find("#unavailableInfo").remove().end().find("#detailInfo").html(detailsInfo).end().find("#quantity").html("").end().find("#addToCart").html("").end().find("#colorImages").html("").end().find("#sizeText").html("").end().find("#sizeImages").html("").end();var maxUnitsPerOrder=jQuery(product).find("maxUnitsPerOrder").text();if(parseInt(maxUnitsPerOrder)<parseInt(maxQuantity)){addQuantityOptions(maxUnitsPerOrder);}else{addQuantityOptions(maxQuantity);}if(jQuery(product).find("instoreOnly").text()!=="In-Store Exclusive"){jQuery("#addToCart").html('<img id="addToCartImg" src="/store/images/enhancements/b_addtocart_off.gif" alt="You must select a size to add to cart"/>');addOnClickForSelectSizeCart();}else{jQuery("#addToCart").html('<div id="addToCartTxt">Click "more details" link below to see in-store availability.');}var alternateColorsSet=false;if(currentProduct===null||currentProduct.name!==jQuery(product).find("name").text()){alternateColors=new Array();}else{alternateColorsSet=true;}jQuery(product).find("colors").find("color").each(function(index){var colorImage=jQuery(this).attr("thumbnail");var colorProductId=jQuery(this).attr("productId");var colorId="thumb_"+colorProductId;var colorText=jQuery(this).text();var selected=jQuery(this).attr("selected");if(alternateColorsSet===false){new AlternateProduct(colorProductId,index);}jQuery("#colorImages").append('<img id="'+colorId+'" src="'+colorImage+'" alt="'+colorText+'"/>');if(selected==="true"){jQuery("#"+colorId).addClass("thumbSelected");currentProduct=new Product(product);}else{addOnClickForColor(colorId,colorProductId,colorImage,index);}});if(jQuery(product).find("sizes").find("size").length===1){var sizeSku=jQuery(product).find("sizes").find("size").attr("sku");var sizeText=jQuery(product).find("sizes").find("size").text();var sizeName="size_"+sizeSku;jQuery("#sizeImages").append('<span id="'+sizeName+'">'+sizeText+"</span>");updateSize(sizeName,sizeSku,sizeText);}else{jQuery(product).find("sizes").find("size").each(function(){var sizeSku=jQuery(this).attr("sku");var sizeAvailable=jQuery(this).attr("available");var sizeText=jQuery(this).text();var sizeName="size_"+sizeSku;jQuery("#sizeImages").append('<span id="'+sizeName+'">'+sizeText+"</span>");if(jQuery(product).find("instoreOnly").text()!=="In-Store Exclusive"){if(sizeAvailable==="false"){jQuery("#"+sizeName).addClass("sizeBoxUnavailable");addOnMouseOverForUnavailable(sizeName,sizeSku,sizeText);}else{jQuery("#"+sizeName).addClass("sizeBox");addOnMouseOverForSize(sizeName,sizeSku,sizeText);}}else{jQuery("#"+sizeName).addClass("sizeBoxUnavailable");
addOnMouseOverForUnavailable(sizeName,sizeSku,sizeText);jQuery("#quicklook").find("#quantityHeader").hide().end().find("#qtyText").hide().end().find("#quantity").hide();}});}var $targetDiv=jQuery("body");TeaLeaf.Client.tlProcessNode($targetDiv,false);}}function changeQuickLookPopupTab(tabDiv,tabImage,contentDiv){var otherDiv=tabDiv=="sizeColorTab"?"detailTab":"sizeColorTab";var otherImage=tabImage=="tab_sizecolor"?"tab_details":"tab_sizecolor";var otherContentDiv=contentDiv=="sizeColorInfo"?"detailInfo":"sizeColorInfo";jQuery("#"+tabDiv).html('<img src="/store/images/enhancements/'+tabImage+'.gif"/>');jQuery("#"+otherDiv).html('<img src="/store/images/enhancements/'+otherImage+'_grey.gif"/>').find("img").css({cursor:"pointer"}).click(function(){changeQuickLookPopupTab(otherDiv,otherImage,otherContentDiv);});jQuery("#"+contentDiv).show();jQuery("#"+otherContentDiv).hide();}function clearQuickLookTimer(){clearTimeout(popupDisplayTimer);}function closeQuickLookPopup(){jQuery("#quicklook").hide();}function displayQuickLook(tProductDiv,tProductId){if(jQuery("#quicklook").css("display")==="none"){resetSku();tempProductId=tProductId;productDiv=tProductDiv;productDiv.style.position="relative";displayQuickLookButton();}}function hideQuickLookButton(tProductId){tempProductId="";setTimeout("tryHideQuickLookButton('"+tProductId+"');",1);}function tryHideQuickLookButton(tProductId){if(tProductId!=tempProductId){jQuery("#item"+tProductId+"quickLookButton").fadeTo(100,0);}}function displayQuickLookButton(){jQuery(".quickLookButton").fadeTo(0,0).css("visibility","hidden");jQuery("#item"+tempProductId+"quickLookButton").css("visibility","visible").fadeTo(100,1);}function onClickColorChange(tProductId,iterator){omnitureRollover(tProductId);currentProduct=alternateColors[iterator];productId=tProductId;populateQuickLook(currentProduct.xml);}function qlDisplayPopup(pProductId,showSizeWarning){window.QuickLooks.sizeIsSelected=false;productId=pProductId;omnitureRollover(productId);if(movePosition){jQuery("#qlContent").html("");changePosition();showLoadingScreen();}else{movePosition=true;}loadProduct(productId);jQuery("#quicklook").show();var _thisProdID=productId;FL.recommendations.sendCustomEvent(_thisProdID,"quickview");hideQuickLookButton(productId);if(showSizeWarning=="true"){setTimeout("displaySelectSizeError()",500);setTimeout("addSeeItemInCartLink(productId);",500);}}function addSeeItemInCartLink(pProductId){jQuery("#quantity").after('<a id="seeItemInCartLink" href="#">See Price in Cart</a>').find("#seeItemInCartLink").click(function(){priceMaskPopUp(pProductId,"quickLooks");}).hide();}function showSeeItemInCartLink(){jQuery("#seeItemInCartLink").show();}function resetSku(){selectedSku="";selectedSkuValue="";}function showLoadingScreen(){var html=['<div id="loadingScreen">','<img id="loadingImg" src="/media/images/product-grid/quick_looks_background.gif"/>',"</div>"].join("");jQuery("#qlContent").html(html);}function changeLeft(){var rightMost=productDiv.offsetLeft;rightMost=rightMost+POPUPWIDTH>jQuery.getViewportWidth()?productDiv.offsetLeft-POPUPWIDTH+57:rightMost;rightMost=rightMost<0?0:rightMost;var newLeft=((((jQuery(window).width()/2)-POPUPWIDTH)/2)+"px");jQuery("#quicklook").css({left:newLeft});}function changePosition(){changeLeft();changeTop();}function changeTop(){var topMost=jQuery(productDiv).scrollTop()-100;var screenTop=jQuery(window).scrollTop();var screenHeight=jQuery(window).height();topMost=(topMost+POPUPHEIGHT)>(screenTop+screenHeight)?(screenTop+screenHeight)-POPUPHEIGHT-25:topMost;topMost=topMost<screenTop?screenTop+25:topMost;jQuery("#quicklook").css({top:topMost+"px"});}function omnitureRollover(tProductId){var s=s_gi(scServerCode);s.linkTrackVars="events,products";s.linkTrackEvents="event9";s.events="event9";s.products=";"+tProductId;s.tl(this,"o","QuickLook");}window.FL=window.FL||{};FL.globalTimer=FL.globalTimer||{};FL.globalTimer.THRESHOLD=10000;FL.globalTimer.lastTick_;FL.globalTimer.callbackFunctions_default=["FL.globalTimer.lametest"];FL.globalTimer.callbackFunctions=FL.globalTimer.callbackFunctions||[];FL.globalTimer.highFrequencyTimerSpeedDefault=50;FL.globalTimer.highFrequencyTimerSpeed=FL.globalTimer.highFrequencyTimerSpeedDefault;FL.globalTimer.lowFrequencyTimerSpeedDefault=4000;FL.globalTimer.lowFrequencyTimerSpeedDefault=FL.globalTimer.lowFrequencyTimerSpeedDefault;FL.globalTimer.detectWakeFromSleep_=function(){var now=new Date().getTime();var delta=now-FL.globalTimer.lastTick_;if(delta>FL.globalTimer.THRESHOLD){FL.globalTimer.fetchUpdatedData();}FL.globalTimer.lastTick_=now;};FL.globalTimer.fetchUpdatedData=function(){};FL.globalTimer.lametest=function(){if(typeof FL.setup.lametest==="undefined"){FL.setup.lametest="is defined";}};FL.globalTimer.executeFunctionByName=function(functionName,context){var args=Array.prototype.slice.call(arguments,2);var namespaces=functionName.split(".");var func=namespaces.pop();for(var i=0;i<namespaces.length;i++){context=context[namespaces[i]];}return context[func].apply(context,args);};FL.globalTimer.functionsReset=function(){FL.globalTimer.callbackFunctions=[];if(FL.globalTimer.callbackFunctions_given!=FL.globalTimer.callbackFunctions_default){FL.globalTimer.callbackFunctions=$.merge(FL.globalTimer.callbackFunctions,FL.globalTimer.callbackFunctions_default);}FL.globalTimer.callbackFunctions=$.merge(FL.globalTimer.callbackFunctions,FL.globalTimer.callbackFunctions_given);FL.globalTimer.callbackFunctions=$.merge(FL.globalTimer.callbackFunctions,FL.globalTimer.callbackFunctions_thisScript);};FL.globalTimer.callback=function(){$.each(FL.globalTimer.callbackFunctions,function(index,value){FL.globalTimer.executeFunctionByName(value,window);});};FL.globalTimer.callbackFunctionRemove=function(name){FL.globalTimer.callbackFunctions=jQuery.grep(FL.globalTimer.callbackFunctions,function(value){return value!=name;});FL.globalTimer.callbackFunctions=FL.globalTimer.callbackFunctions.unique();};FL.globalTimer.callbackFunctionAdd=function(name){FL.globalTimer.callbackFunctions=$.merge(FL.globalTimer.callbackFunctions,[name]);FL.globalTimer.callbackFunctions=FL.globalTimer.callbackFunctions.unique();};FL.globalTimer.init=function(){FL.globalTimer.highFrequencyTimerId_=window.setInterval(FL.globalTimer.callback,FL.globalTimer.highFrequencyTimerSpeed);};window.FL=window.FL||{};var swivelor=swivelor||{};FL.swivelor=swivelor||{};$.rloader([{type:"css",src:"/store/assets/styles/one-offs/2060.swivelor.css"}]);swivelor.options={autoHideControls:false,by:1,callbackFunctions:[],controlsHiderIsInitialized:0,currentStepX:0,currentStepY:0,debug:false,displayInPopup:true,doIntro:true,doSwivel:false,fps:100,givenFrameHeight:533,givenFrameWidth:800,grabRotateDistance:800,hoverConfig:{},href:"",imageIndexOffset:1,infiniteAxisX:true,infiniteAxisY:false,initialPos:[0,0],introDelay:250,introDuration:0.5,introSpins:1,maxFrameHeight:533,maxFrameWidth:800,maxSwivelStepsX:39,maxSwivelStepsY:1,maxSwivelorDialogHeightPixels:644,maxSwivelorDialogWidthPixels:870,maxThrowDuration:0.75,minSwivelorDialogHeightPixels:644,minSwivelorDialogWidthPixels:560,minThrowDuration:0,rotationsPerSlideX:0.25,rotationsPerSlideY:1,speed:0,spinBackwards:false,stepHeightPixels:533,stepWidthPixels:800,swivelDirection:"none",swivelSteps:0,swivelX:true,swivelY:false,throwable:true,throwable:true,useSprite:true};swivelor.options.minThrowFrames=Math.floor(swivelor.options.minThrowDuration*swivelor.options.fps);swivelor.options.maxThrowFrames=Math.floor(swivelor.options.maxThrowDuration*swivelor.options.fps);swivelor.frames=[[],[]];swivelor.throwSequence=[];swivelor.arrayOfImages=[];swivelor.imagesAreLoaded=false;swivelor.positions={given:{pageX:0,pageY:0},start:{pageX:0,pageY:0},current:{pageX:0,pageY:0},end:{pageX:0,pageY:0}};swivelor.setUpSpinIntro=function(){var e=swivelor.options.fps*(swivelor.options.introDuration*4),d=(typeof swivelor.options.introInitialRow!="undefined")?swivelor.options.introInitialRow:swivelor.options.initialPos[1],j=d-swivelor.options.initialPos[1],g=[];for(var f=0;f<e;f++){var h=f/e,c=Math.pow(h-1,4);var b=Math.floor(c*swivelor.totalFrames[0]*swivelor.options.introSpins)+swivelor.options.initialPos[0];var a=Math.floor(c*j)+swivelor.options.initialPos[1];if(!g.length||$(g).last()[0]!=b||$(g).last()[1]!=a){var _toPush=swivelor.validatePos([b,a],true);g.push(_toPush);}}swivelor.throwSequence=g;return g;};swivelor.totalFrames=[swivelor.options.maxSwivelStepsX,swivelor.options.maxSwivelStepsY];swivelor.playIntervalDuration=1000/swivelor.options.fps;swivelor.playing=false;swivelor.grabbing=false;swivelor.spinning=false;swivelor.vertical_carousel=function(event,ui){};swivelor.startSwivel=function(event,ui){if(swivelor.playing){swivelor.wasPlaying=true;}swivelor.pause();swivelor.stopThrowing();swivelor.options.doSwivel=true;swivelor.options.ui=ui;swivelor.options.event=event;swivelor.grabInitialMousePosition(event,ui);swivelor.updateStatusDisplay();swivelor.options.grabStartStepX=swivelor.options.currentStepX;swivelor.options.grabStartStepY=swivelor.options.currentStepY;swivelor.introSequence=[];swivelor.gotoPos(swivelor.validatePos([swivelor.options.currentStepX,swivelor.options.currentStepY],true));$("body").addClass("grabbing").bind("mouseup",function(){$(this.nodeName).removeClass("grabbing");});};swivelor.grabInitialMousePosition=function(event,ui){swivelor.positions.swivelPaneOffset=$(".swivel-pane").offset();swivelor.positions.swivelPaneWidth=$(".swivel-pane").width();swivelor.positions.swivelPaneHeight=$(".swivel-pane").height();swivelor.positions.given.pageX=event.pageX;swivelor.positions.given.pageY=event.pageY;swivelor.positions.start.pageX=event.pageX;swivelor.positions.start.pageY=event.pageY;swivelor.positions.current.pageX=event.pageX;swivelor.positions.current.pageY=event.pageY;swivelor.grabHistory=[{pageX:event.pageX,pageY:event.pageY}];swivelor.mouseMoveHistory=[{pageX:event.pageX,pageY:event.pageY}];};swivelor.updateGrabHistory=function(event){swivelor.positions.given.pageX=event.pageX;swivelor.positions.given.pageY=event.pageY;swivelor.grabHistory.unshift({pageX:event.pageX,pageY:event.pageY});if($(swivelor.grabHistory).length>3){$(swivelor.grabHistory).splice(3);}};swivelor.updateMouseMoveHistory=function(event){swivelor.mouseMoveHistory.unshift({pageX:event.pageX,pageY:event.pageY});if(swivelor.mouseMoveHistory.length>2){swivelor.mouseMoveHistory.pop();}};swivelor.isPosLoaded=function(a){return(typeof swivelor.frames[a[0]]!="undefined"&&typeof swivelor.frames[a[0]][a[1]]!="undefined");};swivelor.stopSwivel=function(event,ui){var theUI,theEvent;if(swivelor.options.ui===undefined&&ui===undefined){return;}else{if(ui===undefined){theUI=swivelor.options.ui;}else{theUI=ui;}}if(swivelor.options.event===undefined&&event===undefined){return;}else{if(event===undefined){theEvent=swivelor.options.event;}else{theEvent=event;}}if(swivelor.wasPlaying==true){swivelor.wasPlaying=false;swivelor.play();}else{if(swivelor.options.throwable){var m,l,f;m=theEvent.pageX-swivelor.mouseMoveHistory[1].pageX;l=theEvent.pageY-swivelor.mouseMoveHistory[1].pageY;f=true;if(m||l){var j,h,c,b,o,n;j=Math.sqrt(Math.pow(m,2)+Math.pow(l,2));h=Math.floor(j/5);c=swivelor.mouseMoveHistory[1].pageX;b=swivelor.mouseMoveHistory[1].pageY;o=true;n=true;if(h<swivelor.options.minThrowFrames){h=swivelor.options.minThrowFrames;}else{if(h>swivelor.options.maxThrowFrames){h=swivelor.options.maxThrowFrames;}}swivelor.throwSequence=[];var _tempThrowSequence=[];for(var e=0;e<h;e++){var g,d,k;g=e/h;if(swivelor.spinBackwards==true){d=Math.pow((g)-1,2);}else{d=Math.pow((g)-1,2)*-1;}c=Math.floor(d*m)+c;b=Math.floor(d*l)+b;k=swivelor.validatePos(swivelor.getGrabPos({pageX:c,pageY:b}),true);if(!o){k[0]=_tempThrowSequence.last()[0];}else{if(_tempThrowSequence.length&&k[0]==_tempThrowSequence.last()[0]){o=false;}}if(!n){k[1]=_tempThrowSequence.last()[1];}else{if(_tempThrowSequence.length&&k[1]==_tempThrowSequence.last()[1]){n=false;}}_tempThrowSequence.push(k);}if(f){swivelor.throwing=true;swivelor.saveTheG=$.merge([],_tempThrowSequence);swivelor.throwSequence=$.merge([],_tempThrowSequence);FL.globalTimer.callbackFunctionAdd("swivelor.throwStep");}}}}};swivelor.updateStatusDisplay=function(){if(swivelor.options.debug==true){$("#swivelor-options-currentStepX .count").html(swivelor.options.currentStepX);$("#swivelor-positions-startX .count").html(swivelor.positions.startX);$("#swivelor-positions-currentX .count").html(swivelor.positions.currentX);$("#swivelor-positions-differenceX .count").html(swivelor.positions.differenceX);$("#swivelor-positions-difference_startX_leftX .count").html(swivelor.positions.difference_startX_leftX);$("#swivelor-positions-difference_currentX_leftX .count").html(swivelor.positions.difference_currentX_leftX);$("#swivelor-positions-difference_startX_rightX .count").html(swivelor.positions.difference_startX_rightX);$("#swivelor-positions-difference_currentX_rightX .count").html(swivelor.positions.difference_currentX_rightX);$("#swivelor-positions-leftX .count").html(swivelor.positions.leftX);$("#swivelor-positions-start-pageX .count").html(swivelor.positions.start.pageX);$("#swivelor-positions-current-pageX .count").html(swivelor.positions.current.pageX);$("#swivelor-positions-swivelDirectionX .count").html(swivelor.positions.swivelDirectionX);$("#swivelor-throwSequence .count").html(swivelor.throwSequence.length);}};swivelor.updateStep=function(param){var _previousStep,_newStep;if(jQuery.isArray(param)){_newStep=(param);swivelor.options.currentStepX=_newStep[0];swivelor.options.currentStepY=_newStep[1];}else{if(parseInt(param)>=0&&parseInt(param)<=swivelor.options.maxSwivelStepsX){_newStep=parseInt(param);if(_newStep>=swivelor.options.maxSwivelStepsX){swivelor.options.currentStepX=0;swivelor.options.currentStepY=0;}else{swivelor.options.currentStepX=_newStep;swivelor.options.currentStepY=_newStep;}}}_previousStep=[swivelor.options.currentStepX,swivelor.options.currentStepY];swivelor.updateStatusDisplay();return[swivelor.options.currentStepX,swivelor.options.currentStepY];};swivelor.keepSwiveling=function(event,ui){var theUI,theEvent,newStepIndexAttr,newStepIndex,_potentialNewStep,_potentialNewStepX,_potentialNewStepY,_totalFramesToSwivelX,_whatPercentPerMouseMoveX,_whatPercentToMoveThisTimeX;if(swivelor.trowing){return;}if(swivelor.options.doSwivel!=true){return;}if(swivelor.options.ui===undefined&&ui===undefined){return;}else{if(ui===undefined){theUI=swivelor.options.ui;}else{theUI=ui;}}if(swivelor.options.event===undefined&&event===undefined){return;}else{if(event===undefined){theEvent=swivelor.options.event;}else{theEvent=event;}}swivelor.options.ui=theUI;swivelor.options.event=theEvent;if(swivelor.playing==true){swivelor.wasPlaying=true;swivelor.pause();}swivelor.updateMouseMoveHistory(theEvent);if(swivelor.options.doSwivel==true){swivelor.$surface=$(theEvent.target);swivelor.positions.leftX=(swivelor.positions.swivelPaneOffset.left);swivelor.positions.upY=(swivelor.positions.swivelPaneOffset.top);swivelor.positions.startX=(swivelor.positions.start.pageX-swivelor.positions.leftX);swivelor.positions.startY=(swivelor.positions.start.pageY-swivelor.positions.upY);swivelor.positions.currentX=(swivelor.positions.current.pageX-swivelor.positions.leftX);swivelor.positions.currentY=(swivelor.positions.current.pageY-swivelor.positions.upY);swivelor.positions.differenceX=((swivelor.positions.startX-swivelor.positions.currentX)*-1);if(swivelor.spinBackwards!=true){swivelor.positions.differenceX=swivelor.positions.differenceX*-1;}swivelor.positions.differenceY=((swivelor.positions.startY-swivelor.positions.currentY)*-1);_totalFramesToSwivelX=(swivelor.options.maxSwivelStepsX*swivelor.options.rotationsPerSlideX);_totalFramesToSwivelY=(swivelor.options.maxSwivelStepsY*swivelor.options.rotationsPerSlideY);_whatPercentPerMouseMoveX=((swivelor.positions.swivelPaneWidth/_totalFramesToSwivelX)/2);_whatPercentPerMouseMoveY=((swivelor.positions.swivelPaneHeight/_totalFramesToSwivelY)/2);_whatPercentToMoveThisTimeX=(swivelor.positions.differenceX/_whatPercentPerMouseMoveX);
_whatPercentToMoveThisTimeY=(swivelor.positions.differenceY/_whatPercentPerMouseMoveY);_potentialNewStepX=swivelor.options.grabStartStepX+Math.floor(_whatPercentToMoveThisTimeX);_potentialNewStepY=swivelor.options.grabStartStepY+Math.floor(_whatPercentToMoveThisTimeY);_potentialNewStep=swivelor.validatePos([_potentialNewStepX,_potentialNewStepY],true);newStepIndexAttr=$("#swiveler-step-"+_potentialNewStep[0]).attr("index");newStepIndex=$("#swiveler-step-"+_potentialNewStep[0]).index();if((theUI.position.left>(swivelor.options.stepWidthPixels*-1))&&(swivelor.options.doSwivel==true)){newLeft=(theUI.position.left-(swivelor.options.stepWidthPixels));swivelor.$surface.css("left",newLeft+"px");theUI.position.left=newLeft;}if(_potentialNewStepX==swivelor.options.currentStepX){return;}swivelor.gotoPos(_potentialNewStep);}};swivelor.atPosition=function(a){return(a[0]==swivelor.options.currentStepX&&a[1]==swivelor.options.currentStepY);};swivelor.play=function(){if(swivelor.playing){return;}swivelor.playing=true;FL.globalTimer.callbackFunctionAdd("swivelor.gotoPrevFrameX");$("#forward, #rewind").blur().button("disable").button("refresh");$("#play").focus().button("refresh");};swivelor.pause=function(){$("#forward, #rewind").blur().button("enable").button("refresh");$("#play").focus().button("refresh");FL.globalTimer.callbackFunctionRemove("swivelor.gotoNextFrameX");FL.globalTimer.callbackFunctionRemove("swivelor.gotoPrevFrameX");swivelor.playing=false;if(swivelor.playing!=true){return;}};swivelor.gotoNextFrameX=function(){swivelor.gotoPos(swivelor.validatePos([swivelor.options.currentStepX+1,swivelor.options.currentStepY],true));};swivelor.gotoNextFrameY=function(){swivelor.gotoPos(swivelor.validatePos([swivelor.options.currentStepX,swivelor.options.currentStepY+1],true));};swivelor.gotoNextFrame=function(){swivelor.gotoPos(swivelor.validatePos([swivelor.options.currentStepX+1,swivelor.options.currentStepY+1],true));};swivelor.gotoPrevFrameX=function(){swivelor.gotoPos(swivelor.validatePos([swivelor.options.currentStepX-1,swivelor.options.currentStepY],true));};swivelor.gotoPrevFrameY=function(){swivelor.gotoPos(swivelor.validatePos([swivelor.options.currentStepX,swivelor.options.currentStepY-1],true));};swivelor.gotoPrevFrame=function(){swivelor.gotoPos(swivelor.validatePos([swivelor.options.currentStepX-1,swivelor.options.currentStepY-1],true));};swivelor.gotoPos=function(posArray){posArray=swivelor.validatePos(posArray);swivelor.currentPos=posArray;swivelor.frame=$("#"+swivelor.frames[posArray[0]]);if(typeof swivelor.frame!="undefined"){swivelor.currentFrame=swivelor.frame;newStep=posArray[0];newStepIndex=$("#swiveler-step-"+posArray[0]).index();swivelor.updateStep(posArray);swivelor.$surface.find(".swivel-content-item").slice(newStepIndex).prependTo(swivelor.$surface);}};swivelor.playIntro=function(){swivelor.unBindKeyboardShortcuts();swivelor.disableSwivelorControls();swivelor.stopThrowing();swivelor.introSequence=swivelor.setUpSpinIntro();swivelor.introInterval=setInterval(swivelor.gotoNextIntroFrame,swivelor.playIntervalDuration);};swivelor.gotoNextIntroFrame=function(){swivelor.gotoPos(swivelor.introSequence.shift());if(!swivelor.introSequence.length){swivelor.bindKeyboardShortcuts();swivelor.enableSwivelorControls();clearInterval(swivelor.introInterval);}};swivelor.throwStep=function(){if(swivelor.throwSequence.length){swivelor.options.grabStartStepX=swivelor.throwSequence[0][0];swivelor.options.grabStartStepY=swivelor.throwSequence[0][1];swivelor.gotoPos(swivelor.throwSequence.shift());if(!swivelor.throwSequence.length){swivelor.stopThrowing();}}else{swivelor.stopThrowing();}};swivelor.stopThrowing=function(){swivelor.throwSequence=[];swivelor.throwing=false;swivelor.completeSpinDown();FL.globalTimer.callbackFunctionRemove("swivelor.throwStep");if(!swivelor.throwing){return;}};swivelor.getGrabPos=function(d){var i,h,e,b,g,f,c,a;i=d.pageX-swivelor.positions.start.pageX;h=d.pageY-swivelor.positions.start.pageY;e=i/swivelor.options.grabRotateDistance;b=h/swivelor.options.grabRotateDistance;g=Math.round(swivelor.options.maxSwivelStepsX*e);f=Math.round(swivelor.options.maxSwivelStepsY*b);c=swivelor.positions.start.pageX+g;a=swivelor.positions.start.pageY+f;return[c,a];};swivelor.validatePos=function(c,b){if(typeof c==="undefined"){swivelor.stopThrowing();return;}try{var msg=("c[0], c[1]: "+c[0]+", "+c[1]);}catch(e){swivelor.stopThrowing();return;}for(var a=0;a<2;a++){if(b||swivelor.options.infiniteAxisX){while(c[a]>swivelor.options.maxSwivelStepsX){c[a]-=(swivelor.options.maxSwivelStepsX+1);}while(c[a]<0){c[a]+=swivelor.options.maxSwivelStepsX;}}else{if(c[a]>swivelor.options.maxSwivelStepsX-1){c[a]=swivelor.options.maxSwivelStepsX-1;}if(c[a]<0){c[a]=0;}}}return c;};swivelor.completeSpinDown=function(){swivelor.positions.start.pageX=0;swivelor.positions.start.pageY=0;swivelor.positions.current.pageX=0;swivelor.positions.current.pageY=0;swivelor.positions.swivelDirectionX="none";swivelor.options.doSwivel=false;swivelor.updateStatusDisplay();};swivelor.horizontal_carousel=function(event,ui){swivelor.positions.given.pageX=event.pageX;swivelor.positions.given.pageY=event.pageY;swivelor.positions.current.pageX=event.pageX;swivelor.positions.current.pageY=event.pageX;swivelor.updateStatusDisplay();swivelor.keepSwiveling(event,ui);};swivelor.preload=function(arrayOfImages){$(arrayOfImages).each(function(index,value){$("<img/>")[0].src=this;if((index+1)==arrayOfImages.length){swivelor.imagesAreLoaded=true;}else{swivelor.imagesAreLoaded=false;}});};swivelor.test=function(){};swivelor.setUpGrabbable=function(){swivelor.introSequence=[];clearInterval(swivelor.introInterval);swivelor.enableSwivelorControls();swivelor.$swivelContentItems.draggable({axis:"x",grid:[(swivelor.options.stepWidthPixels*1),0],drag:swivelor.horizontal_carousel,start:swivelor.startSwivel,stop:swivelor.stopSwivel});$(".ui-widget-overlay").one("click",function(){$("#swivelWrapper").dialog("close");});};swivelor.init=function(){swivelor.options.doSwivel=true;$("#productDetail #leftColumn .altImage").last().css({"float":"right"});$("#alternateViews").append('<a  id="launchSwivel" href="#360"><img src="/media/images/swivel-images/360-icon.png" alt="Click to see a 360 degree view of the product"></a>');$("#launchSwivel").css({border:0,position:"absolute",top:((($("#productDetailsMainproductName").height()+$("#productImages").height())-5)+"px"),left:(($("#productImages").width()-20)+"px")}).one("click",swivelor.setup).focus();};swivelor.reinit=function(){$("#launchSwivel").one("click",function(){$("object, embed").hide();$("#swivelWrapper").dialog("open");$(".ui-widget-overlay").one("click",function(){$("#swivelWrapper").dialog("close");});swivelor.bindKeyboardShortcuts();if(swivelor.options.doIntro==true){swivelor.introSequence=swivelor.setUpSpinIntro();window.setTimeout(swivelor.playIntro,(swivelor.options.introDelay+250));}}).focus();};swivelor.hideSwivelor=function(){$("object, embed").show();swivelor.pause();$("#launchSwivel").unbind("click");swivelor.unBindKeyboardShortcuts();swivelor.reinit();};swivelor.unBindKeyboardShortcuts=function(){$("body, .ui-widget-overlay, html").unbind();};swivelor.enableSwivelorControls=function(){$("#forward, #play, #rewind").button("enable").button("refresh");};swivelor.disableSwivelorControls=function(){$("#forward, #play, #rewind").button("disable").button("refresh");};swivelor.bindKeyboardShortcuts=function(){$("body").keydown(function(event){if(event.keyCode==37){$("#rewind").trigger("click");}else{if(event.keyCode==39){$("#forward").trigger("click");}}});$("body").click(function(event){event.stopPropagation();if($("#play").is(":focus")){}else{if($(event.target).hasClass("ui-widget-overlay")){$("#play").focus().button("refresh");}}});$(".ui-widget-overlay").click(function(){$(".ui-dialog-titlebar-close").trigger("click");});$("body, .ui-widget-overlay, html").keypress(function(event){if(event.keyCode==32){event.preventDefault();if($("#play").is(":focus")){}else{$("#play").trigger("click");}}});};swivelor.resetPositions=function(){var _newIndex=swivelor.options.currentStepX;swivelor.$swivelContentItems.children().each(function(index){var _prevIndex=$(this).attr("index");var _prevID=$(this).attr("id");$(this).attr("index",_newIndex);$(this).children().first().css({backgroundPosition:((_newIndex*swivelor.options.stepWidthPixels)*-1)+"px 0px"});});};swivelor.setup=function(){$("object, embed").hide();swivelor.bodyClass=$("body.swivelor").attr("class").split(" ");swivelor.bodyClass=swivelor.bodyClass.unique();swivelor.bodyClass=jQuery.grep(swivelor.bodyClass,function(value){return value!="";});swivelor.productID=jQuery.grep(swivelor.bodyClass,function(value){if(value.indexOf("swivelorProduct-")===0){return value;}})[0].substring(16);var _foundGoodSize=false;swivelor.zindices=[1200,800,500,255,150,75,48];$.each(swivelor.zindices,function(index,value){if(_foundGoodSize==false){$.ajax({url:"/media/images/swivel-images/"+swivelor.productID+"/z-"+value+"/y-000/directory-properties.json",dataType:"json",cache:false,async:false,success:function(data){if(data.images_width!=""&&data.images_height!=""){if(data.images_width>swivelor.options.maxFrameWidth||data.images_height>swivelor.options.maxFrameHeight){}else{_foundGoodSize=true;swivelor.options.stepWidthPixels=data.images_width;swivelor.options.givenFrameWidth=data.images_width;if(data.images_width>swivelor.options.maxFrameWidth){swivelor.options.grabRotateDistance=swivelor.options.maxFrameWidth;}else{swivelor.options.grabRotateDistance=data.images_width;}swivelor.options.stepHeightPixels=data.images_height;swivelor.options.givenFrameHeight=data.images_height;}if(data.images_spinBackwards!=""){swivelor.options.spinBackwards=data.images_spinBackwards;}swivelor.options.zAxis=data["images_z-axis"];swivelor.options.maxSwivelStepsX=(parseInt(data.images_numberOf)-1);}else{}},error:function(data){}});}else{}});swivelor.$body=$('<div id="swivelWrapper" class="swivel-paneWrapper"><div class="productImageWrapper swivel-pane "><div class="swivel-content"><div class="swivel-content-items"><div class="swivel-content-item "><img height="255" width="255" style="margin-top: 50px;" src="/media/images/product-grid/quick_looks_background.gif" alt="Loading..."></div></div></div></div><div id="swivel-controlsWrapper"><div id="swivel-controls"><span id="swivel-toolbar" class="ui-widget-header ui-corner-all"><button id="rewind" >Previous Frame</button><button id="play">Play</button><button id="forward">Next Frame</button></span></div></div></div>');$("#launchSwivel").unbind("click");$("body").append(swivelor.$body);$("#forward").button({text:false,icons:{primary:"ui-icon-seek-next"}}).click(function(){if(swivelor.playing!=true){if(swivelor.spinBackwards==true){swivelor.gotoNextFrameX();}else{swivelor.gotoPrevFrameX();}}});$("#rewind").button({text:false,icons:{primary:"ui-icon-seek-prev"}}).click(function(){if(swivelor.playing!=true){if(swivelor.spinBackwards==true){swivelor.gotoPrevFrameX();}else{swivelor.gotoNextFrameX();}}});$("#play").button({text:false,icons:{primary:"ui-icon-play"}}).click(function(){var options;if(swivelor.playing!=true){options={label:"Pause",icons:{primary:"ui-icon-pause"}};swivelor.play();}else{options={label:"Play (spacebar)",icons:{primary:"ui-icon-play"}};swivelor.pause();}$(this).button("option",options);});$(".productImageWrapper.swivel-pane").css({width:swivelor.options.grabRotateDistance});swivelor.options.swivelorDialogWidthPixels=(swivelor.options.stepWidthPixels+102);swivelor.options.swivelorDialogHeightPixels=(swivelor.options.stepHeightPixels+154);if(swivelor.options.swivelorDialogWidthPixels<swivelor.options.minSwivelorDialogWidthPixels){swivelor.options.swivelorDialogWidthPixels=swivelor.options.minSwivelorDialogWidthPixels;}if(swivelor.options.swivelorDialogWidthPixels>swivelor.options.maxSwivelorDialogWidthPixels){swivelor.options.swivelorDialogWidthPixels=swivelor.options.maxSwivelorDialogWidthPixels;}if(swivelor.options.swivelorDialogHeightPixels<swivelor.options.minSwivelorDialogHeightPixels){swivelor.options.swivelorDialogHeightPixels=swivelor.options.minSwivelorDialogHeightPixels;}if(swivelor.options.swivelorDialogHeightPixels>swivelor.options.maxSwivelorDialogHeightPixels){swivelor.options.swivelorDialogHeightPixels=swivelor.options.maxSwivelorDialogHeightPixels;}$("#swivelWrapper").dialog({width:swivelor.options.swivelorDialogWidthPixels,height:swivelor.options.swivelorDialogHeightPixels,close:swivelor.hideSwivelor,open:function(){$("#play").focus().button("refresh");},modal:true});swivelor.bindKeyboardShortcuts();FL.globalTimer.callbackFunctions_given=$.merge([],FL.globalTimer.callbackFunctions);FL.globalTimer.callbackFunctions_thisScript=$.merge([],swivelor.options.callbackFunctions);FL.globalTimer.functionsReset();swivelor.$swivelPane=$(".swivel-pane");swivelor.$swivelContent=$(".swivel-content");swivelor.$swivelContentItems=$(".swivel-content-items");swivelor.$surface=swivelor.$swivelContentItems;swivelor.positions.swivelPaneOffset=$(".swivel-pane").offset();swivelor.positions.swivelPaneWidth=$(".swivel-pane").width();swivelor.positions.swivelPaneHeight=$(".swivel-pane").height();swivelor.positions.given.pageX=0;swivelor.positions.given.pageY=0;swivelor.positions.start.pageX=0;swivelor.positions.start.pageY=0;swivelor.positions.current.pageX=0;swivelor.positions.current.pageY=0;while(swivelor.options.swivelSteps<=swivelor.options.maxSwivelStepsX){var loop_value=swivelor.options.swivelSteps;if(loop_value<=9&&loop_value>=0){loop_value="00"+loop_value;}else{if(loop_value<=100&&loop_value>=10){loop_value="0"+loop_value;}}if(swivelor.options.useSprite==true){swivelor.$swivelContentItems.append('<div index="'+swivelor.options.swivelSteps+'" id="swiveler-step-'+swivelor.options.swivelSteps+'" class="swivel-content-item" style="width: '+swivelor.options.stepWidthPixels+"px; height: "+swivelor.options.stepHeightPixels+'px;"><div style="width: '+swivelor.options.stepWidthPixels+"px; height: "+swivelor.$swivelContentItems.children().first().height()+"px; background-image: url(/media/images/swivel-images/"+swivelor.productID+"/z-"+swivelor.options.zAxis+"/y-000/"+swivelor.productID+"__x-sprite__y-000__z-"+swivelor.options.zAxis+".jpg); background-position: "+((swivelor.options.swivelSteps*swivelor.options.stepWidthPixels)*-1)+'px 0px; float: left; clear: none;"><span class="none">&nbsp;</span></div></div>');}else{swivelor.arrayOfImages.push("/media/images/swivel-images/"+swivelor.productID+"/z-"+swivelor.options.zAxis+"/y-000/"+swivelor.productID+"__x-"+loop_value+"__y-000__z-"+swivelor.options.zAxis+".jpg");swivelor.$swivelContentItems.append('<div index="'+swivelor.options.swivelSteps+'" id="swiveler-step-'+swivelor.options.swivelSteps+'" class="swivel-content-item "><img width='+swivelor.options.stepWidthPixels+' src="/media/images/swivel-images/'+swivelor.productID+"/z-"+swivelor.options.zAxis+"/y-000/"+swivelor.productID+"__x-"+loop_value+"__y-000__z-"+swivelor.options.zAxis+'.jpg"></div>');}swivelor.frames[swivelor.options.swivelSteps]="swiveler-step-"+swivelor.options.swivelSteps;swivelor.options.swivelSteps=swivelor.options.swivelSteps+swivelor.options.by;}if(swivelor.options.useSprite==true){swivelor.arrayOfImages.push("/media/images/swivel-images/"+swivelor.productID+"/z-"+swivelor.options.zAxis+"/y-000/"+swivelor.productID+"__x-sprite__y-000__z-"+swivelor.options.zAxis+".jpg");}swivelor.preload(swivelor.arrayOfImages);swivelor.$swivelContent.css({width:((((swivelor.options.maxSwivelStepsX+1)*swivelor.options.stepWidthPixels))+"px"),height:(swivelor.options.stepHeightPixels+"px")});swivelor.gotoPos(swivelor.validatePos([swivelor.options.currentStepX,swivelor.options.currentStepY],true));swivelor.$swivelContentItems.children().last().remove();if(swivelor.options.doIntro==true){swivelor.introSequence=swivelor.setUpSpinIntro();window.setTimeout(swivelor.playIntro,(swivelor.options.introDelay)+800);window.setTimeout(swivelor.setUpGrabbable,((swivelor.options.introDelay+800)+(swivelor.options.introDuration*5900)));
}else{swivelor.setUpGrabbable();}};window.FL=window.FL||{};FL.WishList=FL.WishList||{};FL.StorePickup=FL.StorePickup||{};FL.sizeChartDialog=FL.dialog.extend({postAjaxSuccess:function(){var chart=jQuery(".sizeChart").attr("chart");jQuery("#chart").find(".menu").find("div").click(FL.ProductDetail.SizeChart.displaySelected);FL.ProductDetail.SizeChart.display({chart:chart});}});FL.ProductDetail={DynamicCart:{howManyTimesTried:0,lastErrorReturned:null,messages:{confirm:["There was a problem adding your item to the cart.\nClick OK to refresh the page and try ","again, or contact customer service for assistance.\n\nCustomer Service: 1-888-777-3949\nOr ",'e-mail us by clicking "Customer Service" at the bottom of the page\n\nError Information:'].join("")}},SizeChart:{sizeCharts:null},SizeSelection:{},isUmap:false,maxUnitsPerOrder:null,onHand:[],prices:[],sizes:[],timers:{error:null,image:null},wfl:{attrFlag:false,sizeFlag:false},colors:{}};FL.ProductDetail.OriginalProduct={title:"",selectedColor:"",styleColor:"",sizes:"",pricing:"",cache:function(){FL.ProductDetail.OriginalProduct.title=jQuery("#title").html();FL.ProductDetail.OriginalProduct.selectedColor=jQuery("#selectedColor").html();FL.ProductDetail.OriginalProduct.styleColor=jQuery("#styleColor").html();FL.ProductDetail.OriginalProduct.sizes=jQuery("#sizeHolder").html();FL.ProductDetail.OriginalProduct.pricing=jQuery("#pricing").html();},restore:function(){jQuery("#title").html(FL.ProductDetail.OriginalProduct.title);jQuery("#selectedColor").html(FL.ProductDetail.OriginalProduct.selectedColor);jQuery("#colorTitle").html(FL.ProductDetail.OriginalProduct.selectedProduct);jQuery("#styleColor").html(FL.ProductDetail.OriginalProduct.styleColor);jQuery("#sizeHolder").html(FL.ProductDetail.OriginalProduct.sizes);jQuery("#pricing").html(FL.ProductDetail.OriginalProduct.pricing);}};FL.productDetails={init:function(){FL.ProductDetail.init();}};FL.ProductDetail.init=function(){FL.ProductDetail.loadColors();FL.ProductDetail.loadSelectedSize();FL.ProductDetail.addOnClickForTab();FL.ProductDetail.checkAddToCartDisable();FL.ProductDetail.loadSelectableForSizes();FL.ProductDetail.loadStoresAvailability();FL.ProductDetail.loadViewLargerImage();FL.WishList.loadFormSubmit();FL.ImageZoom.init({bg:"productImage",drag:"drag",greyed:"tint",zoom:"zoom"});FL.ProductDetail.checkDisplayForWFL();jQuery(".sizeChart").button().click(FL.ProductDetail.SizeChart.create);jQuery("#buttonAddToCart").click(FL.ProductDetail.addProductToDynamicCart);jQuery("#ispuButton").click(FL.ProductDetail.loadStoreLocatorPopup);};FL.ProductDetail.addAlternateView=function(options){var hideImageOver,key,smallPath;options=jQuery.extend({key:"",path:""},options);smallPath=ImageControls.convertToSmall(options.path);key={id:"view_"+options.key,selector:"#view_"+options.key};hideImageOver=function(){jQuery("#imageOver").hide();};reportProp16=function(prop16){var s=s_gi(scServerCode);s.linkTrackVars="prop16";s.prop16=prop16;s.tl(this,"o","Product Detail Alternate Images");};ImageControls.loadColorImage(options.path);jQuery("#alternateViewHolder").find("#altMouseOver").show().end().find("#alternateViews").append(['<img id="',key.id,'" src="',smallPath,'"/>'].join("")).find(key.selector).addClass("altImage").mouseover(function(){reportProp16("Image Hover-Over");clearTimeout(FL.ProductDetail.timers.image);jQuery("#imageOver").html(['<img id="imageOverImg" src="',ImageControls.convertToLarge(options.path),'"/>'].join("")).show();}).mouseout(function(){FL.ProductDetail.timers.image=setTimeout(hideImageOver,125);}).click(function(){reportProp16("Image Clicked On");FL.ProductDetail.switchAlternateView({path:options.path});});};FL.ProductDetail.addOnChangeForSkuSelection=function(){jQuery("#skuSelection").change(FL.ProductDetail.checkAvailability);};FL.ProductDetail.addOnClickForTab=function(){};FL.ProductDetail.addPrice=function(options){options=jQuery.extend({index:0,price:""},options);FL.ProductDetail.prices[options.index]=options.price;};FL.ProductDetail.addPriceForUmap=function(options){options=jQuery.extend({index:0,price:""},options);if(options.price.indexOf(",")>-1||options.price==="Sale"){FL.ProductDetail.isUmap=true;options.price="See Price In Cart";}else{FL.ProductDetail.isUmap=false;}FL.ProductDetail.prices[options.index]=options.price;};FL.ProductDetail.loadColors=function(){FL.ProductDetail.colors[FL.setup.selectedProduct.productId]=FL.setup.selectedProduct;FL.ProductDetail.colors[FL.setup.selectedProduct.productId].selectedId=FL.setup.selectedProduct.productId;jQuery.each(FL.ProductDetail.colors,function(productId,product){var options={selectedId:FL.setup.selectedProduct.productId,productId:product.productId,imageName:"thumb_"+product.styleId+product.colorId,imageSrc:"http://www.finishline.com"+product.thumbnail,imageAlt:"description",iterator:product.count};FL.ProductDetail.addProductColor(options);});};FL.ProductDetail.addProductColor=function(options){var hideImageOver,product;options=jQuery.extend({selectedId:"",productId:"",imageName:"",imageSrc:"",imageAlt:"",iterator:0},options);ImageControls.loadColorImage(options.imageSrc);hideImageOver=function(){jQuery("#imageOver").hide();};if(options.selectedId===options.productId){product=new CurrentProduct(options.productId);jQuery("#colorHolder").append(['<img id="',options.imageName,'" src="',options.imageSrc,'" alt="',options.imageAlt,'"/>'].join("")).find("#"+options.imageName).addClass("selectedProduct");}else{product=new AlternateProduct(options.productId,options.iterator);jQuery("#colorHolder").append(['<img id="',options.imageName,'" src="',options.imageSrc,'" alt="',options.imageAlt,'"/>'].join("")).find("#"+options.imageName).click(function(){window.location="/store/catalog/product.jsp?productId="+options.productId;}).mouseover(function(){jQuery("#"+options.imageName).removeClass().addClass("hoverOver");clearTimeout(FL.ProductDetail.timers.image);jQuery("#imageOver").html(['<img id="imageOverImg" src="',ImageControls.convertToLarge(options.imageSrc),'"/>'].join("")).show();jQuery("#selectedColor").html(options.imageAlt);FL.ProductDetail.displayProductInfo({iterator:options.iterator});}).mouseout(function(){jQuery("#"+options.imageName).removeClass();FL.ProductDetail.timers.image=setTimeout(hideImageOver,125);FL.ProductDetail.displayProductInfo();});}};FL.ProductDetail.addProductSize=function(options){options=jQuery.extend({index:0,skuId:""},options);FL.ProductDetail.sizes[options.index]=options.skuId;};FL.ProductDetail.addProductToDynamicCart=function(){var errorCodes=[];errorCodes["-1000"]="Order amount exceeds available inventory.  Please reduce the requested quantity.";errorCodes["-2000"]=["You have exceeded the maximum number of items allowed ","per customer.  Please reduce the requested quantity."].join("");errorCodes["-3000"]="You have selected an item that is out of stock.  Please select another item.";errorCodes["-4000"]="You have selected an invalid quantity.  Please change the requested quantity.";errorCodes["default"]="An error has occurred.  Please try again.";FL.ProductDetail.DynamicCart.howManyTimesTried++;if(FL.ProductDetail.DynamicCart.howManyTimesTried<=3){jQuery("#buttonAddToCart").attr("disabled","disabled").css({opacity:0.5});var _thisProdID=jQuery("#productId").val();jQuery.ajax({data:{skuSelection:jQuery("#skuSelection").val(),productId:jQuery("#productId").val(),fromCategoryId:jQuery("#fromCategoryId").val(),quantity:jQuery("#quantity").val()},type:"GET",dataType:"json",url:"/store/global/fragments/addItemToDynamicCart.jsp",success:function(data,textStatus,jqXHR){var description="",errorStackLength,i,popup;FL.recommendations.sendCustomEvent(_thisProdID,"shopping+cart");if(data.addToCart.return_code>-1){window.setTimeout(FL.ProductDetail.resetAddToCartButton,1500);FL.DynamicCart.siteCatalystAddToCart(jQuery("#productId").val(),jQuery("#quantity").val());FL.DynamicCart.displayNewProduct(data.dynamicCart,jQuery("#productId").val(),jQuery("#skuSelection").val());}else{errorStackLength=data.addToCart.error_stack.length;for(i=0;i<errorStackLength;i++){try{description+=errorCodes[data.addToCart.error_stack[i].error_code];}catch(e){description+=errorCodes["default"];}}popup=new FL.dialog("addtocart_error",{content:description},{height:200,title:"Add to Cart Error",width:300});FL.WishList.disableProductDetailButton();window.setTimeout(FL.ProductDetail.resetAddToCartButton,1500);}},error:function(jqXHR,textStatus,errorThrown){FL.ProductDetail.DynamicCart.lastErrorReturned={"errorThrown":errorThrown,"textStatus":textStatus};FL.ProductDetail.addProductToDynamicCart();}});}else{if(confirm([FL.ProductDetail.DynamicCart.messages.confirm,FL.ProductDetail.DynamicCart.lastErrorReturned.textStatus," ",FL.ProductDetail.DynamicCart.lastErrorReturned.errorThrown].join(""))){location.reload(true);}else{FL.ProductDetail.resetAddToCartButton();FL.ProductDetail.DynamicCart.howManyTimesTried=0;}}return false;};FL.ProductDetail.addSize=function(options){var isShoe,sizesHTML;options=jQuery.extend({available:true,skuId:"",text:""},options);options.text=FL.ProductDetail.checkText({text:options.text});isShoe=(!isNaN(parseFloat(options.text))&&isFinite(options.text));sizesHTML=['<div itemprop="size" class="',(isShoe?"shoesizes":"apparelsizes")," ",(options.available?"sizeBox":"sizeBoxUnavailable"),'" data-isapparel="',(!isShoe),'" id="',"size_"+options.skuId,'" skuId="',options.skuId,'">',options.text,"</div>"].join("");jQuery("#sizes").append(sizesHTML);};FL.ProductDetail.checkAddToCartDisable=function(){if(FL.ProductDetail.sizes.length>1){FL.ProductDetail.disableAddToCart();FL.WishList.disableProductDetailButton();}};FL.ProductDetail.checkAvailability=function(){var inventoryQuantity,popup,skuIndex;try{if(jQuery("#skuSelection").length>0){FL.ProductDetail.updateAvailabilityPrice({price:FL.ProductDetail.prices[0]});skuIndex=jQuery.inArray(jQuery("#skuSelection").val(),FL.ProductDetail.sizes);inventoryQuantity=decode64(FL.ProductDetail.onHand[skuIndex]);FL.ProductDetail.updateQuantitySelect({quantity:inventoryQuantity});FL.ProductDetail.updateAvailabilityText({quantity:inventoryQuantity});FL.WishList.updateProductDetailSkuId();if(parseInt(jQuery("#quantity").val(),10)>parseInt(inventoryQuantity,10)){popup=new FL.dialog("dialog_inventory",{content:"Order amount exceeds available inventory.  Please reduce the requested quantity."},{height:130,title:"Quantity Not Available",width:300});}FL.ProductDetail.enableAddToCart();if(FL.ProductDetail.wfl.attrFlag===true){FL.WishList.disableProductDetailButton();}else{FL.WishList.enableProductDetailButton();}}}catch(e){}finally{return true;}};FL.ProductDetail.checkDisplayForWFL=function(){if(FL.ProductDetail.wfl.attrFlag===true){jQuery("#instoreExcTxt").show();jQuery("#addToCart").hide();jQuery("#quantitySelection").hide();}};FL.ProductDetail.checkText=function(options){options=jQuery.extend({text:""},options);return options.text.toUpperCase()==="NO"?"none":options.text;};FL.ProductDetail.disableAddToCart=function(){jQuery("#buttonAddToCart").addClass("turnOff");if(jQuery("#addToCartDisabled").length===0){jQuery("#addToCart").append(['<div id="addToCartDisabled">','<img id="buttonAddToCartDisabled" ','src="/media/images/product-details/add-to-cart.off_183x29.png"/>',"</div>"].join(""));}jQuery("#seePriceInCartLink").hide();jQuery("#addToCartImgDisabled").unbind("click").click(FL.ProductDetail.displaySelectSizeError);};FL.ProductDetail.displayLargerViewPopup=function(options){var imageHTML,popup;options=jQuery.extend({image:""},options);imageHTML=['<img src="',ImageControls.convertToExtraLarge(options.image),'"/>'].join("");popup=new FL.dialog("largerview",{content:imageHTML},{height:610,title:"Larger View",width:580});};FL.ProductDetail.displayPrice=function(){var priceHTML,price,prices;if(FL.ProductDetail.prices.length<=0){FL.ProductDetail.prices[0]="Sold Out";}price=FL.ProductDetail.prices[0];if(price.indexOf(",")===-1){priceHTML=['<strong><span itemprop="price" id="price">',price,"</span></strong>"].join("");}else{prices={first:Number(price.substring(1,price.indexOf(","))),second:Number(price.substring(price.indexOf(",")+2)),nowPrice:"",wasPrice:""};if(prices.first<prices.second){prices.nowPrice=["$",prices.first.toFixed(2)].join("");prices.wasPrice=["$",prices.second.toFixed(2)].join("");}else{prices.nowPrice=["$",prices.second.toFixed(2)].join("");prices.wasPrice=["$",prices.first.toFixed(2)].join("");}priceHTML=['<strike><span id="wasPrice">',prices.wasPrice,"</span></strike> ",'<strong><span itemprop="price" id="nowPrice">',prices.nowPrice,"</span></strong> "].join("");}jQuery("#pricing").html(priceHTML);jQuery("#skuSelection").change(FL.ProductDetail.checkAvailability);};FL.ProductDetail.displayPriceForUmap=function(){var priceId,price;if(FL.ProductDetail.prices.length>0){price=FL.ProductDetail.prices[0];if(price==="See Price In Cart"){priceId="nowPrice";}else{priceId="price";}jQuery("#pricing").html(['<span itemprop="price" id="',priceId,'">',price,"</span>"].join(""));}jQuery("#skuSelection").change(FL.ProductDetail.checkAvailability);};FL.ProductDetail.displayProductInfo=function(options){var i,product,productDetail,price,sizes=[],skuLength,available,hasWasPrice,isShoe=false;options=jQuery.extend({iterator:null},options);if(!FL.ProductDetail.OriginalProduct.title||FL.ProductDetail.OriginalProduct.title===jQuery("#title").html()){FL.ProductDetail.OriginalProduct.cache();}product=options.iterator===null?currentColor:alternateColors[options.iterator];hasWasPrice=(typeof product.wasPrice!=undefined&&product.wasPrice!==null&&product.wasPrice!=="");if(product.nowPrice==="no-sale"){product.nowPrice="Sold Out";}if(product.wasPrice==="no-sale"){product.wasPrice="Sold Out";}price={now:['<span itemprop="price" id="',!hasWasPrice?"price":"nowPrice",'">',product.nowPrice,"</span>"].join(""),was:!hasWasPrice?"":['<span id="wasPrice">',product.wasPrice,"</span>"].join(""),umapMsg:"See Price In Cart",display:""};price.display=price.now.match(price.umapMsg)?price.umapMsg:[price.was,price.now].join("");skuLength=product.skus.length;if(!isNaN(parseFloat(product.skus[0].size))&&isFinite(product.skus[0].size)){isShoe=true;}for(i=0;i<skuLength;i++){if(product.instoreOnly!=="In-Store Exclusive"&&product.skuAvailable[i]==="true"){available="true";}else{available="false";}sizes[i]=['<div class="',(isShoe?"shoesizes ":"apparelsizes "),'sizeBox" id="size_',i,'" available="',available,'" skuId="',product.getSizeSku(i),'">',product.getSizeText(i),"</div>"].join("");}$productDetail=jQuery("#productDetail");$productDetail.find("#sizeDimmer").css({display:options.iterator===null?"none":"block"}).end().find("#sizeHolder").css({display:options.iterator===null?"block":"none"}).end().find("#title").html(product.name).end().find("#styleColor").html([product.styleId," ",product.colorId].join("")).end().find("#selectedColor").html(product.colorDescription).end().find("#colorTitle").html(product.colorDescription).end().find("#sizeDimmer").find(".sizes").html(sizes.join("")).find('div[available="false"]').addClass("sizeBoxUnavailable").end().find("#size").css({display:"inline"}).end();$productDetail.find("#pricing").html(price.display);if(product.instoreOnly!=="In-Store Exclusive"){$productDetail.find("#instoreExcTxt").hide().end().find("#addToCart").show().end().find("#quantity").removeAttr("disabled");}else{$productDetail.find("#instoreExcTxt").show().end().find("#addToCart").hide().end().find("#quantity").attr("disabled","disabled");}};FL.ProductDetail.displaySelectSizeError=function(){jQuery("#errorSelectSizeCart").show();jQuery("#errorSelectSize").show();FL.ProductDetail.timers.error=setTimeout(FL.ProductDetail.hideSelectSizeError,5000);};FL.ProductDetail.enableAddToCart=function(){jQuery("#buttonAddToCart").removeClass("turnOff");jQuery("#addToCart").find("#addToCartDisabled").remove();if(FL.ProductDetail.isUmap!==null&&FL.ProductDetail.isUmap===true){jQuery("#seePriceInCartLink").show();}};FL.ProductDetail.hideSelectSizeError=function(){clearTimeout(FL.ProductDetail.timers.error);
jQuery("#errorSelectSizeCart").hide();jQuery("#errorSelectSize").hide();};FL.ProductDetail.loadSelectableForSizes=function(){var availableSizes=jQuery("#sizeHolder").find(".sizeBox"),unavailableSizes=jQuery("#sizeHolder").find(".sizeBoxUnavailable");jQuery(availableSizes).each(function(){FL.ProductDetail.SizeSelection.applyAvailable({object:jQuery(this)});});jQuery(unavailableSizes).each(function(){FL.ProductDetail.SizeSelection.applyUnavailable({object:jQuery(this)});});if(jQuery(availableSizes).length===1){FL.ProductDetail.SizeSelection.selectOnlySize({object:jQuery(availableSizes)});}};FL.ProductDetail.loadSelectedSize=function(){jQuery("#skuSelection").val("");};FL.ProductDetail.loadStoresAvailability=function(){FL.StorePickup.initialize();};FL.ProductDetail.loadStoreLocatorPopup=function(){var s=s_gi(scServerCode),popup;s.linkTrackVars="events";s.linkTrackEvents="event10";s.events="event10";s.tl(this,"o","SelectStores");popup=new FL.dialog("storelocator",{ajax:true,async:false,trigger:"-storeLocator",url:"/store/storelocator/fragments/ispu_body.jsp"},{close:function(event,ui){FL.ProductDetail.loadStoresAvailability();},height:500,title:"In-Store Pickup",width:1060});FL.storeLocator();return false;};FL.ProductDetail.loadViewLargerImage=function(){var html='<a id="productDetailsViewLargeImage" href="'+jQuery("#largeImagePopup").find("img").attr("src")+'">View Large Image</a>',viewLink;viewLink=function(){FL.ProductDetail.displayLargerViewPopup({image:jQuery("#largeImagePopup").find("img").attr("src")});return false;};jQuery("#viewOptions").prepend(html).find("#productDetailsViewLargeImage").click(viewLink);};FL.ProductDetail.resetAddToCartButton=function(){jQuery("#buttonAddToCart").removeAttr("disabled").css({opacity:1});};FL.ProductDetail.switchAlternateView=function(options){var selectors,updateViewLink;options=jQuery.extend({path:""},options);selectors={dragImage:"#dragImg",productImage:"#productImage",viewLink:"#productDetailsViewLargeImage",zoomImage:"#zoomImg"};updateViewLink=function(){FL.ProductDetail.displayLargerViewPopup({image:options.path});return false;};jQuery(selectors.productImage).attr("src",options.path);jQuery(selectors.dragImage).attr("src",options.path);jQuery(selectors.zoomImage).attr("src",ImageControls.convertToExtraLarge(options.path));jQuery(selectors.viewLink).unbind("click").click(updateViewLink);};FL.ProductDetail.updateAvailabilityPrice=function(options){var html,nowPrice,wasPrice;options=jQuery.extend({price:""},options);if(typeof FL.ProductDetail.isUmap!==undefined&&FL.ProductDetail.isUmap){html=' <span itemprop="price" id="nowPrice">See Price In Cart</span>';}else{if(options.price.indexOf(",")===-1){html=[' <span itemprop="price" id="price">',options.price,"</span>"].join("");}else{nowPrice=options.price.substring(0,options.price.indexOf(","));wasPrice=options.price.substring(options.price.indexOf(",")+1);html=[' <span id="wasPrice">',wasPrice,'</span> <span itemprop="price" id="nowPrice">',nowPrice,"</span> "].join("");}}jQuery("#pricing").html(html);};FL.ProductDetail.updateAvailabilityText=function(options){var messages,returnMessage;options=jQuery.extend({quantity:0},options);messages={selectSize:"Please select a size",lowQuantity:"Leaves warehouse in 3-5 business days*",mediumQuantity:"Leaves warehouse in 2-4 business days*",highQuantity:"Leaves warehouse in 1-2 business days*"};if(jQuery("#skuSelection").val()===""){returnMessage=messages.selectSize;}else{if(options.quantity>=1&&options.quantity<=30){returnMessage=messages.lowQuantity;}else{if(options.quantity>30&&options.quantity<=75){returnMessage=messages.mediumQuantity;}else{if(options.quantity>75){returnMessage=messages.highQuantity;}}}}jQuery("#availability").html(returnMessage);};FL.ProductDetail.updateQuantitySelect=function(options){var i,quantityLength,selectedValue,selectOptions;options=jQuery.extend({quantity:0},options);selectOptions=[];quantityLength=parseInt(options.quantity,10)>parseInt(FL.ProductDetail.maxUnitsPerOrder,10)?FL.ProductDetail.maxUnitsPerOrder:options.quantity;selectedValue=jQuery("#quantity").val();selectedValue=parseInt(selectedValue,10)>parseInt(quantityLength,10)?quantityLength:selectedValue;for(i=1;i<=quantityLength;i++){selectOptions.push(['<option value="',i,'">',i,"</option>"].join(""));}jQuery("#quantity").find("options").remove().end().html(selectOptions.join("")).find('option[value="'+selectedValue+'"]').attr("selected",true);};FL.ProductDetail.SizeChart.create=function(){var popup=new FL.sizeChartDialog("chart",{ajax:true,async:false,url:"/store/catalog/fragments/sizeChart.jsp"},{height:410,title:"Size Charts",width:750});};FL.ProductDetail.SizeChart.display=function(options){options=jQuery.extend({chart:""},options);jQuery("#chart_"+options.chart).removeClass("hidden");};FL.ProductDetail.SizeChart.displaySelected=function(){var chart=jQuery(this).data("chart");jQuery("#chart").find(".chart").addClass("hidden").end().find("#chart_"+chart).removeClass("hidden");};FL.ProductDetail.SizeSelection.applyAvailable=function(options){options=jQuery.extend({object:null},options);if(options.object!==null){jQuery(options.object).mouseover(FL.ProductDetail.SizeSelection.mouseoverAvailable).mouseout(FL.ProductDetail.SizeSelection.mouseoutAvailable).click(FL.ProductDetail.SizeSelection.clickAvailable);}};FL.ProductDetail.SizeSelection.applyUnavailable=function(options){options=jQuery.extend({object:null},options);if(options.object!==null){jQuery(options.object).mouseover(FL.ProductDetail.SizeSelection.mouseoverUnavailable).mouseout(FL.ProductDetail.SizeSelection.mouseoutUnavailable);}};FL.ProductDetail.SizeSelection.clickAvailable=function(){if(jQuery(this).attr("skuId")!==jQuery("#skuSelection").val()){jQuery("#sizeHolder").find(".sizeBoxSelected").removeClass("sizeBoxSelected hoverOver").addClass("sizeBox");jQuery("#size").html(jQuery(this).text());jQuery("#skuSelection").val(jQuery(this).attr("skuId"));jQuery(this).removeClass("hoverOver").addClass("sizeBoxSelected");FL.ProductDetail.loadStoresAvailability();FL.ProductDetail.checkAvailability();}};FL.ProductDetail.SizeSelection.mouseoutAvailable=function(){if(jQuery(this).attr("skuId")!==jQuery("#skuSelection").val()){jQuery(this).removeClass("hoverOver");}};FL.ProductDetail.SizeSelection.mouseoverAvailable=function(){if(jQuery(this).attr("skuId")!==jQuery("#skuSelection").val()){jQuery(this).addClass("hoverOver");}};FL.ProductDetail.SizeSelection.mouseoutUnavailable=function(){jQuery("#errorSizeUnavailable").hide();};FL.ProductDetail.SizeSelection.mouseoverUnavailable=function(){jQuery("#errorSizeUnavailable").show();};FL.ProductDetail.SizeSelection.selectOnlySize=function(options){options=jQuery.extend({object:null},options);if(options.object!==null){jQuery(options.object).click();}};FL.StorePickup.data={productId:null,quantity:null,skuSelection:null,storeCookie:null};FL.StorePickup.wfl={};FL.StorePickup.initialize=function(){FL.StorePickup.data.storeCookie=jQuery.readCookie("fl_favorite_stores");if(jQuery("#instore_stores").length>0){FL.StorePickup.data.productId=jQuery("#productId").val();if(FL.StorePickup.data.storeCookie===null||FL.StorePickup.data.storeCookie===""){FL.StorePickup.wfl.disableSizes();FL.StorePickup.loadIntro();return;}if(jQuery("#skuSelection").length>0){if(jQuery("#skuSelection").val()!==null&&typeof(jQuery("#skuSelection")!=="undefined")){FL.StorePickup.data.skuSelection=jQuery("#skuSelection").val();}else{FL.StorePickup.data.skuSelection="";}if(FL.StorePickup.data.skuSelection.indexOf("java.lang.String")>-1){FL.StorePickup.data.skuSelection="";}FL.StorePickup.wfl.enableSizes();}else{jQuery("#instore_stores").html("");return;}if(jQuery("#quantity").length>0&&!isNaN(jQuery("#quantity").val())&&jQuery("#quantity").val()>0){FL.StorePickup.data.quantity=jQuery("#quantity").val();}else{jQuery("#instore_stores").html("");jQuery("#selectStore").html("");return;}jQuery("#instore_stores").html('<div id="ispuLoading"><img src="/store/images/loading_sm.gif"/></div>');jQuery.ajax({data:{productId:FL.StorePickup.data.productId,quantity:FL.StorePickup.data.quantity,skuId:FL.StorePickup.data.skuSelection},dataType:"xml",type:"GET",url:"/store/catalog/fragments/store_availability.jsp",success:function(xml,textStatus,jqXHR){var availableText,store,stores=[];jQuery(xml).find("stores").find("store").each(function(index){availableText=FL.StorePickup.data.skuSelection===""?"Select Size":jQuery(this).find("available").text()==="true"?"Available":"Unavailable";store={name:jQuery(this).find("name").text(),available:availableText,availableClass:jQuery(this).find("available").text()==="true"?"available":"unavailable",id:"store_"+index,nameId:"storeName_"+index};stores[index]=['<div id="',store.id,'" class="store ',store.availableClass,'">','<div class="name">',store.name,"</div>","<div>",store.available,"</div>","</div>"].join("");});jQuery("#instore_stores").html(stores.join(""));}});}};FL.StorePickup.loadIntro=function(){jQuery("#instore_stores").html(['<div id="ispuIcon" class="icon">','<img src="/media/images/icons/ispu.png" alt="InStore Pickup"/>',"</div>",'<div id="ispuText" class="text"></div>'].join(""));};FL.StorePickup.wfl.disableSizes=function(){if(FL.ProductDetail.wfl.attrFlag===true&&FL.ProductDetail.wfl.sizeFlag===false){jQuery.ajax({data:{productId:FL.StorePickup.data.productId},dataType:"xml",type:"GET",url:"/store/results/fragments/productLookupXML.jsp",success:function(xml,textStatus,jqXHR){var i,product=new Product(jQuery(xml).find("product")[0]),skuLength;skuLength=product.skus.length;for(i=0;i<skuLength;i++){FL.ProductDetail.addSize({availabile:false,skuId:product.getSizeSku(i),text:product.getSizeText(i)});}}});}};FL.StorePickup.wfl.enableSizes=function(){if(FL.ProductDetail.wfl.attrFlag===true&&FL.ProductDetail.wfl.sizeFlag===true){jQuery.ajax({data:{productId:FL.StorePickup.data.productId},dataType:"xml",type:"GET",url:"/store/results/fragments/productLookupXMl.jsp",success:function(xml,textStatus,jqXHR){var i,product=new Product(jQuery(xml).find("product")[0]),skuLength;skuLength=product.skus.length;for(i=0;i<skuLength;i++){if(product.skuAvailable[i]==="false"){FL.ProductDetail.addSize({availabile:false,skuId:product.getSizeSku(i),text:product.getSizeText(i)});}else{FL.ProductDetail.addSize({skuId:product.getSizeSku(i),text:product.getSizeText(i)});}}}});FL.ProductDetail.wfl.sizeFlag=false;}};FL.WishList.disableProductDetailButton=function(){jQuery("#addToWishlistButtonHolder").hide();};FL.WishList.enableProductDetailButton=function(){jQuery("#addToWishlistButtonHolder").show();};FL.WishList.loadFormSubmit=function(){var submitForm;submitForm=function(){jQuery("#addToWishListForm").find("#button_addtowishlist").click();};jQuery("#addToWishlistButtonHolder").click(submitForm);};FL.WishList.updateProductDetailSkuId=function(){jQuery("#giftAtgSkuSelectionId").val(jQuery("#skuSelection").val());};FL.ImageZoom={init:function(s){var bgPos,dragWidth,dragHeight,zoomWidth,zoomHeight;this.enableZoom=true;this.imgHolder=jQuery("#"+s.drag+"Layer");this.background=jQuery("#"+s.bg+"Holder");this.tint=jQuery("#"+s.greyed);this.dragBox=jQuery("#"+s.drag+"Box");this.zoomBox=jQuery("#"+s.zoom+"Layer");this.bgImg=jQuery("#"+s.bg);this.dragImg=jQuery("#"+s.drag+"Img");this.zoomImg=jQuery("#"+s.zoom+"Img");this.quantity=jQuery("#quantity");dragWidth=jQuery(this.background).width()-jQuery(this.dragBox).width();dragHeight=jQuery(this.background).height()-jQuery(this.dragBox).height();zoomWidth=jQuery(this.zoomImg).width()-jQuery(this.zoomBox).width();zoomHeight=jQuery(this.zoomImg).height()-jQuery(this.zoomBox).height();this.widthScale=Math.abs(zoomWidth/dragWidth);this.heightScale=Math.abs(zoomHeight/dragHeight);this.halfWidth=jQuery(this.dragBox).width()/2;this.halfHeight=jQuery(this.dragBox).height()/2;bgPos=jQuery(this.background).offset();this.boundBox={left:bgPos.left,top:bgPos.top,right:bgPos.left+255,btm:bgPos.top+255};this.dragBound={left:0,right:jQuery(this.tint).width()-2*this.halfWidth,top:0,btm:jQuery(this.tint).height()-2*this.halfHeight};this.zoomBox.css({border:"1px solid rgb(120,120,120)",boxShadow:" rgba(0, 0, 0, 0.8) 0px 8px 23px ",left:"383px",top:(25)+"px"});jQuery(this.tint).mouseenter(this.mouseOverHandler);jQuery(this.dragBox).mouseenter(this.mouseOverHandler);jQuery(this.dragBox).mouseleave(this.mouseOutHandler);},mouseMoveHandler:function(e){var x,y,left,top,pointerXCheck,pointerYCheck;x=e.pageX-FL.ImageZoom.halfWidth-FL.ImageZoom.boundBox.left;y=e.pageY-FL.ImageZoom.halfHeight-FL.ImageZoom.boundBox.top;left=x>FL.ImageZoom.dragBound.right?FL.ImageZoom.dragBound.right:x<FL.ImageZoom.dragBound.left?0:x;top=y>FL.ImageZoom.dragBound.btm?FL.ImageZoom.dragBound.btm:y<FL.ImageZoom.dragBound.top?0:y;jQuery(FL.ImageZoom.dragBox).css({left:left+"px",top:top+"px"});jQuery(FL.ImageZoom.dragImg).css({left:(-left-1)+"px",top:(-top)+"px"});jQuery(FL.ImageZoom.zoomImg).css({left:(-left*FL.ImageZoom.widthScale)+"px",top:(-top*FL.ImageZoom.heightScale)+"px"});pointerXCheck=e.pageX-FL.ImageZoom.boundBox.left;pointerYCheck=e.pageY-FL.ImageZoom.boundBox.top;if(pointerXCheck>255||pointerXCheck<0||pointerYCheck>255||pointerYCheck<0){FL.ImageZoom.mouseOutHandler(e);}},mouseOutHandler:function(e){if(!FL.ImageZoom.enableZoom){jQuery(FL.ImageZoom.tint).unbind("mouseleave",FL.ImageZoom.mouseOutHandler);}jQuery("body").unbind("mousemove",FL.ImageZoom.mouseMoveHandler);jQuery(FL.ImageZoom.dragBox).css({visibility:"hidden"});jQuery(FL.ImageZoom.zoomBox).stop().fadeTo(125,0,function(){$(this).css({visibility:"hidden"}).css("z-index","-10");});jQuery(FL.ImageZoom.tint).css({opacity:"0"});},mouseOverHandler:function(e){if(!FL.ImageZoom.enableZoom){jQuery(FL.ImageZoom.tint).mouseleave(FL.ImageZoom.mouseOutHandler);}jQuery("body").mousemove(FL.ImageZoom.mouseMoveHandler);jQuery(FL.ImageZoom.dragBox).css({visibility:"visible"});jQuery(FL.ImageZoom.zoomBox).stop().css("z-index","5000").css({visibility:"visible"}).fadeTo(225,1);jQuery(FL.ImageZoom.tint).css({opacity:0.5});}};window.FL=window.FL||{};FL.StoreLocator=FL.StoreLocator||{};FL.storeLocator=function(){var script=document.createElement("script");script.src=FL.StoreLocator.googleApiLink;script.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(script);};FL.StoreLocator.googleApiLink=["http://www.google.com/jsapi?key=ABQIAAAA-mbNMUlrO3jC0rofxKs","VxRSNaHE7oSZGFVNxlJtpziEKU7KnqRTDxnDoLlzLliFvVFAgTIT3ffxLxw","&callback=FL.StoreLocator.loadMaps"].join("");FL.StoreLocator.cityOnBlur=function(){Form.adjustDefaultText(this,"","City");};FL.StoreLocator.cityOnFocus=function(){Form.adjustDefaultText(this,"City","");};FL.StoreLocator.loadMaps=function(){google.load("maps","2",{"callback":FL.StoreLocator.mapLoaded});};FL.StoreLocator.mapLoaded=function(){var storeLocator=new StoreLocator(),$parameters=jQuery("#storelocator_parameters"),params,checkClickOnLoad;storeLocator.displayFavoriteStores();params={zipcode:$parameters.find("#param_zipcode").val()===""?"Enter ZIP Code":$parameters.find("#param_zipcode").val(),city:$parameters.find("#param_city").val()===""?"City":$parameters.find("#param_city").val(),state:$parameters.find("#param_state").val(),miles:$parameters.find("#param_miles").val()};checkClickOnLoad=function(){var clickOnLoad=false;if(params.zipcode!==""&&params.zipcode!=="Enter ZIP Code"){clickOnLoad=true;}else{if((params.city!==""&&params.city!=="City")&&(params.state!==""&&params.state!=="-")){clickOnLoad=true;}}if(clickOnLoad){storeLocator.displayMap();}};jQuery("#ispu").find("#button_locatestore").click(function(){storeLocator.displayMap();return false;}).end().find("#zipcode").val(params.zipcode).focus(FL.StoreLocator.zipcodeOnFocus).blur(FL.StoreLocator.zipcodeOnBlur).end().find("#city").val(params.city).focus(FL.StoreLocator.cityOnFocus).blur(FL.StoreLocator.cityOnBlur).end().find("#state").val(params.state).end().find("#miles").val(params.miles);checkClickOnLoad();};FL.StoreLocator.zipcodeOnBlur=function(){Form.adjustDefaultText(this,"","Enter ZIP Code");
};FL.StoreLocator.zipcodeOnFocus=function(){Form.adjustDefaultText(this,"Enter ZIP Code","");};window.FL=window.FL||{};FL.myaccount=FL.myaccount||{};FL.myaccount.register=FL.myaccount.register||{};FL.myaccount.personalprofile=FL.myaccount.personalprofile||{};FL.myaccount.preferences=FL.myaccount.preferences||{};FL.myaccount.signin=FL.myaccount.signin||{};FL.myaccount.forgotpassword=FL.myaccount.forgotpassword||{};FL.myaccount.register=jQuery.extend(true,{form:{ignoreKeys:[8,9,16,17,18,19,20,27,33,34,35,36,37,38,39,40,45,46,144,145],birthdayDayBlur:function(){validateNumbers(this,1,31);},birthdayMonthBlur:function(){validateNumbers(this,1,12);},birthdayYearBlur:function(){var dataLabel=jQuery(this).parent("div").find("#label_dobmo"),yearStart=dataLabel.data("years").start,yearCurrent=dataLabel.data("years").current;validateNumbers(this,yearStart,yearCurrent);}},init:function(){var regForm=jQuery("#registerForm"),submitBtn=jQuery("#Continue"),validator=regForm.find("#dobmo").blur(FL.myaccount.register.form.birthdayMonthBlur).keyup({target:"#dobday"},FL.Autotab.apply).end().find("#dobday").blur(FL.myaccount.register.form.birthdayDayBlur).keyup({target:"#dobyr"},FL.Autotab.apply).end().find("#dobyr").blur(FL.myaccount.register.form.birthdayYearBlur).end().validate({errorClass:"errorMessage",errorElement:"div",errorPlacement:function(error,element){if(!element.parent("div").find("div.errorMessage").length){error.appendTo(element.parent("div"));}},onsubmit:false});FL.PhoneMask.init("#phone");FL.PhoneMask.init("#cellPhone");jQuery("#firstname").focus();regForm.live("submit",function(e){if(regForm.valid()){var submitWrap=submitBtn.parent();submitWrap.prev().hide();submitWrap.hide();$("#registerPleaseWait").show();}else{validator.focusInvalid();e.preventDefault();return false;}});}},FL.myaccount.register);FL.myaccount.personalprofile=jQuery.extend(true,{init:function(){FL.PhoneMask.init("#phone");FL.PhoneMask.init("#cellPhone");}},FL.myaccount.personalprofile);FL.myaccount.preferences=jQuery.extend(true,{form:{submit:function(e){if(jQuery("#preferencesForm").valid()){jQuery("#Continue").parent().prev().hide().end().hide();jQuery("#registerPleaseWait").show();}else{validator.focusInvalid();e.preventDefault();return false;}}},init:function(){jQuery("#preferencesForm").live("submit",FL.myaccount.preferences.form.submit).validate({errorClass:"errorMessage",errorElement:"div",onsubmit:false});}},FL.myaccount.preferences);FL.myaccount.signin=jQuery.extend(true,{init:function(){jQuery("#signinEmail").focus();}},FL.myaccount.signin);FL.myaccount.forgotpassword=jQuery.extend(true,{init:function(){jQuery("#forgotPasswordEmail").focus();}},FL.myaccount.forgotpassword);window.FL=window.FL||{};FL.myaccount=FL.myaccount||{};FL.myaccount.wc_main=FL.myaccount.wc_main||{};FL.myaccount.wc_main=jQuery.extend(true,{form:{winnersCircleNumberBlur:function(){checkValueOnBlur(this);},winnersCircleNumberFocus:function(){checkValueOnFocus(this);}},validation:{rules:{email:{email:true,required:true},password:{required:true},winnersCircleNumber:{digits:true,maxlength:8,minlength:8,required:true}},messages:{email:{email:"Please enter a valid email address",required:"Please enter a valid email address"},password:{required:"Password is required"},winnersCircleNumber:{digits:"Winner's Circle Number must be numbers only",maxlength:"Winner's Circle Number must be {0} digits long",minlength:"Winner's Circle Number must be {0} digits long",required:"Please enter a valid Winner's Circle Number"}}},init:function(){jQuery("#wcAddNumberForm").find('input[name="winnersCircleNumber"]').blur(FL.myaccount.wc_main.form.winnersCircleNumberBlur).focus(FL.myaccount.wc_main.form.winnersCircleNumberFocus).end().validate({rules:{winnersCircleNumber:FL.myaccount.wc_main.validation.rules.winnersCircleNumber},messages:{winnersCircleNumber:FL.myaccount.wc_main.validation.messages.winnersCircleNumber},errorPlacement:function(error,element){jQuery(element).parents("form").append(error);}});jQuery("#wcCheckBalanceForm").find('input[name="wcBalanceInput"]').blur(FL.myaccount.wc_main.form.winnersCircleNumberBlur).focus(FL.myaccount.wc_main.form.winnersCircleNumberFocus).end().validate({rules:{wcBalanceInput:FL.myaccount.wc_main.validation.rules.winnersCircleNumber},messages:{wcBalanceInput:FL.myaccount.wc_main.validation.messages.winnersCircleNumber},errorElement:"div",errorPlacement:function(error,element){jQuery(element).parents("form").prepend(error);}});jQuery("#loginForm").validate({rules:{email:FL.myaccount.wc_main.validation.rules.email,password:FL.myaccount.wc_main.validation.rules.password},messages:{email:FL.myaccount.wc_main.validation.messages.email,password:FL.myaccount.wc_main.validation.messages.password},errorElement:"div",errorPlacement:function(error,element){$form=jQuery(element).parents("form");if(!$form.find(".errorList").length){$form.prepend('<div class="errorList"></div>');}$form.find(".errorList").append(error);}});}},FL.myaccount.wc_main);window.FL=window.FL||{};FL.customerservice=FL.customerservice||{};FL.customerservice.contactus=FL.customerservice.contactus||{};FL.customerservice.contactus=jQuery.extend(true,{init:function(){jQuery("#contactusName").focus();}},FL.customerservice.contactus);window.FL=window.FL||{};FL.checkout=FL.checkout||{};FL.checkout=jQuery.extend(true,{$errorBox:{},init:function(){},showPleaseWait:function(options){options=jQuery.extend({message:"please wait"},options);},hidePleaseWait:function(){},showError:function(options){var popupHTML;options=jQuery.extend({boxTitle:"Error",messageTitle:"We&rsquo;re sorry!",message:"An error occured. Please try again",appendCustomerServiceInfo:true,customerServiceInfo:" or contact a customer service representative for futher assistance.  <p><strong>Customer Service</strong> 1-888-777-3940</p>",width:474,height:368,errMsg:"",suppressErrMsg:true},options);popupHTML=['<div id="checkout-error" title="',options.boxTitle,'">',"<h3>",options.messageTitle,"</h3>","<div>",options.message,options.appendCustomerServiceInfo?options.customerServiceInfo:"","</div>",'<div class="popupErrTechnicalMsg">(technical error details: ',options.errMsg,")</div>","</div>"].join("");if(!this.$errorBox.length){jQuery("body").append(popupHTML);this.$errorBox=jQuery("#checkout-error");}else{this.$errorBox.replaceWith(popupHTML);}jQuery("#dialog:ui-dialog").dialog("destroy");this.$errorBox.dialog({resizable:false,width:options.width,height:options.height,draggable:true,modal:true,close:function(){},buttons:{"OK":function(){FL.checkout.$errorBox.dialog("close");}}});}},FL.checkout);window.FL=window.FL||{};FL.checkout=FL.checkout||{};FL.checkout.checkoutLogin=FL.checkout.checkoutLogin||{};FL.checkout.checkoutLogin=jQuery.extend(true,{init:function(){FL.checkout.checkoutLogin.addReturnCatchForIE();},addReturnCatchForIE:function(){if(jQuery.browser.msie){jQuery("#non-signinemail").keydown(FL.checkout.checkoutLogin.checkForSubmit);}},checkForSubmit:function(event){if(event.keyCode==13){jQuery(this).parents("form").find("input:submit").click();return false;}}},FL.checkout.checkoutLogin);window.FL=window.FL||{};FL.checkout=FL.checkout||{};FL.checkout.ship=FL.checkout.ship||{};FL.checkout.ship=jQuery.extend(true,{popupHasDisplayed:false,init:function(){FL.checkout.ship.UpsAddress.init();FL.PhoneMask.init("#shippingPhone");FL.checkout.ship.Form.init();jQuery("#shippingFirstName").focus();},Form:{init:function(){jQuery("#shipping_form").validate({errorClass:"errorMessage",errorElement:"div",errorPlacement:function(error,element){if(!element.parent("div").find("div.errorMessage").length){error.prependTo(element.parent("div"));}}});}},UpsAddress:{init:function(){if(jQuery("#upsAddresses").length>0){FL.checkout.ship.UpsAddress.createDialog();FL.checkout.ship.UpsAddress.attachUpdateAndSubmit();FL.checkout.ship.UpsAddress.attachUpdateSubmitText();FL.checkout.ship.UpsAddress.attachEditAddress();}},attachEditAddress:function(){jQuery("#address_edit").click(function(){jQuery("#upsAddresses").dialog("close");return false;});},attachUpdateAndSubmit:function(){jQuery("#address_submit").click(function(){var _address=jQuery("#address_"+jQuery('input[name="address_selection"]:checked').val());jQuery("#overrideShippingForm").find("#overrideAddress1").val(_address.find(".address1").text()).end().find("#overrideAddress2").val(_address.find(".address2").text()).end().find("#overrideCity").val(_address.find(".city").text()).end().find("#overrideState").val(_address.find(".state").text()).end().find("#overrideZip").val(_address.find(".zip").text()).end();return true;});},attachUpdateSubmitText:function(){jQuery('input[name="address_selection"]').click(function(){jQuery("#address_submit").val(jQuery(this).val()!=="original"?"Apply Changes":"Continue with Original");});},createDialog:function(){jQuery("#upsAddresses").dialog({closeOnEscape:false,height:400,modal:true,open:function(event,ui){jQuery("#overrideShippingAddress").val("true");jQuery(".ui-dialog-titlebar-close").hide();},width:400});}}},FL.checkout.ship);var jqPaymentMethodType="CC";var jqPaymentMethodTemp="";var jqSelectedButton="";var bdfInfo=[];var requiredCCFields=[{type:"type",field:"#billingCardType",errorMsg:"Please select a Credit Card Type"},{type:"number",field:"#billingCardNumber",errorMsg:"Invalid Credit Card Number"},{type:"expMonth",field:"#billingExpirationMonth",errorMsg:"Please enter a value"},{type:"expYear",field:"#billingExpirationYear",errorMsg:"Please enter a value"},{type:"CVV",field:"#billingSecurityCode",errorMsg:"[DYNAMIC]"}];var requiredBillingFields=[{"field":"#billingFirstName","name":"First Name","validation":"text"},{"field":"#billingLastName","name":"Last Name","validation":"text"},{"field":"#billingAddress1","name":"Street Address","validation":"text"},{"field":"#billingCity","name":"City","validation":""},{"field":"#billingState","name":"State","validation":""},{"field":"#billingZip","name":"Zip Code","validation":"zipcode"},{"field":"#billingPhone","name":"Telphone","validation":"phone"}];var requiredGiftCardFields=[{"field":"#giftCardNumber","name":"Gift Card Number","validation":"gcnumber","errorField":"#error_giftCardNumber"},{"field":"#giftCardPin","name":"Gift Card Pin","validation":"gcpin","errorField":"#error_giftCardPin"},{"field":"#billingFirstName","name":"First Name","validation":"text"},{"field":"#billingLastName","name":"Last Name","validation":"text"},{"field":"#billingAddress1","name":"Street Address","validation":"text"},{"field":"#billingCity","name":"City","validation":""},{"field":"#billingState","name":"State","validation":""},{"field":"#billingZip","name":"Zip Code","validation":"zipcode"},{"field":"#billingPhone","name":"Telphone","validation":"phone"}];var savedBillingData={"firstname":"","lastname":"","address1":"","address2":"","city":"","state":"","zip":"","phone":"","ccType":0,"ccNumber":"","ccExpMonth":0,"ccExpYear":0,"ccSecurityCode":""};jQuery.selectPayPal=function(){jQuery("#billing_tt_paypal").click();};jQuery.fn.selectPayPal=function(options){var select=function(){jQuery.saveBillingInformation({previousType:jqPaymentMethodType,currentType:"PayPal"});jQuery.clearPayPalNeedsBillingInfo();jqPaymentMethodType="PayPal";jQuery.clearErrorMessages();jQuery.disableBillingInformation();jQuery.displayPayPalBillingInfo();jQuery.disableCreditCardForm();jQuery.displayPayPalButton();};jQuery(this).click(select);return this;};jQuery.selectCC=function(){jQuery("#billing_tt_cc").click();};jQuery.fn.selectCC=function(){var select=function(){jQuery.saveBillingInformation({previousType:jqPaymentMethodType,currentType:"CC"});jQuery.clearPayPalNeedsBillingInfo();jqPaymentMethodType="CC";jQuery.clearErrorMessages();jQuery.enableBillingInformation();jQuery.hidePayPalBillingInfo();jQuery.enableCreditCardForm();jQuery.displayOrderReviewButton();};jQuery(this).click(select);return this;};jQuery.displayPayPalButton=function(){FL.checkout.bill.changeContinueButton({image:FL.checkout.bill.paymentMethods.PayPal.continueButtonImage});};jQuery.displayOrderReviewButton=function(){FL.checkout.bill.changeContinueButton({image:"/store/images/enhancements/checkout/btn_continue_to_order_review.gif"});};jQuery.fn.selectGiftCard=function(){var select=function(){jqPaymentMethodTemp=jqPaymentMethodType;jqPaymentMethodType="GiftCard";};jQuery(this).click(select);return this;};jQuery.fn.selectCoupon=function(){var select=function(){jqPaymentMethodTemp=jqPaymentMethodType;jqPaymentMethodType="Coupon";jqSelectedButton=jQuery(this).attr("id");};jQuery(this).click(select);return this;};jQuery.saveBillingInformation=function(options){var paymentTypes,saveDemographic,saveCreditCard,emptyDemographic,fillDemographic,emptyCreditCard,fillCreditCard,previousChoice,currentChoice;options=jQuery.extend({previousType:"CC",currentType:"CC"},options);paymentTypes={PayPal:{saveDemographic:false,saveCreditCard:false,displayDemographic:false,displayCreditCard:false},BML:{saveDemographic:true,saveCreditCard:false,displayDemographic:true,displayCreditCard:false},CC:{saveDemographic:true,saveCreditCard:true,displayDemographic:true,displayCreditCard:true}};saveDemographic=function(){savedBillingData.firstname=bdfInfo.firstName.value;savedBillingData.lastname=bdfInfo.lastName.value;savedBillingData.address1=bdfInfo.address1.value;savedBillingData.address2=bdfInfo.address2.value;savedBillingData.city=bdfInfo.city.value;savedBillingData.state=bdfInfo.state.value;savedBillingData.zip=bdfInfo.zip.value;savedBillingData.phone=bdfInfo.phone.value;};saveCreditCard=function(){savedBillingData.ccType=bdfInfo.tempType.selectedIndex;savedBillingData.ccNumber=bdfInfo.tempNumber.value;savedBillingData.ccExpMonth=bdfInfo.tempExpMonth.selectedIndex;savedBillingData.ccExpYear=bdfInfo.tempExpYear.selectedIndex;savedBillingData.ccSecurityCode=bdfInfo.tempSecurityCode.value;};emptyDemographic=function(){bdfInfo.firstName.value="";bdfInfo.lastName.value="";bdfInfo.address1.value="";bdfInfo.address2.value="";bdfInfo.city.value="";bdfInfo.state.value="";bdfInfo.zip.value="";bdfInfo.phone.value="";};fillDemographic=function(){bdfInfo.firstName.value=savedBillingData.firstname;bdfInfo.lastName.value=savedBillingData.lastname;bdfInfo.address1.value=savedBillingData.address1;bdfInfo.address2.value=savedBillingData.address2;bdfInfo.city.value=savedBillingData.city;bdfInfo.state.value=savedBillingData.state;bdfInfo.zip.value=savedBillingData.zip;bdfInfo.phone.value=savedBillingData.phone;};emptyCreditCard=function(){bdfInfo.tempType.selectedIndex=0;bdfInfo.tempNumber.value="";bdfInfo.tempExpMonth.selectedIndex=0;bdfInfo.tempExpYear.selectedIndex=0;bdfInfo.tempSecurityCode.value="";};fillCreditCard=function(){bdfInfo.tempType.selectedIndex=savedBillingData.ccType;bdfInfo.tempNumber.value=savedBillingData.ccNumber;bdfInfo.tempExpMonth.selectedIndex=savedBillingData.ccExpMonth;bdfInfo.tempExpYear.selectedIndex=savedBillingData.ccExpYear;bdfInfo.tempSecurityCode.value=savedBillingData.ccSecurityCode;};previousChoice=null;currentChoice=null;switch(options.previousType){case"PayPal":previousChoice=paymentTypes.PayPal;break;case"BML":previousChoice=paymentTypes.BML;break;case"CC":previousChoice=paymentTypes.CC;break;default:previousChoice=paymentTypes.CC;break;}switch(options.currentType){case"PayPal":currentChoice=paymentTypes.PayPal;break;case"BML":currentChoice=paymentTypes.BML;break;case"CC":currentChoice=paymentTypes.CC;break;default:currentChoice=paymentTypes.CC;break;}if(previousChoice.saveDemographic){saveDemographic();}if(previousChoice.saveCreditCard){saveCreditCard();}if(currentChoice.displayDemographic){fillDemographic();}else{emptyDemographic();}if(currentChoice.displayCreditCard){fillCreditCard();}else{emptyCreditCard();}};jQuery.clearCouponIfDefault=function(){var wcValue,cpnValue;wcValue=jQuery("#wcCouponNumber").val();cpnValue=jQuery("#couponNumber").val();jQuery("#wcCouponNumber").val(wcValue==="Enter Rewards Number"?"":wcValue);jQuery("#couponNumber").val(cpnValue==="Enter Coupon Code"?"":cpnValue);
};jQuery.displayPayPalNeedsBillingInfo=function(){$billing_form=jQuery("#billing_demographic").find(".form");if($billing_form.find("#payPalGiftCardMessage").length===0){$billing_form.prepend('<div id="payPalGiftCardMessage">In order to apply your gift card, please fill out your billing information below and then click the Gift Card apply button again.</div>');}};jQuery.clearPayPalNeedsBillingInfo=function(){jQuery("#billing_demographic").find("#payPalGiftCardMessage").remove();};jQuery.validateBilling=function(){jQuery.clearErrorMessages();jQuery.clearCouponIfDefault();switch(jqPaymentMethodType){case"PayPal":jQuery.transferTempValuesForPayPal();return true;case"BML":if(jQuery.validateBillingInfo()){jQuery.transferTempValuesForBML();return FL.checkout.bill.paymentMethods.BML.validate();}break;case"CC":if(jQuery.validateCCInfo()){if(jQuery.validateBillingInfo()){jQuery.transferTempValuesForCC();return true;}}break;case"GiftCard":if(jqPaymentMethodTemp==="PayPal"){jQuery.displayPayPalNeedsBillingInfo();jQuery.clearErrorMessages();jQuery.enableBillingInformation();jQuery.hidePayPalBillingInfo();jQuery.displayOrderReviewButton();}if(jQuery.validateBillingInfo()){if(jQuery.validateGiftCardInfo()){return true;}}break;case"Coupon":if(jQuery.validateCouponInfo()){return true;}break;default:break;}return false;};jQuery.clearErrorMessages=function(){jQuery(".errorTag").remove();jQuery(".ordersummary_error").removeClass("exclamation").find(".error_message").text("");};jQuery.validateGiftCardInfo=function(){var validated,errorMsg,selectedField,errorField;validated=true;errorMsg="";selectedField="";errorField="";jQuery.each(requiredGiftCardFields,function(i,item){var value,objRegExp;value=jQuery(item.field).val();selectedField=item.field;errorField=item.errorField;switch(item.validation){case"gcnumber":objRegExp=/[0-9]{16}/;if(!value.match(objRegExp)){validated=false;errorMsg="Card number must be 16 digits long";}break;case"gcpin":objRegExp=/[0-9]{8}/;if(!value.match(objRegExp)){validated=false;errorMsg="Pin must be 8 digits long";}break;default:break;}if(value===""&&errorMsg===""){validated=false;errorMsg="Please enter a value";}return validated;});if(errorMsg!==""){jqPaymentMethodType=jqPaymentMethodTemp;jQuery(errorField).addClass("exclamation").addClass("over");jQuery(errorField+" .error_message").text(errorMsg);jQuery.initiateOrderSummaryErrors();return false;}jQuery.copyCreditCardTempToLive();return true;};jQuery.initiateOrderSummaryErrors=function(){jQuery(".ordersummary_error.exclamation").mouseover(function(){jQuery(this).addClass("over");}).mouseout(function(){jQuery(this).removeClass("over");}).parent().find("input").focus(function(){jQuery(this).parent().find(".ordersummary_error.exclamation").removeClass("over");});};jQuery.validateCCInfo=function(){var $creditCard=jQuery("#billing_credit_card"),cardType="",error={display:false,message:"",field:""};jQuery.each(requiredCCFields,function(i,item){var value=jQuery(item.field).val();switch(item.type){case"type":error.display=!value.match(FL.RegEx.payment.cc_types);cardType=value;break;case"number":error.display=!value.match(FL.RegEx.payment.cards[cardType].number);break;case"CVV":error.display=!value.match(FL.RegEx.payment.cards[cardType].securityCode);item.errorMsg=cardType==="AMEX"?"Enter a 4 digit Security Code":"Enter a 3 digit Security Code";break;default:error.display=value==="";break;}if(error.display){error.field=item.field;error.message=item.errorMsg;return false;}return true;});if(error.display){jQuery(error.field).parent().prepend('<div class="errorTag">'+error.message+"</div>");return false;}return true;};jQuery.validateBillingInfo=function(){var validated,errorMsg,selectedField,errorTagHTML;validated=true;errorMsg="";selectedField="";jQuery.each(requiredBillingFields,function(i,item){var value,objRegExp;value=jQuery(item.field).val();selectedField=item.field;switch(item.validation){case"text":objRegExp=/[^0-9a-zA-Z-\.\s,@]/;if(value.match(objRegExp)){validated=false;errorMsg='" '+value.replace(value.replace(objRegExp,""),"")+' " is an invalid character';}break;case"zipcode":objRegExp=/(^\d{5}$)|(^\d{5}-\d{4}$)/;if(!value.match(objRegExp)){validated=false;errorMsg="Please enter a valid Zip Code";}break;case"phone":objRegExp=/(^\d{3}\-\s?\d{3}\-\d{4}$)/;if(!value.match(objRegExp)){validated=false;errorMsg="Incorrect Phone Number format";}break;default:break;}if(value===""&&errorMsg===""){validated=false;errorMsg="Please enter a value";}return validated;});if(validated){if(jQuery("#billingFirstName").val().length+jQuery("#billingLastName").val().length>34){validated=false;errorMsg="Name fields too long";selectedField="#billingFirstName";if(!jQuery("#dialog_name_length").length){popup=new FL.dialog("dialog_name_length",{content:"First name and last name cannot be longer than 34 characters combined.  Please adjust either the first name or last name field to decrease the character length to below 34 characters."},{close:function(event,ui){$overlay=jQuery("#ship").find(".ui-widget-overlay");if($overlay.length>0){$overlay.remove();}},title:"Name Values Too Long"});}jQuery("#billingFirstName, #billingLastName").keydown(function(){if(jQuery("#billingFirstName").val().length+jQuery("#billingLastName").val().length<=34){jQuery("#billingFirstName").parents(".formItem").find(".errorTag").remove();}});}}if(errorMsg!==""){errorTagHTML=['<div class="errorTag">',errorMsg,"</div>"].join("");jQuery(selectedField).parent().prepend(errorTagHTML);return false;}return true;};jQuery.transferTempValuesForBML=function(){var currentDate,thisYear,nextMonth;currentDate=new Date();thisYear=currentDate.getFullYear();nextMonth=currentDate.getMonth()+2;thisYear=(nextMonth>12)?thisYear+1:thisYear;nextMonth=(nextMonth>12)?nextMonth-12:nextMonth;nextMonth=(nextMonth<10)?"0"+nextMonth:nextMonth;bdfInfo.type.value="Visa";bdfInfo.expMonth.value=nextMonth;bdfInfo.expYear.value=thisYear;bdfInfo.number.value="4111111111111111";bdfInfo.securityCode.value="111";bdfInfo.successField.value="/store/checkout/billmelater.jsp";};jQuery.transferTempValuesForPayPal=function(){bdfInfo.type.value="";bdfInfo.number.value="";bdfInfo.expMonth.value="";bdfInfo.expYear.value="";bdfInfo.securityCode.value="";bdfInfo.firstName.value="";bdfInfo.lastName.value="";bdfInfo.address1.value="";bdfInfo.address2.value="";bdfInfo.city.value="";bdfInfo.state.value="";bdfInfo.zip.value="";bdfInfo.phone.value="";bdfInfo.successField="/store/checkout/orderreview.jsp";};jQuery.transferTempValuesForCC=function(){bdfInfo.type.value=bdfInfo.tempType.value;bdfInfo.number.value=bdfInfo.tempNumber.value;bdfInfo.expMonth.value=bdfInfo.tempExpMonth.value;bdfInfo.expYear.value=bdfInfo.tempExpYear.value;bdfInfo.securityCode.value=bdfInfo.tempSecurityCode.value;bdfInfo.successField.value="/store/checkout/orderreview.jsp";};jQuery.disableBillingInformation=function(){var selector='#billing_demographic input[type="text"], #billing_demographic select';jQuery(selector).attr("disabled","true").addClass("disabled");};jQuery.enableBillingInformation=function(){var selector='#billing_demographic input[type="text"], #billing_demographic select';jQuery(selector).removeAttr("disabled").removeClass("disabled");};jQuery.disableCreditCardForm=function(){var selector='#billing_credit_card input[type="text"], #billing_credit_card select';jQuery(selector).attr("disabled","true").addClass("disabled");};jQuery.enableCreditCardForm=function(){var selector='#billing_credit_card input[type="text"], #billing_credit_card select';jQuery(selector).removeAttr("disabled").removeClass("disabled");};jQuery.displayPayPalBillingInfo=function(){var selector="#billing_demographic_paypal";jQuery(selector).css({"display":"block"});};jQuery.hidePayPalBillingInfo=function(){var selector="#billing_demographic_paypal";jQuery(selector).css({"display":"none"});};jQuery.copyCreditCardTempToLive=function(){var $hiddenFields=jQuery("#billingHiddenFields"),$creditCardFields=jQuery("#billing_credit_card");if($creditCardFields.find("#billing_tt_cc").is(":checked")){$hiddenFields.find('input[name="creditCardType"]').val($creditCardFields.find("#billingCardType").val()).end().find('input[name="creditCardNumber"]').val($creditCardFields.find("#billingCardNumber").val()).end().find('input[name="expirationMonth"]').val($creditCardFields.find("#billingExpirationMonth").val()).end().find('input[name="expirationYear"]').val($creditCardFields.find("#billingExpirationYear").val()).end().find('input[name="securityCode"]').val($creditCardFields.find("#billingSecurityCode").val()).end();}};jQuery.validateCouponInfo=function(){var $parent=jQuery("#"+jqSelectedButton).parent().parent(),couponErrorList=["","Enter Coupon Code","Enter Rewards Number"];if(jQuery.inArray(jQuery.trim($parent.find(".formItem input").val()),couponErrorList)>-1){jqPaymentMethodType=jqPaymentMethodTemp;$parent.find(".ordersummary_error").addClass("exclamation over").find(".error_message").text("Please enter a valid coupon code.");jQuery.initiateOrderSummaryErrors();return false;}jQuery.copyCreditCardTempToLive();return true;};jQuery.prepareBillingDataForm=function(){bdfInfo.type=document.getElementsByName("creditCardType")[0];bdfInfo.number=document.getElementsByName("creditCardNumber")[0];bdfInfo.expMonth=document.getElementsByName("expirationMonth")[0];bdfInfo.expYear=document.getElementsByName("expirationYear")[0];bdfInfo.securityCode=document.getElementsByName("securityCode")[0];bdfInfo.tempType=document.getElementsByName("creditCardTypeTemp")[0];bdfInfo.tempNumber=document.getElementsByName("creditCardNumberTemp")[0];bdfInfo.tempExpMonth=document.getElementsByName("expirationMonthTemp")[0];bdfInfo.tempExpYear=document.getElementsByName("expirationYearTemp")[0];bdfInfo.tempSecurityCode=document.getElementsByName("securityCodeTemp")[0];bdfInfo.firstName=document.getElementsByName("firstName")[0];bdfInfo.lastName=document.getElementsByName("lastName")[0];bdfInfo.address1=document.getElementsByName("address1")[0];bdfInfo.address2=document.getElementsByName("address2")[0];bdfInfo.city=document.getElementsByName("city")[0];bdfInfo.state=document.getElementsByName("state")[0];bdfInfo.zip=document.getElementsByName("zip")[0];bdfInfo.phone=document.getElementsByName("phone")[0];bdfInfo.successField=document.getElementsByName("moveToConfirmationSuccessURL")[0];};jQuery.validateCCInfoForReset=function(){return bdfInfo.type.value!==""&&bdfInfo.number.value!==""&&bdfInfo.expMonth.value!==""&&bdfInfo.expYear.value!==""&&bdfInfo.securityCode.value!=="";};jQuery.resetBML=function(){if(jQuery.validateCCInfoForReset()){if(bdfInfo.number.value==="XXXXXXXXXXXX1111"){bdfInfo.tempType.selectedIndex=0;bdfInfo.tempNumber.value="";bdfInfo.tempExpMonth.selectedIndex=0;bdfInfo.tempExpYear.selectedIndex=0;bdfInfo.tempSecurityCode.value="";bdfInfo.type.value="";bdfInfo.number.value="";bdfInfo.expMonth.value="";bdfInfo.expYear.value="";bdfInfo.securityCode.value="";}}};jQuery.resetPayPal=function(){bdfInfo.type.value="";bdfInfo.number.value="";bdfInfo.expMonth.value="";bdfInfo.expYear.value="";bdfInfo.securityCode.value="";bdfInfo.tempType.selectedIndex=0;bdfInfo.tempNumber.value="";bdfInfo.tempExpMonth.selectedIndex=0;bdfInfo.tempExpYear.selectedIndex=0;bdfInfo.tempSecurityCode.selectedIndex=0;bdfInfo.firstName.value="";bdfInfo.lastName.value="";bdfInfo.address1.value="";bdfInfo.address2.value="";bdfInfo.city.value="";bdfInfo.state.value="";bdfInfo.zip.value="";bdfInfo.phone.value="";jQuery.displayPayPalButton();jQuery.selectPayPal();};jQuery.resetCC=function(){var $creditCardFields=jQuery("#billing_credit_card"),$hiddenFields=jQuery("#billingHiddenFields");$creditCardFields.find("#billingCardType").val($hiddenFields.find('input[name="creditCardType"]').val()).end().find("#billingCardNumber").val($hiddenFields.find('input[name="creditCardNumber"]').val()).end().find("#billingExpirationMonth").val($hiddenFields.find('input[name="expirationMonth"]').val()).end().find("#billingExpirationYear").val($hiddenFields.find('input[name="expirationYear"]').val()).end().find("#billingSecurityCode").val($hiddenFields.find('input[name="securityCode"]').val()).end().find("#billing_tt_cc").click();};window.FL=window.FL||{};FL.checkout=FL.checkout||{};FL.checkout.bill=FL.checkout.bill||{};FL.checkout.bill=jQuery.extend(true,{$continueButton:{},init:function(){jQuery.prepareBillingDataForm();jQuery("#apply_giftcard").selectGiftCard();FL.checkout.bill.paymentMethods.BML.init();jQuery("#billing_tt_paypal").selectPayPal();jQuery("#billing_tt_cc").selectCC();jQuery("#couponNumberButton, #wcCouponNumberButton").selectCoupon();jQuery("#billing_form").bind("submit",function(event){return jQuery.validateBilling();});this.$continueButton=jQuery("#billing_btn_continue");FL.checkout.bill.displayCouponError();FL.PhoneMask.init("#billingPhone");FL.checkout.bill.Validation.init();},Validation:{init:function(){jQuery("#billingFirstName, #billingLastName").blur(FL.checkout.bill.Validation.checkNameLengthBlur).keydown(FL.checkout.bill.Validation.checkNameLengthKeydown);},checkNameLengthBlur:function(){var $billingFirstName=jQuery("#billingFirstName"),$billingLastName=jQuery("#billingLastName"),popup=null;if($billingFirstName.val().length+$billingLastName.val().length>34){if(!jQuery("#dialog_name_length").length){popup=new FL.dialog("dialog_name_length",{content:"First name and last name cannot be longer than 34 characters combined.  Please adjust either the first name or last name field to decrease the character length to below 34 characters."},{title:"Name Values Too Long"});}jQuery("#billingFirstName").parent().prepend('<div class="errorTag">Name fields too long</div>');}},checkNameLengthKeydown:function(){if(jQuery("#billingFirstName").val().length+jQuery("#billingLastName").val().length<=34){jQuery("#billingFirstName").parents(".formItem").find(".errorTag").remove();}}},changeContinueButton:function(options){options=jQuery.extend({image:"/store/images/enhancements/checkout/btn_continue_to_order_review.gif"},options);this.$continueButton.attr("src",options.image);return this;},displayCouponError:function(){var errorMessages=[],tooltip;if(jQuery("#cart_errors_list").find(".cart_error_coupon").length){jQuery("#cart_errors_list").find(".cart_error_coupon").each(function(index,item){errorMessages.push(jQuery(item).text());});jQuery("#error_couponNumber").addClass("exclamation");tooltip=new FL.ToolTipOneTimeCSControls({closeButton:true,message:errorMessages.join("<br/>"),selector:"#error_couponNumber",top:-80,width:240});tooltip.create();jQuery("#couponNumber, #wcCouponNumber").focus(function(){tooltip.destroy();});}}},FL.checkout.bill);FL.checkout.bill.PaymentMethod={moveToConfirmationSuccessURL:"/store/checkout/orderreview.jsp",continueButtonImage:"/store/images/enhancements/checkout/btn_continue_to_order_review.gif",jQueryFormObjectsSelector:"#billing_form input:visible, #billing_form select",formValues:{},formObjects:{},init:function(){},disableForm:function(){},saveValues:function(){},emptyForm:function(){},populateForm:function(){},enableForm:function(){},select:function(){this.preSelectHook();FL.checkout.bill.paymentMethods.previouslyChosen=FL.checkout.bill.paymentMethods.chosen;FL.checkout.bill.paymentMethods.chosen=this;FL.checkout.bill.paymentMethods.previouslyChosen.saveValues();FL.checkout.bill.paymentMethods.previouslyChosen.emptyForm();FL.checkout.bill.paymentMethods.previouslyChosen.disableForm();jQuery(this.jQueryFormObjectsSelector).each(function(index){var $elm=jQuery(this);FL.checkout.paymentMethods.chosen.formObjects[$elm.attr("id")]=$elm;});FL.checkout.bill.paymentMethods.chosen.populateForm();FL.checkout.bill.paymentMethods.chosen.enableForm();FL.checkout.bill.changeContinueButton({image:this.continueButtonImage});this.postSelectHook();},preSelectHook:function(){},postSelectHook:function(){},validate:function(){return false;}};FL.checkout.bill.paymentMethods=FL.checkout.bill.paymentMethods||{};FL.checkout.bill.paymentMethods=jQuery.extend(true,{chosen:jQuery.extend(true,Object.create(FL.checkout.bill.PaymentMethod),{}),previouslyChosen:jQuery.extend(true,Object.create(FL.checkout.bill.PaymentMethod),{}),CC:jQuery.extend(true,Object.create(FL.checkout.bill.PaymentMethod),{}),PayPal:jQuery.extend(true,Object.create(FL.checkout.bill.PaymentMethod),{continueButtonImage:"/media/images/paypal/btn_continuetopaypal.gif"}),coupon:jQuery.extend(true,Object.create(FL.checkout.bill.PaymentMethod),{}),giftCard:jQuery.extend(true,Object.create(FL.checkout.bill.PaymentMethod),{})},FL.checkout.bill.paymentMethods);
FL.checkout.bill.paymentMethods=FL.checkout.bill.paymentMethods||{};FL.checkout.bill.paymentMethods.BML=FL.checkout.bill.paymentMethods.BML||{};FL.checkout.bill.paymentMethods.BML=jQuery.extend(true,Object.create(FL.checkout.bill.PaymentMethod),{jQueryFormObjectsSelector:"",continueButtonImage:"/media/images/checkout/continue_to_bill_me_later.gif",init:function(){jQuery("#billing_tt_bml").bind("click",function(event){FL.checkout.bill.paymentMethods.BML.select();});},postSelectHook:function(){window.jqPaymentMethodType=window.jqPaymentMethodType||"";jQuery.saveBillingInformation({previousType:window.jqPaymentMethodType,currentType:"BML"});window.jqPaymentMethodType="BML";jQuery.clearErrorMessages();jQuery.enableBillingInformation();jQuery.hidePayPalBillingInfo();jQuery.disableCreditCardForm();},validate:function(){this.initializeBMLOrder();return false;},initializeBMLOrder:function(){var formData;FL.checkout.showPleaseWait();formData=jQuery("#billing_demographic input:text, #billing_demographic select").serialize();jQuery.ajax({url:"/store/checkout/fragments/initBmlOrder.jsp",cache:false,data:formData,dataType:"json",success:function(data,textStatus,jqXHR){FL.checkout.bill.paymentMethods.BML.submitToBML();},error:function(jqXHR,textStatus,errorThrown){FL.checkout.showError({boxTitle:"Error: Could not move on to Bill Me Later",message:"We were unable to move you on to Bill Me Later because there was an error with your billing information. Please check all of your information and try again",errMsg:textStatus+" "+errorThrown,suppressErrMsg:false,height:260});FL.checkout.hidePleaseWait();}});},submitToBML:function(){var bmlForm,formValues,merchantId,formAction;merchantId="724078148000001";formValues={};jQuery.each(jQuery("#billing_demographic input:text, #billing_demographic select").serializeArray(),function(i,field){formValues[field.name]=field.value;});formValues.orderTotal=jQuery("#orderSummaryOrderTotal").text();formValues.email=jQuery("#viewChangeEmailAddress").text();if(FL.setup.isProduction){formAction="https://www.securecheckout.billmelater.com/paycapture-ws/paycapturelite ";}else{formAction="https://mit.securecheckout.billmelater.com/paycapture-ws/paycapturelite";}bmlForm=['<form id="bmlForm" action="',formAction,'" method="POST" style="display:none;">','<input type="hidden" id="aMid"  name="aMid" value="',merchantId,'"/>','<input type="hidden" id="amt"  name="amt" value="',formValues.orderTotal,'"/>','<input type="hidden" id="bName"  name="bName" value="',formValues.firstName," ",formValues.lastName,'"/>','<input type="hidden" id="bAddr1"  name="bAddr1"  value="',formValues.address1,'"/>','<input type="hidden" id="bAddr2"  name="bAddr2"  value="',formValues.address2,'"/>','<input type="hidden" id="bCity"  name="bCity"  value="',formValues.city,'"/>','<input type="hidden" id="bState"  name="bState"  value="',formValues.state,'"/>','<input type="hidden" id="bZip"  name="bZip"  value="',formValues.zip,'"/>','<input type="hidden" id="phone"  name="phone"  value="',formValues.phone,'"/>','<input type="hidden" id="email"  name="email"  value="',formValues.email,'"/>','<input type="hidden" id="iUrl"  name="iUrl" value="https://'+FL.environment+'.finishline.com/store/checkout/fragments/bmlGetExpressInfo.jsp" />','<input type="hidden" id="updUrl"  name="updUrl" value="https://'+FL.environment+'.finishline.com/store/checkout/bill.jsp"/>','<input type="hidden" id="mpUrl"  name="mpUrl" value="https://'+FL.environment+'.finishline.com/store/checkout/bill.jsp"/>','<input type="hidden" id="logoUrl"  name="logoUrl" value="https://www.finishline.com/store/images/paypal/FL_nobox_wht_logo.jpg"/>','<input type="hidden" name="mRefId" value="',FL.checkout.orderId,'"/>','<input type=submit value="Continue with Bill Me Later">',"</form>"].join("");jQuery("body").append(bmlForm);jQuery("#bmlForm").submit();}},FL.checkout.bill.paymentMethods.BML);window.FL=window.FL||{};FL.checkout=FL.checkout||{};FL.checkout.orderReview=FL.checkout.orderReview||{};FL.checkout.orderReview=jQuery.extend(true,{init:function(){FL.PhoneMask.init("#billingPhone");FL.PhoneMask.init("#shippingPhone");FL.checkout.orderReview.Validation.init();},Validation:{init:function(){jQuery("#shippingFirstName, #shippingLastName").live("keydown",FL.checkout.orderReview.Validation.checkShippingNameLengthKeyDown);jQuery("#billingFirstName, #billingLastName").live("keydown",FL.checkout.orderReview.Validation.checkBillingNameLengthKeyDown);},checkShippingNameLengthKeyDown:function(){if(jQuery("#shippingFirstName").val().length+jQuery("#shippingLastName").val().length<34){jQuery("#shipError").hide();}},checkBillingNameLengthKeyDown:function(){if(jQuery("#billingFirstName").val().length+jQuery("#billingLastName").val().length<34){jQuery("#billError").hide();}}}},FL.checkout.orderReview);window.FL=window.FL||{};FL.checkout=FL.checkout||{};FL.checkout.popupWCRegistration=FL.checkout.popupWCRegistration||{};FL.checkout.popupWCRegistration=jQuery.extend(true,{init:function(){FL.PhoneMask.init("#wcPhone");FL.PhoneMask.init("#wcCellPhone");}},FL.checkout.popupWCRegistration);FL.cart={init:function(){FL.cart.savePreviousQuantity();jQuery("#checkoutButton, #paypalCheckoutButton").bind("click",function(DOMEvent){jQuery("#cartMainContent select").each(function(){var currentQuantity=parseInt(jQuery(this).val());var previousQuantity=parseInt(jQuery(this).data("previousQuantity"));if(currentQuantity>previousQuantity){var quantityAdded=currentQuantity-previousQuantity;FL.cart.trackCartChange("scAdd",jQuery(this).attr("id"),quantityAdded);}else{if(currentQuantity<previousQuantity){var quantityRemoved=previousQuantity-currentQuantity;FL.cart.trackCartChange("scRemove",jQuery(this).attr("id"),quantityRemoved);}}});});},savePreviousQuantity:function(){jQuery("#cartMainContent select").each(function(){jQuery(this).data("previousQuantity",jQuery(this).val());});},trackCartChange:function(event,productId,quantity){var s=s_gi(scServerCode);s.linkTrackVars="events,products";s.linkTrackEvents=event;s.events=event;s.products=";"+productId+";"+quantity;s.tl(this,"o","Shopping Cart: Checkout");}};window.FL=window.FL||{};FL.WishList=FL.WishList||{};FL.wishlistMain=function(){var emailToolTip,printToolTip;jQuery(FL.WishList.data.buttons.recipients).live("click",FL.WishList.clickValidateList);jQuery(FL.WishList.data.buttons.email_list).live("click",FL.WishList.clickEmailWishList);jQuery("#wishlist").find(FL.WishList.data.buttons.addtocart).click(FL.WishList.clickAddToCart).end().find(FL.WishList.data.buttons.print).click(FL.WishList.clickPrint).end().find(FL.WishList.data.buttons.email).click(FL.WishList.clickEmail).end().find(FL.WishList.data.buttons.search_email).click(FL.WishList.clickSearchWishesByEmail).end().find(FL.WishList.data.buttons.search_name).click(FL.WishList.clickSearchWishesByName);emailToolTip=new FL.ToolTipMinorControls({iconWidth:-22,message:"Email Wish List",selector:"#tools_email",top:-30,width:140});printToolTip=new FL.ToolTipMinorControls({iconWidth:-22,message:"Print Wish List",selector:"#tools_print",top:-30,width:120});};FL.wishlistLanding=function(){jQuery("#wishlist").find(FL.WishList.data.buttons.landing).click(FL.WishList.clickReturningCustomer).end().find(FL.WishList.data.buttons.create).click(FL.WishList.clickCreateWishList).end().find(FL.WishList.data.buttons.search_email).click(FL.WishList.clickSearchWishesByEmail).end().find(FL.WishList.data.buttons.search_name).click(FL.WishList.clickSearchWishesByName);};FL.wishlistNameSearch=function(){jQuery("#wishlist").find(FL.WishList.data.buttons.search_email).click(FL.WishList.clickSearchWishesByEmail).end().find(FL.WishList.data.buttons.search_name).click(FL.WishList.clickSearchWishesByName);};FL.wishlistUserId=function(){var printToolTip;jQuery("#wishlist").find(FL.WishList.data.buttons.addtocart).click(FL.WishList.clickAddToCart).end().find(FL.WishList.data.buttons.print).click(FL.WishList.clickPrint).end().find(FL.WishList.data.buttons.search_email).click(FL.WishList.clickSearchWishesByEmail).end().find(FL.WishList.data.buttons.search_name).click(FL.WishList.clickSearchWishesByName);printToolTip=new FL.ToolTipMinorControls({iconWidth:-22,message:"Print Wish List",selector:"#tools_print",top:-30,width:120});};FL.WishList.data={buttons:{addtocart:".button_addtocart",create:"#WishlistCreate-submit",email:"#tools_email",email_list:"#button_email_wishlist",landing:"#WLLanding-submit",print:"#tools_print",recipients:"#button_recipient_emails",search_email:"#WLSearch-email-submit",search_name:"#WLSearch-demographic-submit"},errors:{all:{required:"Please supply an email address and password"},city:{required:"City is a required field"},email:{malformed:"Please supply a valid email address",required:"Email is a required field"},first_name:{length:"First name must be at least 2 characters long",required:"First name is a required field"},last_name:{length:"Last name must be at least 2 characters long",required:"Last name is a required field"},password:{matching:"Both password fields must match",required:"Password and Confirm Password are required fields"},state:{required:"State is required"}}};FL.WishList.clickAddToCart=function(){var itemId=jQuery(this).attr("id").split("_")[1];jQuery("#giftItemId").val(itemId);};FL.WishList.clickCreateWishList=function(){var errorList=[],data={first_name:jQuery("#createFirstName").val(),last_name:jQuery("#createLastName").val(),email:jQuery("#createEmail").val(),password:jQuery("#createPassword").val(),password_confirm:jQuery("#createPasswordConfirm").val(),city:jQuery("#createCity").val(),state:jQuery("#createState").val()};if(data.first_name===""){errorList.push(FL.WishList.data.errors.first_name.required);}if(data.last_name===""){errorList.push(FL.WishList.data.errors.last_name.required);}if(data.email===""){errorList.push(FL.WishList.data.errors.email.required);}else{if(!FL.RegEx.demographic.email.test(data.email)){errorList.push(FL.WishList.data.errors.email.malformed);}}if(data.password===""||data.password_confirm===""){errorList.push(FL.WishList.data.errors.password.required);}else{if(data.password!==data.password_confirm){errorList.push(FL.WishList.data.errors.password.matching);}}if(data.city===""){errorList.push(FL.WishList.data.errors.city.required);}if(data.state===""){errorList.push(FL.WishList.data.errors.state.required);}return FL.WishList.displayIfError(errorList);};FL.WishList.clickEmail=function(){var popup;popup=new FL.dialog("dialog_email",{ajax:true,ajaxData:{url:"/gifts/fragments/previewlist_body.jsp"},url:"/store/global/popup/popup_secure.jsp"},{height:200,title:"Email Wish List",width:500});};FL.WishList.clickEmailWishList=function(){var wishlistId=jQuery("#wishlistId").val();jQuery.ajax({data:{wishlistId:wishlistId},dataType:"json",type:"POST",url:"/store/gifts/fragments/ajax/ajax_sendlist_popup_secure.jsp",success:function(data,textStatus,jqXHR){var errors,popup;if(data.success){jQuery("#dialog_email").dialog({height:200,width:500});jQuery("#dialog_email").find("#sendlist").remove().end().html("<div>Your wishlist was successfully e-mailed.</div>");}else{errors=[];jQuery(data.errors).each(function(){errors.push(this);});jQuery("#dialog_email").find("#preview_errors").remove().end().prepend('<div id="preview_errors">'+errors.join("<br/>")+"</div>");}}});};FL.WishList.clickPrint=function(){window.print();};FL.WishList.clickReturningCustomer=function(){var errorList=[],data={email:jQuery("#returnEmail").val(),password:jQuery("#returnPassword").val()};if(data.email!==""&&data.password!==""){if(!FL.Regex.demographic.email.text(data.email)){errorList.push(FL.WishList.data.errors.email.malformed);}}else{errorList.push(FL.WishList.data.errors.all.required);}if(errorList.length===0){return false;}return FL.WishList.displayIfError(errorList);};FL.WishList.clickSearchWishesByEmail=function(){var errorList=[],data={email:jQuery("#searchEmailId").val()};if(data.email===""){errorList.push(FL.WishList.data.errors.email.required);}else{if(!FL.RegEx.demographic.email.test(data.email)){errorList.push(FL.WishList.data.errors.email.malformed);}}return FL.WishList.displayIfError(errorList);};FL.WishList.clickSearchWishesByName=function(){var errorList=[],data={first_name:jQuery("#searchFirstName").val(),last_name:jQuery("#searchLastName").val(),city:jQuery("#searchCity").val(),state:jQuery("#searchState").val()};if(data.first_name.length<2){errorList.push(FL.WishList.data.errors.first_name.length);}if(data.last_name.length<2){errorList.push(FL.WishList.data.errors.last_name.length);}if(data.state===""){errorList.push(FL.WishList.data.errors.state.required);}return FL.WishList.displayIfError(errorList);};FL.WishList.clickValidateList=function(){var recipientList=jQuery("#recipient_emails").val();jQuery.ajax({data:{list:recipientList,url:"/gifts/fragments/ajax/ajax_previewlist.jsp"},dataType:"json",type:"POST",url:"/store/global/popup/popup_secure.jsp",success:function(data,textStatus,jqXHR){var errors,popup;if(data.success){jQuery("#dialog_email").dialog({height:500,width:700});jQuery.ajax({data:{url:"/gifts/fragments/sendlist_body.jsp"},dataType:"html",type:"POST",url:"/store/global/popup/popup_secure.jsp",success:function(html,textStatus,jqXHR){jQuery("#dialog_email").find("#preview_form").remove().end().html(html);}});}else{errors=[];jQuery(data.errors).each(function(){errors.push(this);});jQuery("#dialog_email").find("#preview_errors").remove().end().prepend('<div id="preview_errors">'+errors.join("<br/>")+"</div>");}}});};FL.WishList.displayIfError=function(error){var popup;if(error.length===0){return true;}popup=new FL.dialog("dialog_display_error",{content:error.join("<br/>")},{height:(20*error.length)+100,title:"An Error Has Occurred",width:400});return false;};

