// (c)2008 RoadRunnerSports

YAHOO.namespace("rrs.shoeDog");YAHOO.rrs.shoeDog.ref2s={};YAHOO.rrs.shoeDog.ref2Paths={};YAHOO.rrs.shoeDog.ref1s={"Gender":"","Surface":"","ArchType":"","ShoeTilt":"","Injury":"","Weight":""};YAHOO.rrs.shoeDog.ref1sD={"Gender":null,"Surface":null,"ArchType":null,"ShoeTilt":null,"Injury":null,"Weight":null,"Miles":null};YAHOO.rrs.shoeDog.ref2sS={"Brand":"","Size":""};YAHOO.rrs.shoeDog.ref2QIsS={"Color":"","Size":"","Width":"","Price":"","Product":""};YAHOO.rrs.shoeDog.skusPrc={};YAHOO.rrs.shoeDog.skusInventory={};YAHOO.rrs.shoeDog.ref2QIs={};YAHOO.rrs.shoeDog.ref2QIsImgs={};var RRS_DELIM="$+$";var NEUTRAL="Neutral";var NEUTRALPLUS="NeutralPlus";var NEUTRALPERFORMANCE="NeutralPerformance";var STABILITY="Stability";var STABILITYPLUS="StabilityPlus";var STABILITYPERFORMANCE="StabilityPerformance";var MOTIONCONTROL="MotionControl";var MOTIONCONTROLPLUS="MotionControlPlus";YAHOO.rrs.shoeDog.imgs={};var imgObj1=new Image();imgObj1.src="/rrs/img/quick_info/add_to_cart_dis.jpg";YAHOO.rrs.shoeDog.imgs["dis"]=imgObj1;var imgObj2=new Image();imgObj2.src="/rrs/img/quick_info/add_to_cart_en.jpg";YAHOO.rrs.shoeDog.imgs["en"]=imgObj2;var imgObj3=new Image();imgObj3.src="/rrs/img/shoe_dog/terrain_1female.gif";YAHOO.rrs.shoeDog.imgs["terrain_1female"]=imgObj3;var imgObj4=new Image();imgObj4.src="/rrs/img/shoe_dog/terrain_2female.gif";YAHOO.rrs.shoeDog.imgs["terrain_2female"]=imgObj4;var imgObj5=new Image();imgObj5.src="/rrs/img/shoe_dog/terrain_3female.gif";YAHOO.rrs.shoeDog.imgs["terrain_3female"]=imgObj5;var imgObj6=new Image();imgObj6.src="/rrs/img/shoe_dog/home1b.jpg";YAHOO.rrs.shoeDog.imgs["shoeDogHome2"]=imgObj6;var imgObj7=new Image();imgObj7.src="/rrs/img/shoe_dog/nav_1full_dn.jpg";YAHOO.rrs.shoeDog.imgs["ref1ContActive"]=imgObj7;var imgObj8=new Image();imgObj8.src="/rrs/img/shoe_dog/nav_1start_dn.jpg";YAHOO.rrs.shoeDog.imgs["ref1StartActive"]=imgObj8;var imgObj9=new Image();imgObj9.src="/rrs/img/shoe_dog/nav_1full_submit_up.jpg";YAHOO.rrs.shoeDog.imgs["submit"]=imgObj9;var initRef2sS=function(){YAHOO.rrs.shoeDog.ref2sS={};}
var initRef2QIsS=function(){YAHOO.rrs.shoeDog.ref2QIsS={"Color":"","Size":"","Width":"","Price":"","Product":""};if(document.addToCartForm&&document.addToCartForm.productSelected&&document.addToCartForm.productSelected.value){YAHOO.rrs.shoeDog.ref2QIsS.Product=document.addToCartForm.productSelected.value;}
initRef2QIs();initRef2QITitles();}
var initRef2QIs=function(){if(!YAHOO.rrs.shoeDog.ref2QIs){return;}
var initOrder=["Width","Size","Color"];for(i=0;i<initOrder.length;i++){if(!YAHOO.rrs.shoeDog.ref2QIs[initOrder[i]]){continue;}
var size=0;var keyName=null;for(key in YAHOO.rrs.shoeDog.ref2QIs[initOrder[i]]){size++;if(size==1){keyName=key;}}
if(size==1||"Color"==initOrder[i]){swatchQISet($(initOrder[i]+";"+keyName),initOrder[i]);if("Color"==initOrder[i]){changeSkuImage($(initOrder[i]+";"+keyName));}}}}
var initRef2QITitles=function(){var colorEl=$("Color;"+YAHOO.rrs.shoeDog.ref2QIsS.Color);$('ref2QIColorTitle').innerHTML=(colorEl)?colorEl.name:"";$('ref2QIColorTitleS').innerHTML=(colorEl)?colorEl.name:"";var sizeEl=$("Size;"+YAHOO.rrs.shoeDog.ref2QIsS.Size);$('ref2QISizeTitle').innerHTML=(sizeEl)?getRef2Value(sizeEl):"";$('ref2QISizeTitleS').innerHTML=(sizeEl)?(", "+getRef2Value(sizeEl)):"";var widthEl=$("Width;"+YAHOO.rrs.shoeDog.ref2QIsS.Width);$('ref2QIWidthTitle').innerHTML=(widthEl)?widthEl.name:"";$('ref2QIWidthTitleS').innerHTML=(widthEl)?(", "+widthEl.name):"";$('ref2QIPriceTitleS').innerHTML=(YAHOO.rrs.shoeDog.ref2QIsS.Price)?", "+YAHOO.rrs.shoeDog.ref2QIsS.Price:"";}
var isRef2NotAvailable=function(el){if(!el||!el.id){return true;}
var elIds=el.id.split(";");var na=!elIds||elIds.length!=2||!YAHOO.rrs.shoeDog.ref2s[elIds[0]]||!YAHOO.rrs.shoeDog.ref2s[elIds[0]][elIds[1]]||"on"!=YAHOO.rrs.shoeDog.ref2s[elIds[0]][elIds[1]].status;return na;}
var isRef2Selected=function(el){if(!el||!el.id){return false;}
var elIds=el.id.split(";");var selected=elIds&&elIds.length>0&&YAHOO.rrs.shoeDog.ref2sS[elIds[0]]&&elIds[1]==YAHOO.rrs.shoeDog.ref2sS[elIds[0]];return selected;}
var isRef2QISelected=function(el){if(!el||!el.id){return false;}
var elIds=el.id.split(";");var selected=elIds&&elIds.length>0&&YAHOO.rrs.shoeDog.ref2QIsS[elIds[0]]&&elIds[1]==YAHOO.rrs.shoeDog.ref2QIsS[elIds[0]];return selected;}
var getRef2Url=function(el){var urlRef="#";if(!el||!el.id){return urlRef;}
var elIds=el.id.split(";");if(!elIds||elIds.length!=2||!YAHOO.rrs.shoeDog.ref2s[elIds[0]]||!YAHOO.rrs.shoeDog.ref2s[elIds[0]][elIds[1]]||!YAHOO.rrs.shoeDog.ref2s[elIds[0]][elIds[1]].url||YAHOO.rrs.shoeDog.ref2s[elIds[0]][elIds[1]].url.length==0){return urlRef;}
return YAHOO.rrs.shoeDog.ref2s[elIds[0]][elIds[1]].url;}
var getRef2Value=function(el){var value="";if(!el||!el.id){return value;}
var elIds=el.id.split(";");if(!elIds||elIds.length!=2){return value;}
return elIds[1];}
var getRef2QIValue=function(el){var value="";if(!el||!el.name){return value;}
return el.name;}
var initRef2sDivs=function(refType){var PREFIX='ref2';var cls=PREFIX+refType;var prnt=PREFIX+refType+'Cont';var els=YAHOO.util.Dom.getElementsByClassName(cls,'a',prnt);for(var i=0;i<els.length;i++){if(isRef2NotAvailable(els[i])){els[i].href="#";els[i].title=getRef2Value(els[i])+": Not available";DHTML.addClass(els[i],"ref2NActive");}else{els[i].href=getRef2Url(els[i]);els[i].title=getRef2Value(els[i])+": In Stock";DHTML.removeClass(els[i],"ref2NActive");}
if(isRef2Selected(els[i])){DHTML.replaceClass(els[i],"ref2NActive","ref2Selected");els[i].title=getRef2Value(els[i])+": In Stock";}else{DHTML.removeClass(els[i],"ref2Selected");}}}
var initRef2PathsDivs=function(refType){var PREFIX="ref2";var cls=PREFIX+"Clear";var prnt=PREFIX+refType+"ClearCont";var els=YAHOO.util.Dom.getElementsByClassName(cls,"a",prnt);for(var i=0;i<els.length;i++){if(isRef2PathNotAvailable(refType)){els[i].href="#";DHTML.replaceClass(prnt,"display","hide");els[i].onclick=function(){return false;};}else{els[i].href=getRef2PathUrl(refType);DHTML.replaceClass(prnt,"hide","display");els[i].onclick=function(){clearSet(this);return false;};}}}
var getRef2PathUrl=function(refType){var urlRef="#";if(!refType){return urlRef;}
if(!YAHOO.rrs.shoeDog.ref2Paths[refType]||YAHOO.rrs.shoeDog.ref2Paths[refType].length==0){return urlRef;}
return YAHOO.rrs.shoeDog.ref2Paths[refType];}
var isRef2PathNotAvailable=function(refType){var na=true;if(!refType){return na;}
na=(!YAHOO.rrs.shoeDog.ref2Paths[refType]||YAHOO.rrs.shoeDog.ref2Paths[refType].length==0);return na;}
var initRef2s=function(refType){var PREFIX='ref2';var cls=PREFIX+refType;var prnt=PREFIX+refType+'Cont';var ttl=refType;var ttlId=PREFIX+refType+'Title';var els=YAHOO.util.Dom.getElementsByClassName(cls,'a',prnt);for(var i=0;i<els.length;i++){els[i].onclick=function(){swatchSet(this,ttl);return false;};els[i].onmouseover=function(){swatchOn(this,ttlId);};els[i].onmouseout=function(){swatchOff(this,ttlId,ttl);};}}
var initWait=function(){if(!YAHOO.rrs.shoeDog.wait){YAHOO.rrs.shoeDog.wait=new YAHOO.widget.Panel("wait",{xy:[DHTML.pageX($('productsCont'))+DHTML.width($('productsCont'))/2-115,400],width:"230px",fixedcenter:false,close:false,draggable:false,modal:true,zindex:10,visible:false});YAHOO.rrs.shoeDog.wait.setHeader("Loading ...");YAHOO.rrs.shoeDog.wait.setBody("<div style='text-align:center;'><img src='/rrs/img/shoe_dog/products_loader.gif' border='0' alt=''/></div>");YAHOO.rrs.shoeDog.wait.render(document.body);}
YAHOO.rrs.shoeDog.wait.show();}
var changeSkuImage=function(el){if(!el||!el.id){return;}
if(YAHOO.rrs.shoeDog.ref2QIsImgs[el.id]&&$("quickInfoSkuImage").src!=YAHOO.rrs.shoeDog.ref2QIsImgs[el.id].src){$("quickInfoSkuImage").src=YAHOO.rrs.shoeDog.ref2QIsImgs[el.id].src;}}
var getSkuImageUrl=function(el){if(!el||!el.id){return null;}
var elIds=el.id.split(";");if(!elIds||elIds.length!=2||elIds[0]!="Color"){return null;}
var imageUrl=new String(el.href);imageUrl=imageUrl.substring(0,imageUrl.indexOf("_SW"));return imageUrl;}
var productActive=function(el,qId){el.style.border="1px #ccc solid";DHTML.display('quickInfo'+qId);}
var productNotActive=function(el,qId){el.style.border="1px #fff solid";DHTML.hide('quickInfo'+qId);}
var hide=function(elId){$(elId).style.display="none";}
var display=function(elId){$(elId).style.display="block";}
var handleGo=function(el){DHTML.hide('sortList1');getAllProducts(el.href);}
var handleSortBy=function(el){DHTML.hide('sortList');getAllProducts(el.href);}
var setBgcolor=function(liEl){liEl.style.background="#fff";}
var unsetBgcolor=function(liEl){liEl.style.background="#ccc";}
var swatchOn=function(el,elId){var stateCls=(isRef2NotAvailable(el)&&!isRef2Selected(el))?"ref2NActiveSwatch":"ref2ActiveSwatch";DHTML.addClass(el,stateCls);}
var swatchOff=function(el,elId,curElId){DHTML.removeClass(el,"ref2NActiveSwatch");DHTML.removeClass(el,"ref2ActiveSwatch");}
var swatchSet=function(el,elId){if(isRef2NotAvailable(el)){return false;}
setRef2Selected(el);getAll(el.href);}
var setRef2Selected=function(el){if(!el||!el.id){return;}
var elIds=el.id.split(";");if(!elIds||elIds.length!=2){return;}
YAHOO.rrs.shoeDog.ref2sS[elIds[0]]=elIds[1];}
var setRef2QISelected=function(el){if(!el||!el.id){return;}
var elIds=el.id.split(";");if(!elIds||elIds.length!=2){return;}
YAHOO.rrs.shoeDog.ref2QIsS[elIds[0]]=elIds[1];}
var clearSet=function(el){YAHOO.rrs.shoeDog.ref2sS={};getAll(el.href);}
var getQIRef2s=function(refType){var PREFIX='ref2QI';var cls=PREFIX+refType;var prnt=PREFIX+refType+'Cont';return YAHOO.util.Dom.getElementsByClassName(cls,'a',prnt);}
var initQIRef2sDivs=function(refType){var els=getQIRef2s(refType);for(var i=0;i<els.length;i++){if(isRef2QINotAvailable(els[i])){els[i].title=getRef2QIValue(els[i])+": Not available";DHTML.addClass(els[i],"ref2NActive");displayRef2QINAMsg(els[i],true);}else{DHTML.removeClass(els[i],"ref2NActive");els[i].title=getRef2QIValue(els[i])+": In Stock";displayRef2QINAMsg(els[i],false);}
if(isRef2QISelected(els[i])){DHTML.replaceClass(els[i],"ref2NActive","ref2Selected");}else{DHTML.removeClass(els[i],"ref2Selected");}}}
var initQIRef2s=function(refType){var PREFIX='ref2QI';var ttl=refType;var ttlId=PREFIX+refType+'Title';var els=getQIRef2s(refType);for(var i=0;i<els.length;i++){els[i].onclick=function(){swatchQISet(this,ttl);return false;};els[i].onmouseover=function(){swatchQIOn(this,ttlId);};els[i].onmouseout=function(){swatchQIOff(this,ttlId,ttl);};}}
var displayAvailability=function(el,na){var stateCls=(na&&!isRef2QISelected(el))?"ref2NActiveSwatch":"ref2ActiveSwatch";DHTML.addClass(el,stateCls);}
var displayAssocAvailability=function(na,el){if(na){DHTML.removeClass(el,"ref2NActive");DHTML.addClass(el,"ref2NActive");}else{DHTML.removeClass(el,"ref2NActive");}
displayRef2QINAMsg(el,na);}
var displayRef2QINAMsg=function(el,na){if(isRef2QISelected(el)&&na){DHTML.addClass(el,"refNotAvailable");el.title="Not available for current selection";}else{DHTML.removeClass(el,"refNotAvailable");}}
var displayAssocsAvailability=function(el,refType){var els=getQIRef2s(refType);for(var i=0;i<els.length;i++){displayAssocAvailability(isRef2QIAssocNotAvailable(el,els[i]),els[i]);}}
var swatchQIOn=function(el,elId){$(elId).innerHTML=el.name;changeSkuImage(el);displayAvailability(el,isRef2QINotAvailable(el));var assoc=getAssocs(el);if(assoc){for(key in assoc){displayAssocsAvailability(el,key);}}}
var getAssocs=function(el){var res=[];if(!el||!el.id){return res;}
var elIds=el.id.split(";");if(elIds&&elIds.length==2&&YAHOO.rrs.shoeDog.ref2QIs[elIds[0]]&&YAHOO.rrs.shoeDog.ref2QIs[elIds[0]][elIds[1]]){res=YAHOO.rrs.shoeDog.ref2QIs[elIds[0]][elIds[1]];}
return res;}
var swatchQIOff=function(el,elId,curElId){changeSkuImage($("Color;"+YAHOO.rrs.shoeDog.ref2QIsS.Color));initRef2QITitles();DHTML.removeClass(el,"ref2NActiveSwatch");DHTML.removeClass(el,"ref2ActiveSwatch");initQIRef2sDivs('Width');initQIRef2sDivs('Size');initQIRef2sDivs('Color');}
var swatchQISet=function(el,elId){setRef2QISelected(el);if(YAHOO.rrs.shoeDog.ref2QIsS["Size"]){DHTML.replaceClass($("selSizeTitle"),"selectRef","origRef");$("selSizeImg").src="/rrs/img/quick_info/arrow_right.gif";}
if(YAHOO.rrs.shoeDog.ref2QIsS["Width"]){DHTML.replaceClass($("selWidthTitle"),"selectRef","origRef");$("selWidthImg").src="/rrs/img/quick_info/arrow_right.gif";}
initRef2QITitles();var elIds=el.id.split(";");if(YAHOO.rrs.shoeDog.ref2QIs){for(key in YAHOO.rrs.shoeDog.ref2QIs){if(key!=elIds[0]){for(key2 in YAHOO.rrs.shoeDog.ref2QIs[key]){var rf2=YAHOO.rrs.shoeDog.ref2QIs[elIds[0]][elIds[1]][key][key2];YAHOO.rrs.shoeDog.ref2QIs[key][key2].status=(rf2)?rf2:"off";}}}}
initQIRef2sDivs('Width');initQIRef2sDivs('Size');initQIRef2sDivs('Color');checkAddToCart();}
var getSkuId=function(productId){var skuId=productId+"-";var colorStr=new String(YAHOO.rrs.shoeDog.ref2QIsS.Color);if(colorStr&&colorStr.indexOf("$")==-1){skuId+=YAHOO.rrs.shoeDog.ref2QIsS.Color+"-";}
skuId+=YAHOO.rrs.shoeDog.ref2QIsS.Size+"-"+YAHOO.rrs.shoeDog.ref2QIsS.Width;return skuId;}
var checkAddToCart=function(){var na=isRef2QINotAvailable($("Color;"+YAHOO.rrs.shoeDog.ref2QIsS.Color))||isRef2QINotAvailable($("Size;"+YAHOO.rrs.shoeDog.ref2QIsS.Size))||isRef2QINotAvailable($("Width;"+YAHOO.rrs.shoeDog.ref2QIsS.Width));var price=null;if(!na){var skuId=getSkuId(YAHOO.rrs.shoeDog.ref2QIsS.Product);price=YAHOO.rrs.shoeDog.skusPrc[skuId];}
if(na||!price){$('addToCartButton').src=YAHOO.rrs.shoeDog.imgs["dis"].src;if(YAHOO.rrs.shoeDog.ref2QIsS.Color&&YAHOO.rrs.shoeDog.ref2QIsS.Size&&YAHOO.rrs.shoeDog.ref2QIsS.Width){DHTML.display("selNotAvailable");}}else{$('addToCartButton').src=YAHOO.rrs.shoeDog.imgs["en"].src;DHTML.hide("selNotAvailable");}
YAHOO.rrs.shoeDog.ref2QIsS["Price"]=(price)?"$"+price:null;$('ref2QIPriceTitleS').innerHTML=(price)?", $"+price:"";return(!na&&price);}
var isRef2QINotAvailable=function(el){if(!el||!el.id){return true;}
var elIds=el.id.split(";");var na=!elIds||elIds.length!=2||!YAHOO.rrs.shoeDog.ref2QIs[elIds[0]]||!YAHOO.rrs.shoeDog.ref2QIs[elIds[0]][elIds[1]]||"on"!=YAHOO.rrs.shoeDog.ref2QIs[elIds[0]][elIds[1]].status;return na;}
var isRef2QIAssocNotAvailable=function(el,assocEl){if(!el||!el.id||!assocEl||!assocEl.id){return true;}
var elIds=el.id.split(";");var assocElIds=assocEl.id.split(";");var na=!elIds||elIds.length!=2||!assocElIds||assocElIds.length!=2||!YAHOO.rrs.shoeDog.ref2QIs[elIds[0]]||!YAHOO.rrs.shoeDog.ref2QIs[elIds[0]][elIds[1]]||!YAHOO.rrs.shoeDog.ref2QIs[elIds[0]][elIds[1]][assocElIds[0]]||!YAHOO.rrs.shoeDog.ref2QIs[elIds[0]][elIds[1]][assocElIds[0]][assocElIds[1]];return na;}
var ref1El=null;var ref2ElContId=null;var setRef1ItemBgcolor=function(el,state){if(state){DHTML.replaceClass(el,"ref1ContNActive","ref1ContActive");}else if(el!=ref1El){DHTML.replaceClass(el,"ref1ContActive","ref1ContNActive");}}
var ref1ItemOn=function(ref1){DHTML.removeClass(ref1,"sfRef1ItemDescActive");DHTML.removeClass(ref1,"sfRef1ItemDesc");DHTML.addClass(ref1,"sfRef1ItemDescActive");}
var ref1ItemOff=function(refId){if(doesRef1DescMatch(refId)){DHTML.removeClass(refId,"sfRef1ItemDescActive");DHTML.removeClass(refId,"sfRef1ItemDesc");DHTML.addClass(refId,"sfRef1ItemDescActive");}else{DHTML.removeClass(refId,"sfRef1ItemDescActive");DHTML.removeClass(refId,"sfRef1ItemDesc");DHTML.addClass(refId,"sfRef1ItemDesc");}}
var doesRef1DescMatch=function(el){if(!el){return false;}
var elId=el.split(";");if(!elId||elId.length!=2){return false;}
var match=true;var data=YAHOO.rrs.shoeDog.ref1sD[elId[0]];if(!data||!data.split(":")||data.split(":").length!=2||elId[1]!=data.split(":")[0]){match=false;}
return match;}
var openRef2Contents=function(el,item){var ref2ContId='ref2'+item+'Cont';if(ref2ElContId){closeRef2Contents(ref2ElContId,el,ref2ContId);}else{if(getCategoriesScore2()==0){if($("shoeDogHome")){DHTML.replaceClass("shoeDogHome","display","hide");}}
doOpenRef2Contents(el,ref2ContId);}}
var doOpenRef2Contents=function(el,ref2ContId){if("ref2SurfaceCont"==ref2ContId&&YAHOO.rrs.shoeDog.ref1sD["Gender"]){var gender=YAHOO.rrs.shoeDog.ref1sD["Gender"].split(":");if(gender&&gender.length==2){var n1=("womens"==gender[0])?"male":"female";var n2=("womens"==gender[0])?"female":"male";DHTML.replaceClass("ref1RoadBg","terrain_1"+n1,"terrain_1"+n2);DHTML.replaceClass("ref1TrailBg","terrain_2"+n1,"terrain_2"+n2);DHTML.replaceClass("ref1ComboBg","terrain_3"+n1,"terrain_3"+n2);}}
if("ref2WeightCont"==ref2ContId&&YAHOO.rrs.shoeDog.ref1sD["Gender"]){var gender=YAHOO.rrs.shoeDog.ref1sD["Gender"].split(":");if(gender&&gender.length==2){if("womens"==gender[0]){$("Weight;Small").innerHTML="Small<br/>(under 120 lbs)";$("Weight;Small;a").title="Small: under 120 lbs";$("Weight;Medium").innerHTML="Medium<br/>(120 - 150 lbs)";$("Weight;Medium;a").title="Medium: 120 - 150 lbs";$("Weight;Large").innerHTML="Large<br/>(150+ lbs)";$("Weight;Large;a").title="Large: 150+ lbs";}else{$("Weight;Small").innerHTML="Small<br/>(under 150 lbs)";$("Weight;Small;a").title="Small: under 150 lbs";$("Weight;Medium").innerHTML="Medium<br/>(150 - 180 lbs)";$("Weight;Medium;a").title="Medium: 150 - 180 lbs";$("Weight;Large").innerHTML="Large<br/>(180+ lbs)";$("Weight;Large;a").title="Large: 180+ lbs";}}}
if("ref1GenderItem"==el.id&&getCategoriesScore2()==0){DHTML.replaceClass("ref1GenderItem","ref1ContNActive","ref1StartActive");}else{DHTML.replaceClass(el,"ref1ContNActive","ref1ContActive");}
YAHOO.rrs.shoeDog.ref1Anim1=new YAHOO.util.Anim('ref1Contents',{width:{to:775}},0.3,YAHOO.util.Easing.easeOut);YAHOO.rrs.shoeDog.ref1Anim1.onComplete.subscribe(function(){DHTML.display(ref2ContId);});YAHOO.rrs.shoeDog.ref1Anim1.animate();ref1El=el;ref2ElContId=ref2ContId;}
var processSubmit=function(el){var total=getCategoriesScore();if(total<0){return false;}
var shoeCategory=null;var shoeType=null;if(total==100||total==110||total==200||total==210||total==300||total==310||total==401||total==411||total==501||total==511||total==601||total==611){shoeCategory=NEUTRAL;shoeType=1;}else if(total==400||total==410||total==500||total==510||total==600||total==610){shoeCategory=NEUTRALPLUS;shoeType=4;}else if(total==101||total==111||total==201||total==211||total==301||total==311){shoeCategory=NEUTRALPERFORMANCE;shoeType=2;}else if(total==120||total==130||total==140||total==220||total==230||total==240||total==320||total==330||total==340||total==421||total==431||total==441||total==521||total==531||total==541||total==621||total==631||total==641){shoeCategory=STABILITY;shoeType=8;}else if(total==420||total==430||total==440||total==520||total==530||total==540||total==620||total==630||total==640){shoeCategory=STABILITYPLUS;shoeType=32;}else if(total==121||total==131||total==141||total==221||total==231||total==241||total==321||total==331||total==341){shoeCategory=STABILITYPERFORMANCE;shoeType=16;}else if(total==150||total==160||total==250||total==260||total==350||total==360||total==151||total==161||total==251||total==261||total==351||total==361||total==451||total==461||total==551||total==561||total==651||total==661){shoeCategory=MOTIONCONTROL;shoeType=128;}else if(total==450||total==460||total==550||total==560||total==650||total==660){shoeCategory=MOTIONCONTROLPLUS;shoeType=64;}
processShoeCategories(shoeCategory,shoeType,total);}
var getCategoriesScore=function(){var total=0;for(key in YAHOO.rrs.shoeDog.ref1sD){var item=YAHOO.rrs.shoeDog.ref1sD[key];if(!item||item.length==0){total=-1;break;}else{var value=item.split(":");if(!value&&value.length!=2){total=-1;break;}
var value=parseInt(value[1]);if(value>=-10){total+=value;}}}
return total;}
var getCategoriesScore2=function(){var total=0;for(key in YAHOO.rrs.shoeDog.ref1sD){var item=YAHOO.rrs.shoeDog.ref1sD[key];if(!item||item.length==0){continue;}else{var value=item.split(":");if(!value&&value.length!=2){continue;}
var value=parseInt(value[1]);if(value<0){value*=-1;}
total+=value;}}
return total;}
var processShoeCategories=function(type,shoeType,total){initRef2sS();var gender=YAHOO.rrs.shoeDog.ref1sD["Gender"].split(":");var surface=YAHOO.rrs.shoeDog.ref1sD["Surface"].split(":");if(!type||!gender||!surface){alert("Query params are missing. Contact support (Code:"+shoeType+").");return false;}
var terrain=surface[0];if("Trail"==terrain&&(STABILITYPERFORMANCE==type||NEUTRALPLUS==type||NEUTRALPERFORMANCE==type||MOTIONCONTROL==type||MOTIONCONTROLPLUS==type)){terrain="Combo";}
var query='&Query='+gender[0]+terrain+type+'&shoeType='+shoeType+'&refAction=-1';if(shoeType&&total){query+='&type='+type+'&score='+total;}
getAll(query,'true');return false;}
var closeRef2Contents=function(ref2ContId,el,ref2NewContId){var emptyRef1=getEmptyRef1();if($("shoeDogHome")){if(emptyRef1){DHTML.replaceClass("shoeDogHome","display","hide");DHTML.replaceClass("shoeDogHome","shoeDogHome","shoeDogHome2");}else{DHTML.replaceClass("shoeDogHome","hide","display");}}
DHTML.hide(ref2ContId);if(getCategoriesScore2()==0){DHTML.removeClass("ref1GenderItem","ref1StartActive");}
DHTML.replaceClass(ref1El,"ref1ContActive","ref1ContNActive");ref1El=null;ref2ElContId=null;YAHOO.rrs.shoeDog.ref1Anim2=new YAHOO.util.Anim('ref1Contents',{width:{to:-1}},0.2,YAHOO.util.Easing.backIn);if(el&&ref2NewContId){YAHOO.rrs.shoeDog.ref1Anim2.onComplete.subscribe(function(){doOpenRef2Contents(el,ref2NewContId);});}
YAHOO.rrs.shoeDog.ref1Anim2.animate();}
var closeRef21Contents=function(itemData,itemUI,container,title,selId,titleId){var paramsData=itemData.split(":");if(paramsData&&paramsData.length==3){YAHOO.rrs.shoeDog.ref1sD[paramsData[0]]=paramsData[1]+':'+paramsData[2];}
if(getCategoriesScore2()!=0){DHTML.removeClass("ref1GenderItem","ref1StartActive");DHTML.removeClass("ref1GenderItem","ref1Start");}
setRef1Titles();var paramsUI=itemUI.split(":");if(paramsUI&&paramsUI.length==2){YAHOO.rrs.shoeDog.ref1s[paramsUI[0]]=paramsUI[1];}
$(selId).innerHTML=title;var emptyRef1=getEmptyRef1();var isSpec=isSpecDone();if(emptyRef1&&isSpec){openRef2Contents($('ref1'+emptyRef1+'Item'),emptyRef1);}else if(isSpec){closeRef2Contents(container);checkSubmit();}}
var setRef1Titles=function(){var els=YAHOO.util.Dom.getElementsByClassName("ref1Ttl","span","ref1Contents");for(var i=0;i<els.length;i++){if(doesRef1DescMatch(els[i].id)){DHTML.removeClass(els[i],"sfRef1ItemDescActive");DHTML.removeClass(els[i],"sfRef1ItemDesc");DHTML.addClass(els[i],"sfRef1ItemDescActive");}else{DHTML.removeClass(els[i],"sfRef1ItemDescActive");DHTML.removeClass(els[i],"sfRef1ItemDesc");DHTML.addClass(els[i],"sfRef1ItemDesc");}}}
var isSpecDone=function(){var spec1=(!YAHOO.rrs.shoeDog.ref1sD.Weight)&&(!YAHOO.rrs.shoeDog.ref1sD.Miles);var spec2=(YAHOO.rrs.shoeDog.ref1sD.Weight)&&(YAHOO.rrs.shoeDog.ref1sD.Miles);return spec1||spec2;}
var getEmptyRef1=function(){var ref1=null;for(key in YAHOO.rrs.shoeDog.ref1s){if(!YAHOO.rrs.shoeDog.ref1s[key]||YAHOO.rrs.shoeDog.ref1s[key].length==0){ref1=key;break;}}
return ref1;}
var checkSubmit=function(){var score=getCategoriesScore();var clz=new String($("submitItem").className);if(score>0&&clz.indexOf("submitd")>0){DHTML.replaceClass($("submitItem"),"submitd","submit");}}
var checkWait=function(prds,all){if(prds){if(all){initRef2s('Size');initRef2s('Brand');}
initRef2sDivs('Size');initRef2sDivs('Brand');initRef2PathsDivs('Brand');initRef2PathsDivs('Size');}
YAHOO.rrs.shoeDog.wait.hide();}
var getAjaxParams=function(urlParams){var str=new String(urlParams);return str.replace(/;/g,"&");}
var getAllProducts=function(urlParams){initWait();var ajaxParams=getAjaxParams(urlParams);ajax('POST','/rrs/shoe-dog/ajaxShoeDog.jsp',ajaxParams,function(r){var resp=r.responseText.split(RRS_DELIM);if(resp[0]){$('navigationCont').innerHTML=resp[0];}
if(resp[1]){$('productsCont').innerHTML=resp[1];}
YAHOO.rrs.shoeDog.wait.hide();},function(r){var resp=r.responseText.split(RRS_DELIM);$('navigationCont').innerHTML="Error generating products navigation";$('productsCont').innerHTML="Error running products search";YAHOO.rrs.shoeDog.wait.hide();});}
var getAll=function(urlParams,all){initWait();getProducts(urlParams,all);}
var getProducts=function(urlParams,all){var ajaxParams=getAjaxParams(urlParams);ajax('POST','/rrs/shoe-dog/ajaxShoeDog.jsp',ajaxParams,function(r){var resp=r.responseText.split(RRS_DELIM);if(resp[0]){$('navigationCont').innerHTML=resp[0];}
if(resp[1]){$('productsCont').innerHTML=resp[1];}
if(all&&resp[2]){$('refinementsCont').innerHTML=resp[2];}
if(resp[3]){YAHOO.rrs.shoeDog.ref2s=eval("("+resp[3]+")");}
if(resp[4]){YAHOO.rrs.shoeDog.ref2Paths=eval("("+resp[4]+")");}
checkWait((resp&&resp.length>3),all);},function(r){var resp=r.responseText.split(RRS_DELIM);$('navigationCont').innerHTML="";$('productsCont').innerHTML="<div style='text-align:center;'>An error occurred while getting products details. <br/> Please contact support.</div>";$('refinementsCont').innerHTML="";checkWait(false,all);});}
var hideProductDetails=function(){DHTML.hide("productDetails");YAHOO.rrs.shoeDog.productDetails.hide();}
var showProductDetails=function(){if(!YAHOO.rrs.shoeDog.productDetails){YAHOO.rrs.shoeDog.productDetails=new YAHOO.widget.Panel("productDetails",{width:"710px",height:"410px",zIndex:PANELZINDEX,modal:false,close:true,fixedcenter:true,draggable:true,constraintoviewport:true});YAHOO.rrs.shoeDog.productDetails.render();}
YAHOO.rrs.shoeDog.productDetails.hide();DHTML.display("productDetails");YAHOO.rrs.shoeDog.productDetails.show();}
var viewProductDetails=function(id,shoeType){initQuickInfo();$('productDetailsContBd').innerHTML="Loading ...";$('productDetailsCont').innerHTML="<div style='height:100px;'>&nbsp;</div><div style='height:200px;text-align:center;'><img src='/rrs/img/quick_info/quick_info_loader.gif' alt='' border='0'/></div>";showProductDetails();var params='id='+id+'&shoeType='+shoeType;ajax('POST','/rrs/quick-info/quickInfoProduct.jsp',params,function(r){var resp=r.responseText.split(RRS_DELIM);if(resp[0]){$('productDetailsContBd').innerHTML=resp[0];}else{$('productDetailsContBd').innerHTML="Error";}
if(resp[1]){$('productDetailsCont').innerHTML=resp[1];}else{$('productDetailsCont').innerHTML="An error occurred while getting details for product #"+id;}
if(resp[2]){YAHOO.rrs.shoeDog.skusPrc=eval("("+resp[2]+")");}
if(resp[3]){YAHOO.rrs.shoeDog.skusInventory=eval("("+resp[3]+")");}
if(resp[4]){YAHOO.rrs.shoeDog.ref2QIs=eval("("+resp[4]+")");}
if(resp[5]){eval(resp[5]);}
checkProductDetailsWait(resp&&resp.length==6);},function(r){$('productDetailsContBd').innerHTML="Error";$('productDetailsCont').innerHTML="An error occurred while getting details for product #"+id;checkProductDetailsWait(false);});}
var checkProductDetailsWait=function(initRefs2){if(initRefs2){preloadSkusImgs();initQIRef2s("Width");initQIRef2sDivs("Width");initQIRef2s("Size");initQIRef2sDivs("Size");initQIRef2s("Color");initQIRef2sDivs("Color");initRef2QIsS();}
$('ref2QIPriceTitleS').innerHTML="";}
var preloadSkusImgs=function(){var els=getQIRef2s("Color");if(!els){return;}
var productUrl=null;var imgObj=null;for(var i=0;i<els.length;i++){var skuUrl=getSkuImageUrl(els[i]);if(skuUrl){imgObj=new Image();imgObj.src=skuUrl+"?wid=300&hei=300";YAHOO.rrs.shoeDog.ref2QIsImgs[els[i].id]=imgObj;productUrl=new String(skuUrl);}}
if(productUrl){productUrl=productUrl.substring(0,productUrl.indexOf("-"));imgObj=new Image();imgObj.src=productUrl+"?wid=300&hei=300";}}
var shoeDescription=function(divId,h,w){var ht=h+"px";var wd=(w)?w+"px":"500px";YAHOO.rrs.shoeDog.description=new YAHOO.widget.Panel(divId,{width:wd,height:ht,zIndex:PANELZINDEX,modal:false,close:true,fixedcenter:true,draggable:true,constraintoviewport:true});YAHOO.rrs.shoeDog.description.render();YAHOO.rrs.shoeDog.description.hide();DHTML.display(divId);YAHOO.rrs.shoeDog.description.show();}
var initRef1s=function(){if(!YAHOO.rrs.shoeDog.ref1sD){return;}
if(YAHOO.rrs.shoeDog.ref1sD["Gender"]){var gender=YAHOO.rrs.shoeDog.ref1sD["Gender"].split(":");if(gender&&gender.length==2){$("GenderSel").innerHTML=(gender[1]==-100)?"male":"female";YAHOO.rrs.shoeDog.ref1s["Gender"]="yes";}}
if(YAHOO.rrs.shoeDog.ref1sD["Surface"]){var surface=YAHOO.rrs.shoeDog.ref1sD["Surface"].split(":");if(surface&&surface.length==2){var st="road/indoor";if(surface[1]==-200){st="off road/trails";}else if(surface[1]==-300){st="all terrains";}
$("SurfaceSel").innerHTML=st;YAHOO.rrs.shoeDog.ref1s["Surface"]="yes";}}
if(YAHOO.rrs.shoeDog.ref1sD["ArchType"]){var arch=YAHOO.rrs.shoeDog.ref1sD["ArchType"].split(":");if(arch&&arch.length==2){var at="low";if(arch[1]==20){at="medium";}else if(arch[1]==10){at="high";}
$("ArchTypeSel").innerHTML=at;YAHOO.rrs.shoeDog.ref1s["ArchType"]="yes";}}
if(YAHOO.rrs.shoeDog.ref1sD["ShoeTilt"]){var tilt=YAHOO.rrs.shoeDog.ref1sD["ShoeTilt"].split(":");if(tilt&&tilt.length==2){var tt="inward";if(tilt[1]==0){tt="straight";}else if(tilt[1]==10){tt="outward";}
$("ShoeTiltSel").innerHTML=tt;YAHOO.rrs.shoeDog.ref1s["ShoeTilt"]="yes";}}
if(YAHOO.rrs.shoeDog.ref1sD["Injury"]){var injury=YAHOO.rrs.shoeDog.ref1sD["Injury"].split(":");if(injury&&injury.length==2){$("InjurySel").innerHTML=(injury[1]==10)?"yes":"no";YAHOO.rrs.shoeDog.ref1s["Injury"]="yes";}}
var weight=false;if(YAHOO.rrs.shoeDog.ref1sD["Weight"]){var weight=YAHOO.rrs.shoeDog.ref1sD["Weight"].split(":");if(weight&&weight.length==2){var wt="small";if(weight[1]==300){wt="medium";}else if(weight[1]==500){wt="large";}
$("WeightSel").innerHTML=wt;weight=true;}}
var miles=false;if(YAHOO.rrs.shoeDog.ref1sD["Miles"]){var miles=YAHOO.rrs.shoeDog.ref1sD["Miles"].split(":");if(miles&&miles.length==2){var mt="/low";if(miles[1]==100){mt="/high";}else if(miles[1]==1){mt="/fast";}
$("MilesSel").innerHTML=mt;miles=true;}}
if(weight&&miles){YAHOO.rrs.shoeDog.ref1s["Weight"]="yes";}}
var initQuickInfo=function(){YAHOO.rrs.shoeDog.skusPrc={};YAHOO.rrs.shoeDog.skusInventory={};YAHOO.rrs.shoeDog.ref2QIs={};YAHOO.rrs.shoeDog.ref2QIsS={"Color":"","Size":"","Width":"","Price":"","Product":""};YAHOO.rrs.shoeDog.ref2QIsImgs={};}
var initShoeDog=function(){YAHOO.rrs.shoeDog.ref2s={};YAHOO.rrs.shoeDog.ref2Paths={};YAHOO.rrs.shoeDog.ref1s={"Gender":"","Surface":"","ArchType":"","ShoeTilt":"","Injury":"","Weight":""};YAHOO.rrs.shoeDog.ref1sD={"Gender":null,"Surface":null,"ArchType":null,"ShoeTilt":null,"Injury":null,"Weight":null,"Miles":null};YAHOO.rrs.shoeDog.ref2sS={"Brand":"","Size":""};initQuickInfo();var shoeDogCookie=DHTML.getCookie("shoeDog");if(shoeDogCookie){var sdc=shoeDogCookie.split("$");if(sdc&&sdc.length>0){for(i=0;i<sdc.length;i++){var item=sdc[i].split(":");if(!item||item.length!=3){continue;}
YAHOO.rrs.shoeDog.ref1sD[item[0]]=item[1]+":"+item[2];}}}
if(getCategoriesScore2()==0){DHTML.addClass("ref1GenderItem","ref1Start");}
initRef1s();setRef1Titles();checkSubmit();processSubmit();}
var shoeDogOnBeforeUnload=function(){var shoeDogCookie="";if(YAHOO.rrs.shoeDog.ref1sD){for(key in YAHOO.rrs.shoeDog.ref1sD){var item=YAHOO.rrs.shoeDog.ref1sD[key];if(!item||item.length==0){continue;}else{var value=item.split(":");if(!value&&value.length!=2){continue;}
shoeDogCookie+=key+":"+value[0]+":"+value[1]+"$";}}
if(shoeDogCookie&&shoeDogCookie!=""){DHTML.setCookie("shoeDog",shoeDogCookie);}}}
var addProductToCart=function(secure){if(!validateSelection()||!validateInput(document.addToCartForm.quickInfoQty)){return;}
if(checkAddToCart()){var ajaxParams=getAddProductToCartParams();if(!ajaxParams){alert("Error: input params are missing.");return;}
ajax('POST','/rrs/quick-info/quickInfoAjaxAddToCart.jsp',ajaxParams,function(r){var resp=r.responseText.split(RRS_DELIM);if(resp[0]){eval(resp[0]);}
if(resp[1]){res=eval("("+resp[1]+")");}
hideProductDetails();if(res&&res["res"]&&res["res"]=="true"){var imageUrl=YAHOO.rrs.shoeDog.ref2QIsImgs["Color;"+YAHOO.rrs.shoeDog.ref2QIsS.Color].src;var productMsg=document.addToCartForm.productName.value;$("addToCartInfo").innerHTML="<div style='margin-left:10px;'><div style='float:left;'><img style='width:90px;height:80px;' alt='' src='"
+imageUrl+"' border='0'/></div><div style='float:left;margin:10px;'><span style='font-family:Verdana,regular;font-size:12px;font-weight:bold;'>"
+productMsg+"</span><br/><span style='font-family:Verdana,regular;font-size:12px;font-color:#660000;'>has been added to your cart</span>.</div><div style='clear:left;'></div></div>";updateShoppingCartSummary(secure);}else{$("addToCartInfo").innerHTML="An error occured while adding product to cart.<br/>Please contact support.";}
shoeDescription("addToCartInfo",100,400);initQuickInfo();},function(r){hideProductDetails();initQuickInfo();});}}
var updateShoppingCartSummary=function(secure){var ajaxParams="secure="+secure;ajax('POST','/rrs/common/shoppingCartSummary.jsp',ajaxParams,function(r){$("shoppingCartSummary").innerHTML=r.responseText;},function(r){});}
var getAddProductToCartParams=function(){var params=null;if(document.addToCartForm&&document.addToCartForm.productSelected&&document.addToCartForm.productSelected.value&&document.addToCartForm.quickInfoQty&&document.addToCartForm.quickInfoQty.value&&YAHOO.rrs.shoeDog.ref2QIsS.Color&&YAHOO.rrs.shoeDog.ref2QIsS.Size&&YAHOO.rrs.shoeDog.ref2QIsS.Width){params="productId="+document.addToCartForm.productSelected.value
+"&skuId="+getSkuId(document.addToCartForm.productSelected.value)
+"&qty="+document.addToCartForm.quickInfoQty.value;}
return params;}
var hasWhitespace=function(s){for(var i=0;i<s.length;i++){var c=s.charAt(i);if((c==" ")||(c=="\\t")||(c=="\\n")||(c=="\\r")){return true;}}}
var isDigit=function(c){return((c>="0")&&(c<="9"))}
var isInteger=function(s){if(!s||s.length==0){return false;}
for(var i=0;i<s.length;i++){var c=s.charAt(i);if(!isDigit(c)||hasWhitespace(c))
return false;}
return true;}
var validateInput=function(el){if(!el||!el.id){return false;}
if(!isInteger(el.value)){DHTML.replaceClass($(el.id+"Invalid"),"hide","display");DHTML.replaceClass($("selQtyTitle"),"origRef","selectRef");$("selQtyImg").src="/rrs/img/quick_info/please.gif";return false;}else{DHTML.replaceClass($(el.id+"Invalid"),"display","hide");DHTML.replaceClass($("selQtyTitle"),"selectRef","origRef");$("selQtyImg").src="/rrs/img/quick_info/arrow_right.gif";}
var skuId=getSkuId(document.addToCartForm.productSelected.value);if(skuId){var lim=YAHOO.rrs.shoeDog.skusInventory[skuId];if(lim&&parseInt(lim)>0&&parseInt(el.value)>parseInt(lim)){$("QuickInfoWarning.bd").innerHTML="You've ordered more than we have available.<br/> We have only "+lim+" left. Please update your order."
showRRSPopup('QuickInfoWarning','300',false);el.focus();return false;}}
return true;}
var validateSelection=function(){var res=true;if(!YAHOO.rrs.shoeDog.ref2QIsS["Size"]){DHTML.replaceClass($("selSizeTitle"),"origRef","selectRef");$("selSizeImg").src="/rrs/img/quick_info/please.gif";res=false;}else{DHTML.replaceClass($("selSizeTitle"),"selectRef","origRef");$("selSizeImg").src="/rrs/img/quick_info/arrow_right.gif";}
if(!YAHOO.rrs.shoeDog.ref2QIsS["Width"]){DHTML.replaceClass($("selWidthTitle"),"origRef","selectRef");$("selWidthImg").src="/rrs/img/quick_info/please.gif";res=false;}else{DHTML.replaceClass($("selWidthTitle"),"selectRef","origRef");$("selWidthImg").src="/rrs/img/quick_info/arrow_right.gif";}
return res;}