YAHOO.namespace('speedfc.account.orders');YAHOO.speedfc.account.orders={open_lines:[],currId:null,open:function(id){var cont=YAHOO.speedfc.account.orders.getCont(id);var btn=YAHOO.speedfc.account.orders.getBtn(id);YAHOO.speedfc.account.orders.currId=id;if(cont.childNodes.length==0){YAHOO.util.Connect.asyncRequest('POST',"/account/orderdetails",YAHOO.speedfc.account.orders.callback,"id="+id);}else{cont.style.display="block";cont.style.marginTop="-60px";cont.style.display="block";btn.style.visibility="hidden";}
YAHOO.speedfc.account.orders.open_lines.push(id);return false;},close:function(id){var cont=YAHOO.speedfc.account.orders.getCont(id);var btn=YAHOO.speedfc.account.orders.getBtn(id);cont.style.display="none";cont.style.marginTop="";btn.style.visibility="visible";var open_lines_index=YAHOO.speedfc.account.orders.getIndex(id,YAHOO.speedfc.account.orders.open_lines);if(open_lines_index!=-1){YAHOO.speedfc.account.orders.open_lines.splice(open_lines_index,1);}
return false;},callback:{success:function(o){var cont=YAHOO.speedfc.account.orders.getCont(YAHOO.speedfc.account.orders.currId);var btn=YAHOO.speedfc.account.orders.getBtn(YAHOO.speedfc.account.orders.currId);cont.innerHTML=o.responseText;cont.style.marginTop="-60px";cont.style.display="block";btn.style.visibility="hidden";return false;},failure:function(o){return false;}},getIndex:function(id,openlines_arr){for(var i=0;i<openlines_arr.length;i++){if(openlines_arr[i]==id)
return i;}
return-1;},getCont:function(id){var cont=document.getElementById("details_for_"+id);if(!cont){return false;}
return cont;},getBtn:function(id){var btn=document.getElementById("btn_details_"+id);if(!btn){return false;}
return btn;},saveOpen:function(){var hidden_div=document.getElementById('hidden_fields');for(var i=0;i<YAHOO.speedfc.account.orders.open_lines.length;i++){var input=document.createElement('input');input.type='hidden';input.name='open_lines[]';input.value=YAHOO.speedfc.account.orders.open_lines[i];hidden_div.appendChild(input);};document.getElementById('sorting').submit();}};;YAHOO.namespace('speedfc.account.utilities');YAHOO.speedfc.account.utilities={passwordPanel:null,deleteAddressPanel:null,openPasswordhelp:function(){var body='<div id="password_panel" style="position: relative;">'
+'<div id="password_panel_wrapper">'
+'<div style="text-align: right"><a href="#" onclick="YAHOO.speedfc.account.utilities.closePasswordHelp(); return false;"><img src="/images/panel_styles/default/close.jpg"></a></div>'
+'<div style="margin-top:5px">Your password must have 6 to 10 characters.</div>'
+'</div></div>';YAHOO.speedfc.account.utilities.passwordPanel=new YAHOO.speedfc.utilities.sfcPanel("password_panel");YAHOO.speedfc.account.utilities.passwordPanel.setProperties({width:"250px",constraintoviewport:true,fixedcenter:true,underlay:"none",visible:false,draggable:false,modal:true});YAHOO.speedfc.account.utilities.passwordPanel.setBody(body);YAHOO.speedfc.account.utilities.passwordPanel.show();return false;},closePasswordHelp:function(){YAHOO.speedfc.account.utilities.passwordPanel.hide();},prepareData:function(iForm){var elem=iForm.elements;var iPh=document.createElement("INPUT");iPh.type="hidden";iPh.name="billing[phone]";iPh.value=elem['billing[phone_area]'].value+'-'
+elem['billing[phone_prefix]'].value+'-'
+elem['billing[phone_suffix]'].value;iForm.appendChild(iPh);return true;},toggleLoginForgot:function(){var errors=YAHOO.util.Dom.get('signin-errors');var username=YAHOO.util.Dom.get('username');var password=YAHOO.util.Dom.get('password');if(errors)
YAHOO.util.Dom.setStyle(errors,'display','none');if(username)
YAHOO.util.Dom.removeClass(username,'form_error');if(password)
YAHOO.util.Dom.removeClass(password,'form_error');var login=document.getElementById('login_screen');var forgot=document.getElementById('forgot_screen');if(!login||!forgot)return;login.style.display=login.style.display=='none'?'block':'none';forgot.style.width=forgot.style.width=='0px'?'auto':'0px';forgot.style.height=forgot.style.height=='0px'?'auto':'0px';forgot.style.overflow=forgot.style.overflow=='hidden'?'':'hidden';},check_coppa:function(coppaBox){var submit_button_on=document.getElementById('submit_button_on');var submit_button_off=document.getElementById('submit_button_off');if(coppaBox.checked){submit_button_on.style.display='inline';submit_button_off.style.display='none';}else{submit_button_on.style.display='none';submit_button_off.style.display='inline';}},confirm_delete:function(url){YAHOO.speedfc.account.utilities.deleteAddressPanel=new YAHOO.speedfc.utilities.sfcPanel("message");YAHOO.speedfc.account.utilities.deleteAddressPanel.setProperty("width","350px");var body='<div style="text-align: right"><a href="#" onclick="YAHOO.speedfc.account.utilities.deleteAddressPanel.hide(); return false;"><img src="/images/panel_styles/default/close.jpg"></a></div>'
+"<p style='text-align:center;'>Please confirm you want to delete this address</p><br>"+'<div style="border:1px solid #BF6C11; width:59px; font-family:Arial; margin-left:130px; text-align:center;"><a style="padding:2px; text-decoration:none; margin:2px; display:block; background:#BF6C11; color:#fff; font-weight:bold;" href="'+url+'">DELETE</a></div>';YAHOO.speedfc.account.utilities.deleteAddressPanel.setBody(body);YAHOO.speedfc.account.utilities.deleteAddressPanel.show();}};;YAHOO.namespace('speedfc.cart.utilities');YAHOO.speedfc.cart.utilities={win:null,close_edit_divs:function(line_id){document.getElementById('cart_errors').style.display='none';for(var i=0;i<lines.length;i++){document.getElementById('edit_item_'+lines[i]).style.display="none";document.getElementById('closed_links_'+lines[i]).style.display="block";}
document.getElementById('color_size_'+line_id).style.display="block";},maxchars:function(obj,e,max){key=(document.all)?e.keyCode:e.which;if(obj.value.length>=max&&key!=8)
return false;return true;},open_edit_div:function(line_id){YAHOO.speedfc.cart.utilities.close_edit_divs(line_id);document.getElementById('edit_item_'+line_id).style.display="block";document.getElementById('closed_links_'+line_id).style.display="none";document.getElementById('color_size_'+line_id).style.display="none";},checkLineForm:function(line_id)
{var customError=document.getElementById('custom-alert');var alertCartDiv=document.getElementById('cart_errors');var errCount=0;if(alertCartDiv)alertCartDiv.style.display='none';if(customError)customError.innerHTML='';var e=document.getElementById('qty_select_'+line_id);if(e.value==null||e.value==''){customError.innerHTML=cartQtySelectError;errCount++;}
if(errCount){alertCartDiv.style.display='block';}
return(errCount==0);},openShippingServices:function(){if(this.win==null){YAHOO.speedfc.cart.utilities.win=new YAHOO.speedfc.utilities.sfcPanel('w_shippingServices');YAHOO.speedfc.cart.utilities.win.setHeader("Shipping rates");YAHOO.speedfc.cart.utilities.win.setProperties({width:"730px",constraintoviewport:true,fixedcenter:true,underlay:"none",visible:false,draggable:false,modal:true});var obj=document.getElementById('shipping_rates_ov_wrapper').innerHTML;YAHOO.speedfc.cart.utilities.win.setBody(obj);}
YAHOO.speedfc.cart.utilities.win.show();},enableContinueShopping:function(link){var sidebarlink=document.getElementById('continue_co_button');if(sidebarlink)
sidebarlink.innerHTML=link;var bottom_cartlink=document.getElementById('continue_cart_button');if(bottom_cartlink)
bottom_cartlink.innerHTML=link;},enableEditCart:function(link){var headerlink=document.getElementById('cart_hdr_btn');if(headerlink)
headerlink.innerHTML=link;},disableCartRemoveLink:function(line_id_clicked,line){if(!line_id_clicked){window.location=line.href;line_id_clicked=true;line.href='#';}
return false;},promoTextListener:function(e){var key=e.keyCode||e.which;if(key==13){console.log('enter');promo_apply=YAHOO.util.Dom.get('commit_promo');promo_hidden=YAHOO.util.Dom.get('commit_promo_enter_key');if(promo_hidden)promo_hidden.value=true;if(promo_apply)promo_apply.click();return false;}}};YAHOO.namespace('speedfc.cart.add');YAHOO.speedfc.cart.add={cart_overlay:null,timeOut:5000,header_cart_timeout:null,header_cart_timer:null,wishlist_add_to_cart:function(item_id,arr){if(arr.length==3){for(var i=0;i<arr.length;i++){if(arr[i]==''){return false;}}}
var postData='i='+item_id+'&c='+arr[0]+'&s='+arr[1]+'&q='+arr[2]+encodeURIComponent(window.location);var sUrl="/cart/ajaxadd";var callback={success:function(o){if(typeof weAreInCart!="undefined"&&weAreInCart==true){window.location.reload();return;}
if(o.responseText==undefined)return;if(typeof wait!='undefined')wait.hide();responses=o.responseText.split('<br />');YAHOO.speedfc.cart.add.open_header_cart(responses[0]);document.getElementById('shopping_bag_counter').innerHTML=responses[1];YAHOO.speedfc.product.detail.updateRecent();},failure:function(o){if(o.responseText==undefined)return;YAHOO.speedfc.cart.add.open_header_cart("There was an error while adding the item to your bag.");}};YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);},addVGCtoBag:function(item_id,item_color,item_size,item_qty,ship_to,is_egc){var postData='i='+item_id+'&c='+item_color+'&s='+item_size+'&q='+item_qty+'&egc='+is_egc+'&ost='+ship_to+'&st='+ship_to+'&url_from='+encodeURIComponent(window.location);var sUrl="/cart/ajaxadd";var callback={success:function(o){if(typeof weAreInCart!="undefined"&&weAreInCart==true){window.location.reload();return;}
if(o.responseText==undefined)return;var r;if(typeof(o.responseXML.documentElement.getElementsByTagName('html')[0].textContent)!='undefined'){r={responseText:o.responseXML.documentElement.getElementsByTagName('html')[0].textContent};eval(o.responseXML.documentElement.getElementsByTagName('coremetrics')[0].textContent);}else{r={responseText:o.responseXML.documentElement.getElementsByTagName('html')[0].childNodes[0].nodeValue};eval(o.responseXML.documentElement.getElementsByTagName('coremetrics')[0].childNodes[0].nodeValue);}
if(typeof wait!='undefined')wait.hide();responses=r.responseText.split('<br />');YAHOO.speedfc.cart.add.open_header_cart(responses[0]);var header_elements=responses[1].split('/');document.getElementById('shopping_bag_counter').innerHTML=header_elements[0];document.getElementById('shopping_bag_subtotal').innerHTML=header_elements[1];YAHOO.speedfc.product.detail.updateRecent();},failure:function(o){if(o.responseText==undefined)return;YAHOO.speedfc.cart.add.open_header_cart("There was an error while adding the item to your bag.");}};return YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);},open_header_cart:function(text){if(text==''){window.location='/cart';return;}
YAHOO.speedfc.cart.add.showCart(text);return false;},showCart:function(text){if(YAHOO.speedfc.product.wishlist.panel!=null){YAHOO.speedfc.product.wishlist.panel.hide();}
YAHOO.speedfc.cart.add.cart_overlay=new YAHOO.speedfc.utilities.sfcPanel('header_cart_last_item');YAHOO.speedfc.cart.add.cart_overlay.setProperties({width:'250px',context:['header_top_wrapper','tr','br'],fixedcenter:false,iframe:true,close:false,zindex:300,modal:false,constraintoviewport:false,scope:this});YAHOO.speedfc.cart.add.cart_overlay.setBody(text,true);YAHOO.speedfc.cart.add.cart_overlay.show();setTimeout('window.scrollTo(0, 0)',1);setTimeout("YAHOO.speedfc.cart.add.cart_overlay.hide();YAHOO.speedfc.cart.add.cart_overlay.setBody('');",YAHOO.speedfc.cart.add.timeOut);},beginCheckout:function(){YAHOO.speedfc.cart.add.cart_overlay.hide();window.location="/cart";},animate_header_element:function(id,rate,max){e=document.getElementById(id);if(typeof(e.style.maxHeight)=="undefined"){if(rate>0){e.style.display="block";}else{e.style.display="none";}
return false;}
h=parseInt(e.style.maxHeight)+rate;if(h>max)h=max;if(h<0)h=0;e.style.maxHeight=h+'px';if(h>0){e.style.display="block";}else{e.style.display="none";}
return(rate>0&&h<max)||(rate<0&&h>0);},animate_header_cart:function(dir){if(YAHOO.speedfc.cart.add.header_cart_timer)clearTimeout(YAHOO.speedfc.cart.add.header_cart_timer);if(dir>0){if(YAHOO.speedfc.cart.add.animate_header_element("header_cart_closed",-dir*50,30)){}
else if(YAHOO.speedfc.cart.add.animate_header_element("header_cart_open",dir*50,200)){}
else return;}else{if(YAHOO.speedfc.cart.add.animate_header_element("header_cart_open",dir*50,200)){}
else if(YAHOO.speedfc.cart.add.animate_header_element("header_cart_closed",-dir*50,30)){}
else{clearTimeout(YAHOO.speedfc.cart.add.header_cart_timeout);return;}}
YAHOO.speedfc.cart.add.header_cart_timer=setTimeout("YAHOO.speedfc.cart.add.animate_header_cart("+dir+")",100);},addedToCart:function(o){if(typeof weAreInCart!="undefined"&&weAreInCart==true){window.location.reload();return;}
if(typeof(o.responseText)=="undefined")return;var r;if(typeof(o.responseXML.documentElement.getElementsByTagName('html')[0].textContent)!='undefined'){r={responseText:o.responseXML.documentElement.getElementsByTagName('html')[0].textContent};eval(o.responseXML.documentElement.getElementsByTagName('coremetrics')[0].textContent);}else{r={responseText:o.responseXML.documentElement.getElementsByTagName('html')[0].childNodes[0].nodeValue};eval(o.responseXML.documentElement.getElementsByTagName('coremetrics')[0].childNodes[0].nodeValue);}
if(typeof wait!='undefined')wait.hide();var add_success=r.responseText.match(/added_to_cart_overlay/);var availability=r.responseText.match(/exceeds the available/);if(add_success){responses=r.responseText.split('<br />');YAHOO.speedfc.cart.add.open_header_cart(responses[0]);var header_elements=responses[1].split('/');document.getElementById('shopping_bag_counter').innerHTML=header_elements[0];document.getElementById('shopping_bag_subtotal').innerHTML=header_elements[1];YAHOO.speedfc.product.detail.updateRecent();if(typeof quickViewPanel!='undefined'){quickViewPanel.hide();}}
else if(availability){YAHOO.speedfc.cart.add.open_header_cart(r.responseText);if(typeof quickViewPanel!='undefined'){quickViewPanel.hide();}}
var restriction_limit=r.responseText.match(/<span class="hidden">restriction_limit<\/span>/);if(restriction_limit){YAHOO.speedfc.cart.add.open_header_cart(r.responseText);if(typeof quickViewPanel!='undefined'){quickViewPanel.hide();}}},processCartpopSearch:function(){var form=document.getElementById('cartpopSearchForm');if(form){var inputs=form.getElementsByTagName('input');var items_id="";var items_qty="";var all_zero=true;for(var i=0;i<inputs.length;i++){var input=inputs[i];var name=input.id;if(name.match(/qty_/)){var item_id=name.split('qty_');item_id=item_id[1];var item_qty=input.value;var separator=",";items_id+=item_id+separator;items_qty+=item_qty+separator;if(item_qty>0)
all_zero=false;YAHOO.speedfc.cart.add.removeErrorClass();}}
items_id=items_id.substr(0,items_id.lastIndexOf(","));items_qty=items_qty.substr(0,items_qty.lastIndexOf(","));if(items_id!=""&&items_qty!=""){if(all_zero){YAHOO.speedfc.cart.add.displayErrorAjax("Please enter a quantity");var first_input=inputs[0];if(first_input)
first_input.className+="form_error";}else
YAHOO.speedfc.cart.add.cartpopCheckAvailiability(form,items_id,items_qty);}}},processCartpopShoppingPageForm:function(){var form=document.getElementById('cartpopShoppingPageForm');if(form){var inputs=form.getElementsByTagName('input');var items_id="";var items_qty="";var inputs_position="";for(var i=0;i<inputs.length;i++){var input_id=document.getElementById("item_ids_"+i);var input_qty=document.getElementById("item_qty_"+i);if(input_id)
var item_id=input_id.value;if(input_qty){var item_qty=input_qty.value;YAHOO.speedfc.cart.add.removeErrorClass();}
if(item_qty&&item_id){var separator=",";items_id+=item_id+separator;items_qty+=item_qty+separator;inputs_position+=i+separator;}}
items_id=items_id.substr(0,items_id.lastIndexOf(","));items_qty=items_qty.substr(0,items_qty.lastIndexOf(","));inputs_position=inputs_position.substr(0,inputs_position.lastIndexOf(","));if(items_id!=""&&items_qty!=""&&inputs_position!=""){YAHOO.speedfc.cart.add.cartpopCheckAvailiability(form,items_id,items_qty,inputs_position);}else if(items_id==""&&items_qty==""){YAHOO.speedfc.cart.add.displayErrorAjax("Please enter an item number and quantity");var input_id=document.getElementById("item_ids_0");var input_qty=document.getElementById("item_qty_0");if(input_id)
input_id.className+="form_error";if(input_qty)
input_qty.className+="form_error";}else{YAHOO.speedfc.cart.add.displayErrorAjax("There as an error while adding items to your bag");}}},cartpopCheckAvailiability:function(form,items_id,items_qty,inputs_position){if(form){var postData='i='+items_id+'&q='+items_qty+'&f='+form.id;if(inputs_position)
postData+='&p='+inputs_position;var sUrl="/cartpop/checkAvailiability";var callback={success:function(o){if(o.responseText==undefined)return;var add_success=o.responseText.match(/cartpop_items_success/);var add_error=o.responseText.match(/cartpop_items_error/);if(add_success){form.submit();}else if(add_error){YAHOO.speedfc.cart.add.displayErrorAjax(o.responseText);var js_code=document.getElementById('highlight_script');if(js_code)
eval(js_code.innerHTML);var js_code2=document.getElementById('highlight_script2');if(js_code2)
eval(js_code2.innerHTML);var js_code3=document.getElementById('highlight_script3');if(js_code3)
eval(js_code3.innerHTML);var js_code4=document.getElementById('highlight_script4');if(js_code4)
eval(js_code4.innerHTML);}},failure:function(o){if(o.responseText==undefined)return;YAHOO.speedfc.cart.add.displayErrorAjax("There as an error while adding items to your bag");}};YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);}
return false;},displayErrorAjax:function(error_msg){var error_div=document.getElementById('flash_message_ajax');if(error_div){error_div.innerHTML="<div class='error'>"+error_msg+"</div>";error_div.style.display="block";var flash_msg_div=document.getElementById('flash_message');if(flash_msg_div){flash_msg_div.innerHTML='';flash_msg_div.style.display='none';}
setTimeout('window.scrollTo(0, 0)',1);}},removeErrorClass:function(){var top_form_name=document.getElementById("cartpopSearchForm");var bottom_form_name=document.getElementById("cartpopShoppingPageForm");var errorRegExp=/form_error/;if(top_form_name){var inputs=top_form_name.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){var input=inputs[i];if(input){if(input.className.match(errorRegExp))
input.className=input.className.replace(errorRegExp,"");}}}
if(bottom_form_name){var inputs=bottom_form_name.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){var input_qty=document.getElementById("item_qty_"+i);if(input_qty){if(input_qty.className.match(errorRegExp))
input_qty.className=input_qty.className.replace(errorRegExp,"");}
var input_id=document.getElementById("item_ids_"+i);if(input_id){if(input_id.className.match(errorRegExp))
input_id.className=input_id.className.replace(errorRegExp,"");}}}}};;YAHOO.namespace('speedfc.cart.checkout');YAHOO.speedfc.cart.checkout={why:'',win:'',showWhy:function(){YAHOO.speedfc.cart.checkout.why=new YAHOO.speedfc.utilities.sfcPanel("why_overlay");YAHOO.speedfc.cart.checkout.why.setHeader("Why create an account?");YAHOO.speedfc.cart.checkout.why.setBody(" ");YAHOO.speedfc.cart.checkout.why.show();return false;},openSecurityCode:function(type){var win_type=null;if(type=='gc'){win_type='w_giftCard';img_src='/images/cart/giftCardBack.gif';win_width='280px';}else{win_type='w_secureCode'
img_src='/images/cart/yankee_cvc.jpg';win_width='495px';};YAHOO.speedfc.cart.checkout.win=new YAHOO.speedfc.utilities.sfcPanel(win_type);var body="<div><a onclick='YAHOO.speedfc.cart.checkout.win.hide(); return false;' href='#'>"+"<img style='float:right' src='/images/panel_styles/default/close.jpg' class='close'>"+"</a>"+"<div><img alt='' src='"+img_src+"'></div></div>";YAHOO.speedfc.cart.checkout.win.setProperties({width:win_width});YAHOO.speedfc.cart.checkout.win.setBody(body);YAHOO.speedfc.cart.checkout.win.show();return false;},closeSecurityCode:function(){YAHOO.speedfc.cart.checkout.win.hide();return false;},toggleSameAsShipping:function(){var b=document.getElementById('same_shipping').checked;document.getElementById('billing_info_wrapper').style.display=b?"none":"block";},cc_type_change:function(o){},getshippingrates:function(is_cartpop,cart_nickname,clear_warnings){YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("continue"),'display','none');YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("continue_disabled"),'display','');if(typeof clear_warnings=="undefined")
clear_warnings=true;if(!is_cartpop)
is_cartpop=false;if(!cart_nickname)
cart_nickname="Me";var otherThis=this;var callback={success:function(o){eval(o.responseText);if(otherThis.onGetShippingRates){otherThis.onGetShippingRates();}},failure:function(o){}};var scc=document.getElementById('shipping_country');var scs=document.getElementById('shipping_state');var szp=document.getElementById('shipping_zip');postData='country_code='+scc.options[scc.selectedIndex].value
+'&state_code='+scs.options[scs.selectedIndex].value
+'&postal_code='+szp.value
+'&subtotal='+total_without_shipping
+'&cart_nickname='+cart_nickname
+'&clear_warnings='+clear_warnings;if(is_cartpop)
sUrl='/cartpop/getshiprate';else
sUrl='/checkout/getshiprate';YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);},orderSubmission:function(btn){if(btn.id=='gc_apply'){e=document.getElementById('gc_apply');e.style['display']='none';e=document.getElementById('gc_apply_notice');e.style['display']='block';e=document.getElementById('apply_giftcard');if(e)
e.value=true;}
if(btn.id=='commit'){btn.style['display']='none';e=document.getElementById('commit_notice');e.style['display']='block';if(typeof document.getElementById('commit2')!=undefined&&document.getElementById('commit2')!=null)
{e=document.getElementById('commit2');e.style['display']='none';e=document.getElementById('commit_notice2');e.style['display']='block';}}
if(btn.id=='commit2'){btn.style['display']='none';e=document.getElementById('commit_notice2');e.style['display']='block';if(typeof document.getElementById('commit')!=undefined&&document.getElementById('commit')!=null)
{e=document.getElementById('commit');e.style['display']='none';e=document.getElementById('commit_notice');e.style['display']='block';}}
document.billing.submit();return true;},recalculateSurcharge:function(){var s_method=document.getElementById('shipping_method').value;if(s_method&&document.getElementById('shipping_surcharge')){var callback={success:function(o){document.getElementById('shipping_surcharge').innerHTML=o.responseText;YAHOO.speedfc.cart.checkout.updateTotal();},failure:function(o){YAHOO.speedfc.utilities.common.alert('Error recalculating surcharge');}};postData='ship_method='+s_method;YAHOO.util.Connect.asyncRequest('POST','/cart/recalculateSurcharge',callback,postData);}},updateTotal:function(ship_nick){var sm=document.getElementById('shipping_method');if(typeof ship_nick=="undefined")ship_nick="Me";var total=0;var scost=0;var ship_array=YAHOO.util.Dom.getElementsByClassName('shipping_partial');if(sm){sm=sm.value;var desc=shipping_rates[sm]['desc'];scost=shipping_rates[sm]['val'];scost=scost.replace('$','');scost=parseFloat(scost.replace(',',''));var dropdown_value=scost;if(ship_array.length>0){for(var i in ship_array){if(ship_array[i].id!="ship_"+ship_nick){var tmp=ship_array[i].innerHTML.replace('$','');tmp=tmp.replace(',','');scost+=parseFloat(tmp);}else{var current_ship=document.getElementById(ship_array[i].id);if(current_ship)
current_ship.innerHTML=YAHOO.speedfc.cart.checkout.addCommas(dropdown_value.toFixed(2));var current_ship_label=document.getElementById('label'+ship_array[i].id);if(current_ship_label)
current_ship_label.innerHTML=desc;}}}
total=total_without_shipping+scost;total='$'+YAHOO.speedfc.cart.checkout.addCommas(total.toFixed(2));scost='$'+YAHOO.speedfc.cart.checkout.addCommas(scost.toFixed(2));document.getElementById('shipping_value').innerHTML=scost;document.getElementById('grand_total').innerHTML=total;}},addCommas:function(nStr){nStr+='';x=nStr.split('.');x1=x[0];x2=x.length>1?'.'+x[1]:'';var rgx=/(\d+)(\d{3})/;while(rgx.test(x1)){x1=x1.replace(rgx,'$1'+','+'$2');}
return x1+x2;},showEwasteNotice:function(){var ewasteNotice=new YAHOO.speedfc.utilities.sfcPanel("ewasteNotice");ewasteNotice.setBody('Your order contains items that are subject to an E-Waste charge.<br/>It has been added to your cart.');ewasteNotice.show();},saveAccount:function(order_numbers,password,password_verify){var postData='order_numbers='+order_numbers
+'&passwd='+password
+'&passwd_verify='+password_verify;var sUrl="/checkout/account_created";var callback={success:function(o){YAHOO.speedfc.utilities.common.customOverlay(o.responseText);if(YAHOO.speedfc.utilities.common.customMsgPanel)
YAHOO.speedfc.utilities.common.customMsgPanel.setProperties({width:'600px'});if(document.getElementById('receipt_create').innerHTML=='Congratulations!'){document.getElementById('singing_receipt').style.display='none';document.getElementById('save_ship_bill').style.display='none';}},failure:function(o){if(o.responseText==undefined)return;YAHOO.speedfc.utilities.common.customOverlay(o.responseText);if(YAHOO.speedfc.utilities.common.customMsgPanel)
YAHOO.speedfc.utilities.common.customMsgPanel.setProperties({width:'600px'});}};document.getElementById('passwd').value='';document.getElementById('passwd_verify').value='';YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);},updateGiftMessage:function(nickname){id="giftwrap_message_"+nickname;msg=document.getElementById(id).value;var postData='nickname='+nickname+'&msg='+msg;var sUrl="/checkout/updateGiftMessage";resultDiv=document.getElementById("giftwrap_callback_"+nickname);resultDiv.innerHTML="Updating, please wait...";var callback={success:function(o){resultDiv.innerHTML=o.responseText;},failure:function(o){resultDiv.innerHTML="An error occurred. Please try again";}};YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);},eraseGiftMessage:function(nickname){msg="";var postData='nickname='+nickname+'&msg='+msg;var sUrl="/checkout/updateGiftMessage";var callback={success:function(o){},failure:function(o){}};YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);}};;YAHOO.namespace('speedfc.catalog.sidebar');YAHOO.speedfc.catalog.sidebar={oTree:null,init:function(id){this.oTree=new YAHOO.widget.TreeView(id);this.oTree.draw();}};;YAHOO.namespace('speedfc.catalog.list');YAHOO.speedfc.catalog.list={validateQvSizeQty:function(row_id){var customError=document.getElementById('custom-alert');var alertQvDiv=document.getElementById('qv_errors');var errCount=0;if(alertQvDiv)alertQvDiv.style.display='none';if(customError)customError.innerHTML='';var e=document.getElementById('qty_select_'+row_id);if(e.value==null||e.value==''){customError.innerHTML="Please select a size";errCount++;}
if(errCount){alertQvDiv.style.display='block';}
if(errCount==0){skuSelect[row_id].addToBag();}},setPromoDescription:function(item_id){var destination=YAHOO.util.Dom.get("catalog_promo_desc_"+item_id);var source=YAHOO.util.Dom.get("promo_desc_source_"+item_id);destination.innerHTML=source.innerHTML;},zoom:function(imgSrc){if(this.zoomPanel==null){this.zoomPanel=new YAHOO.speedfc.utilities.sfcPanel("zoom_overlay");this.zoomPanel.setProperties({width:'530px',height:'550px',fixedcenter:true,iframe:true,close:false,zindex:300,modal:true,constraintoviewport:true,scope:this});}
content="<div style='position: relative; height: 520px'>"+"<div style='text-align: right'>"+"<a href='#' onclick='YAHOO.speedfc.catalog.list.zoomPanel.hide(); return false;'>"+"<img class='close' src='/images/panel_styles/default/close.jpg' alt='Close' />"+"</a>"+"</div>"+"<img src='"+imgSrc+"' /></div>";this.zoomPanel.setBody(content);this.zoomPanel.show();}};;YAHOO.namespace('speedfc.locator.geo');YAHOO.speedfc.locator.geo={gdir:null,map:null,fo:null,gotoState:function(state){if(state)window.location='/locator/map/state/'+state;},setDirections:function(fromAddress,toAddress,locale){YAHOO.speedfc.locator.geo.gdir.load("from: "+fromAddress+" to: "+toAddress,{"locale":locale});},handleErrors:function(){if(YAHOO.speedfc.locator.geo.gdir.getStatus().code==G_GEO_UNKNOWN_ADDRESS)
YAHOO.speedfc.utilities.common.alert("No corresponding geographic location could be found for one"+" of the specified addresses. This may be due to the fact that the"+" address is relatively new, or it may be incorrect.");else if(YAHOO.speedfc.locator.geo.gdir.getStatus().code==G_GEO_SERVER_ERROR)
YAHOO.speedfc.utilities.common.alert("A geocoding or directions request could not be successfully"+" processed, yet the exact reason for the failure is not known.");else if(YAHOO.speedfc.locator.geo.gdir.getStatus().code==G_GEO_MISSING_QUERY)
YAHOO.speedfc.utilities.common.alert("The HTTP q parameter was either missing or had no value. For"+" geocoder requests, this means that an empty address was specified"+" as input. For directions requests, this means that no query was"+" specified in the input.");else if(YAHOO.speedfc.locator.geo.gdir.getStatus().code==G_GEO_BAD_KEY)
YAHOO.speedfc.utilities.common.alert("The given key is either invalid or does not match the domain"+" for which it was given.");else if(YAHOO.speedfc.locator.geo.gdir.getStatus().code==G_GEO_BAD_REQUEST)
{if(YAHOO.speedfc.locator.geo.gdir.getStatus().code=='400')
YAHOO.speedfc.utilities.common.alert("A directions request could not be successfully parsed.\n Try Again");else
YAHOO.speedfc.utilities.common.alert("A directions request could not be successfully parsed.\n Error code: "
+YAHOO.speedfc.locator.geo.gdir.getStatus().code);}
else
YAHOO.speedfc.utilities.common.alert("An unknown error occurred.");},showFromForm:function(id){var main=document.getElementById("map_options_"+id).style.display="none";var to=document.getElementById("to_"+id).style.display="none";var from=document.getElementById("from_"+id).style.display="block";},showToForm:function(id){var main=document.getElementById("map_options_"+id).style.display="none";var to=document.getElementById("to_"+id).style.display="block";var from=document.getElementById("from_"+id).style.display="none";},getLocatorFlashObject:function(){fo=new FlashObject("/flash/_usmap.swf","statesMap","440","366","6.0");fo.addParam("quality","high");fo.addParam("wmode","transparent");fo.addParam("menu",false);fo.write("statesMap");}};;YAHOO.namespace('speedfc.product.detail');YAHOO.speedfc.product.detail={skuSelect:null,miniStoreLocator:null,fo:null,shareThis:false,toggleShareThis:function(){if(this.shareThis){YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("share_this_wrapper"),"display","none");this.shareThis=false;return;}
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get("share_this_wrapper"),"display","inline");this.shareThis=true;},toggleShareThis2:function(itemId){var shareThisLink=YAHOO.util.Dom.get("share_this_wrapper_"+itemId);if(shareThisLink.style.display=='none'){shareThisLink.style.display='inline';}else{shareThisLink.style.display='none';}},quickViewPanel:null,get_quickview:function(id,type,default_color,default_size,default_qty){var defaults=default_color||default_size||default_qty;if(this.quickViewPanel==null){this.quickViewPanel=new YAHOO.speedfc.utilities.sfcPanel("quick_view_panel");this.quickViewPanel.setProperties({width:"534px",fixedcenter:true,close:false,draggable:false,modal:true,visible:false,constraintoviewport:true,iframe:false,effect:null});}
var callback={success:function(o){YAHOO.speedfc.product.detail.quickViewPanel.setBody(o.responseText);YAHOO.speedfc.product.detail.quickViewPanel.show();var e=document.getElementById("basic_specs_js");if(e){eval(e.innerHTML);}
e=document.getElementById("info_tabs_js");if(e){eval(e.innerHTML);}
YAHOO.speedfc.product.detail.hideSwatchName(null);},failure:function(o){YAHOO.speedfc.product.detail.quickViewPanel.hide();}};var post_data='item_id='+id;if(defaults){if(default_color!=undefined)
post_data+='&default_color='+default_color;if(default_size!=undefined)
post_data+='&default_size='+default_size;if(default_qty!=undefined)
post_data+='&default_qty='+default_qty;};if(type=='upsell'||type=='pwp')post_data+='&no_next=1';if(type=='pwp'){post_data+='&pwp=true';}
YAHOO.util.Connect.asyncRequest('POST',"/quickview?"+post_data,callback,'');return false;},printWishlist:function(){var sUrl="/wishlist/print";YAHOO.speedfc.utilities.common.popup(sUrl,'print',970,761,true);},validateQvSizeQty:function(line_id){shipToError='The selected recipient is null'
if(!line_id)
var line_id=0;var customError=document.getElementById('custom-alert');var alertQvDiv=document.getElementById('qv_errors');var errCount=0;if(alertQvDiv)alertQvDiv.style.display='none';if(customError)customError.innerHTML='';var e=document.getElementById('qty_select_'+line_id);if(e.value==null){customError.innerHTML=qtySelectError;errCount++;}
e=document.getElementById('size_select_'+line_id);if(e.options.length>1&&(e.value==null)){if(errCount)customError.innerHTML+='<br/>';customError.innerHTML+=sizeSelectError;errCount++;}
e=document.getElementById('ship_to_'+line_id);if(e.options.length>1&&(e.value==null||e.value=='')){if(errCount)customError.innerHTML+='<br/>';customError.innerHTML+=shipToError;errCount++;}
if(errCount){alertQvDiv.style.display='block';}
if(errCount==0){if(skuSelect instanceof Array)
skuSelect[line_id].addToBag();else
skuSelect.addToBag();}},searchInStore:function(idx){var item_id=document.getElementById("item_hidden_"+idx).value;var color_id=document.getElementById("color_id_"+idx).value;var size_id=document.getElementById("size_select_"+idx).value;var zip=document.getElementById("zip_"+idx).value;if(typeof item_id==undefined||typeof color_id==undefined||typeof size_id==undefined){YAHOO.speedfc.utilities.common.alert("This is not a valid product, please reload page or go back"+" to the catalog and choose another product.")
return;}
if(typeof zip==undefined){YAHOO.speedfc.utilities.common.alert("Please type in your zip code.")
return;}
var postData='item='+item_id+'&color='+color_id+'&size='+size_id+'&zip='+zip;var Url="/detail/searchInStore";var callback={success:function(o){if(o.responseText==undefined)return;var pos_x=(document.body.clientWidth-620)/2;miniStoreLocator=new YAHOO.speedfc.utilities.sfcPanel('searchInStore_base');miniStoreLocator.setProperties({width:'620px',x:pos_x,y:100,draggable:false,iframe:true,modal:true,constraintoviewport:false,scope:this,fixedcenter:true});miniStoreLocator.setBody(o.responseText);miniStoreLocator.show();},failure:function(o){}};return YAHOO.util.Connect.asyncRequest('POST',Url,callback,postData);},closeSearchInStore:function(){miniStoreLocator.hide();},updateLocalStore:function(){if(!YAHOO.speedfc.utilities.common.isArray(skuSelect)){skuSelect.availableInLocalStore();}},setStoreCookie:function(value){var c_name="local_store";var expiredays=30;var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+
((expiredays==null)?"":";expires="+exdate.toGMTString()+"; path=/");},getCookie:function(c_name){var cookie=document.cookie;if(cookie.length>0)
{c_start=cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=cookie.indexOf(";",c_start);if(c_end==-1)c_end=cookie.length;return unescape(cookie.substring(c_start,c_end));}}
return"";},getFlashMovie:function(movieName){var isIE=navigator.appName.indexOf("Microsoft")!=-1;return(isIE)?window[movieName]:document[movieName];},movieIsLoaded:function(theMovie){if(typeof(theMovie)!="undefined"){return theMovie.PercentLoaded()==100;}else{return false;}},zoomSend:function(msg,img_path){if(YAHOO.speedfc.product.detail.movieIsLoaded(YAHOO.speedfc.product.detail.getFlashMovie("flashzoom"))&&YAHOO.speedfc.product.detail.getFlashMovie("flashzoom")){YAHOO.speedfc.product.detail.getFlashMovie("flashzoom").setPath(img_path+msg);}},initFlash:function(img_src_flash){fo=new FlashObject("/flash/zoomer.swf","flashzoom","275","340","9.0","#fff","high");fo.addParam("quality","high");fo.addParam("menu",false);fo.addParam("wmode","transparent");fo.addParam("swLiveConnect",true);fo.addVariable('imagePath',img_src_flash);fo.write("flashcontent");},recentCallback:{success:function(o){if(o.responseText==undefined)return;if(document.getElementById('list_recent_items')!=undefined){document.getElementById('list_recent_items').innerHTML=o.responseText;}},failure:function(o){if(o.responseText==undefined)return false;YAHOO.speedfc.utilities.common.alert("Action unavailable");}},recentChange:function(i,c){var postData="i="+i+"&c="+c;YAHOO.util.Connect.asyncRequest('POST',"/catalog/changecolorforrecent",YAHOO.speedfc.product.detail.recentCallback,postData);},showSwatchName:function(obj,left_margin){var left=YAHOO.util.Dom.getX(obj);var sw=YAHOO.util.Dom.getElementsByClassName('color_name','div',obj);sw[0].style.display='block';YAHOO.util.Dom.setX(sw,left);left_margin=typeof(left_margin)!='undefined'?left_margin:0;var sw2=YAHOO.util.Dom.getElementsByClassName('swatch_zoom','div',obj);sw2[0].style.display='block';YAHOO.util.Dom.setX(sw2,left+left_margin);},hideSwatchName:function(id){var swatches=document.getElementById('swatches_'+id);var elements=YAHOO.util.Dom.getElementsByClassName('color_name','div',swatches);for(var i=0;i<elements.length;i++){elements[i].style.display='none';}
var elements=YAHOO.util.Dom.getElementsByClassName('swatch_zoom','div',swatches);for(var i=0;i<elements.length;i++){elements[i].style.display='none';}},properCase:function(str){var index;var tmpStr;var tmpChar;var preString;var postString;var strlen;tmpStr=str.toLowerCase();strLen=tmpStr.length;if(strLen>0){for(index=0;index<strLen;index++){if(index==0){tmpChar=tmpStr.substring(0,1).toUpperCase();postString=tmpStr.substring(1,strLen);tmpStr=tmpChar+postString;}
else{tmpChar=tmpStr.substring(index,index+1);if(tmpChar==" "&&index<(strLen-1)){tmpChar=tmpStr.substring(index+1,index+2).toUpperCase();preString=tmpStr.substring(0,index+1);postString=tmpStr.substring(index+2,strLen);tmpStr=preString+tmpChar+postString;}}}}
return tmpStr;},changeColorText:function(color_name){var text=document.getElementById('color_selected_text');if(text)text.innerHTML=YAHOO.speedfc.product.detail.properCase(color_name);},updateRecent:function(){var callback={success:function(o){var responses=o.responseText.split('<br class="split" />');var count=parseInt(responses[0].replace(/^\n*/,''));if(count>0){var recent=document.getElementById('list_recent_items');if(recent)recent.innerHTML=responses[1];}},failure:function(o){}}
YAHOO.util.Connect.asyncRequest('POST',"/catalog/updaterecent",callback,'');},showSendFavorites:function(){var inputs=YAHOO.util.Dom.getElementsByClassName('thumb','a');var checked_items=new Array();var itemId="";var colorId="";var itemQueue=new Array();var colorQueue=new Array();if(true||itemQueue.length>0){var callback={success:function(o){send_details=new YAHOO.speedfc.utilities.sfcPanel("send_favorites");send_details.setProperties({width:"380px",x:(document.documentElement.clientWidth-344)/2,y:145,visible:false,draggable:false,modal:true});send_details.setBody(o.responseText);if(typeof quickViewPanel!='undefined'){quickViewPanel.hide();};scroll(0,0);send_details.show();},failure:function(o){}};YAHOO.util.Connect.asyncRequest('POST','/wishlist/sendToFriend/',callback,'item='+itemQueue+'&color='+colorQueue+'&wishlist='+true);}},SendDetails:function(){var item_id=document.getElementById('send_item_id').value;var color_id=document.getElementById('send_color_id').value;var from_name=document.getElementById('from_name').value;var from_mail=document.getElementById('from_mail').value;var to_mail=document.getElementById('to_mail').value;var message_content=document.getElementById('message').value;var form_error="";var input_class="send_input";var error_input_class=input_class+" form_error";document.getElementById('from_name').className=input_class;document.getElementById('to_mail').className=input_class;document.getElementById('from_mail').className=input_class;if(!to_mail){form_error+="Please enter your friend's e-mail(s)<br>";document.getElementById('to_mail').className+=error_input_class;}else if(!YAHOO.speedfc.utilities.common.validate_email_adresses(to_mail)){form_error+="Please enter valid e-mail address(es).<br>";document.getElementById('to_mail').className=error_input_class;}
if(!from_name){form_error+="Please enter your name.<br>";document.getElementById('from_name').className=error_input_class;}
if(!from_mail){form_error+="Please enter your e-mail.<br>";document.getElementById('from_mail').className=error_input_class;}else if(!YAHOO.speedfc.utilities.common.validate_email_adresses(from_mail)){form_error+="Please enter a valid e-mail address.<br>";document.getElementById('from_mail').className=error_input_class;}
if(form_error!=''){YAHOO.speedfc.utilities.common.alert(form_error);return;}
if(form_error){var error_container=document.getElementById('sentofriend_errors');var errors=document.getElementById('custom_alert');if(error_container){error_container.style.display='block';if(errors)
errors.innerHTML=form_error;return;}}
var postData='item='+item_id
+'&color='+color_id
+'&from_name='+from_name
+'&from_mail='+from_mail
+'&to_mail='+to_mail
+'&message_content='+message_content;var sUrl="/send/details";var callback={success:function(o){scroll(0,0);send_details.setProperty('width',"250px",true);send_details.setBody(o.responseText);send_details.setProperty('fixedcenter',true,true);},failure:function(o){YAHOO.speedfc.utilities.common.alert("Your mail couldn't be sent");}};YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);},setShipToQS:function(ship_combo,orig_dest){var ship_to=ship_combo.value;var ship_to_hidden_prev_index=YAHOO.util.Dom.get(ship_combo.id+'_prev_index');var orig_dest=ship_to_hidden_prev_index.value;if(ship_to=='AddNew'){YAHOO.speedfc.utilities.common.showAddRecipientPanel(ship_combo);ship_combo.options[orig_dest].selected=true;return;}}};;YAHOO.namespace('speedfc.product.sku');YAHOO.speedfc.product.sku.SkuSelection=function(line_id,color_id,size_id,qty,item_id){this.line_id=line_id;this.color_id=color_id;this.size_id=size_id;this.qty=qty;this.ship_to='Me';this.color_size=new Array();this.defaults=new Array();this.defaults['color']=color_id;this.defaults['size']=size_id;this.defaults['qty']=qty;this.available=new Array();this.available_confirmed=new Array();this.backorderable=new Array();this.qty_on_order=new Array();this.imageElementId='thumb_img_';this.item_id=item_id;this.swatch_pad=0;this.is_clearance=new Array();this.enable_zero=false;this.enable_swatches_hiding=true;this.no_size='';this.no_color='';this.addAvailable=function(sku_id,qty_available,is_clearance,backorderable,qty_on_order){this.available[sku_id]=qty_available;this.is_clearance[sku_id]=is_clearance;this.backorderable[sku_id]=backorderable;this.qty_on_order[sku_id]=qty_on_order;}
this.addSize=function(swatch_pad,color_id,size_id,description,price,sale_price,sku_id){if(!this.defaults['size'])this.defaults['size']=size_id;if(typeof this.color_size[swatch_pad]=='undefined')
this.color_size[swatch_pad]=new Array();if(typeof this.color_size[swatch_pad][color_id]=='undefined')
this.color_size[swatch_pad][color_id]=new Array();this.color_size[swatch_pad][color_id][size_id]=new Array();this.color_size[swatch_pad][color_id][size_id]['description']=description;this.color_size[swatch_pad][color_id][size_id]['price']=price;this.color_size[swatch_pad][color_id][size_id]['sale_price']=sale_price;this.color_size[swatch_pad][color_id][size_id]['sku_id']=sku_id;}
this.setQtyCombo=function(){var sku_id="";if(this.size_id){if(typeof this.color_size[this.swatch_pad][this.color_id][this.size_id]!='undefined')
sku_id=this.color_size[this.swatch_pad][this.color_id][this.size_id]['sku_id'];else{for(var i=0;i<this.color_size.length;i++){if(typeof this.color_size[i][this.color_id][this.size_id]!='undefined'){sku_id=this.color_size[i][this.color_id][this.size_id]['sku_id'];break;}}}}
else
if(this.defaults["size"]&&typeof this.color_size[this.swatch_pad]!="undefined"&&typeof this.color_size[this.swatch_pad][this.color_id]!="undefined"&&typeof this.color_size[this.swatch_pad][this.color_id][this.defaults["size"]]!="undefined"&&typeof this.color_size[this.swatch_pad][this.color_id][this.defaults["size"]]['sku_id']!="undefined"){sku_id=this.color_size[this.swatch_pad][this.color_id][this.defaults["size"]]['sku_id'];}
var qty=12;if(this.defaults['qty']>12)
qty=this.defaults['qty'];if(sku_id!=""&&this.available[sku_id]<=qty&&!this.backorderable[sku_id]){qty=this.available[sku_id];this.current_sku_id=sku_id;}
if(sku_id!=""&&this.backorderable[sku_id]){if(Number(this.available[sku_id])+Number(this.qty_on_order[sku_id])<qty){qty=Number(this.available[sku_id])+Number(this.qty_on_order[sku_id]);}
if(qty<0){qty=0;}}
var qtyCmb=document.getElementById('qty_select_'+this.line_id);var qty_tag=document.getElementById('qty_text_tag_'+this.line_id);if(qty<=0){if(qty_tag){qty_tag.style.display='none';}
qtyCmb.style.display='none';}
else{if(qty_tag){qty_tag.style.display='';}
qtyCmb.style.display='';}
while(qtyCmb.options.length>0)qtyCmb.remove(0);var start=1;if(this.enable_zero==true){start=0;}
for(var i=start;i<=qty;i++)
this.addOption(qtyCmb,i,i);if(this.qty>qty)
this.qty=start;else{if(this.enable_zero||this.qty==0)
qtyCmb.selectedIndex=this.qty;else
qtyCmb.selectedIndex=this.qty-1;}}
this.selectColor=function(color_id,swatch_pad){this.color_id=color_id;document.getElementById('color_id_'+this.line_id).value=color_id;YAHOO.speedfc.product.detail.hideSwatchName(this.line_id);var swatch=document.getElementById('swatches_'+this.line_id+"_"+this.swatch_pad);var swatches=YAHOO.util.Dom.getElementsByClassName('swatch','div',swatch);for(var i=0;i<swatches.length;i++){swatches[i].className='swatch';}
swatch=document.getElementById('swatches_'+this.line_id+"_"+swatch_pad);swatches=YAHOO.util.Dom.getElementsByClassName('swatch','div',swatch);if(swatch_pad==null){swatch_pad=0;}
this.swatch_pad=swatch_pad;swatch=document.getElementById('swatch_'+this.line_id+'_'+swatch_pad+'_'+color_id);if(swatch)swatch.className='swatch selected';var ddSize=document.getElementById('size_select_'+this.line_id);if(typeof ddSize!='undefined'&&ddSize!=null){while(ddSize.options.length>1)ddSize.remove(1);}
var single_swatch=true;if(swatches.length>1){single_swatch=false;}
if(single_swatch&&this.enable_swatches_hiding){for(var swatch_pad in this.color_size){for(var color_id in this.color_size[swatch_pad]){for(var size_id in this.color_size[swatch_pad][color_id]){if(typeof this.color_size[swatch_pad][color_id][size_id]!='function'&&(typeof this.color_size[swatch_pad][color_id][size_id]!='undefined')){this.addOption(ddSize,this.color_size[swatch_pad][color_id][size_id]['description'],size_id);}}}}}else{for(var size_id in this.color_size[swatch_pad][color_id]){if(typeof this.color_size[swatch_pad][color_id][size_id]!='function'&&(typeof this.color_size[swatch_pad][color_id][size_id]!='undefined')){this.addOption(ddSize,this.color_size[swatch_pad][color_id][size_id]['description'],size_id);}}}
if(typeof ddSize!='undefined'&&ddSize!=null){if(ddSize.length==2&&(ddSize.options[0].text=="Select Size"||ddSize.options[0].text=="Size")){ddSize.style.display='none';var size_tag=document.getElementById('size_text_tag_'+this.line_id);if(size_tag)size_tag.style.display='none';ddSize.selectedIndex=1;this.setSize(ddSize.options[1].value);if(this.defaults['size']==''){this.defaults['size']=this.size_id};}
else{ddSize.style.display='';this.setSize(ddSize.options[0].value);if(this.defaults['size']==''){this.defaults['size']=this.size_id};}}
try{this.selectSize(this.size_id);}catch(ex){}
this.replaceImg();}
this.addOption=function(select_elem,label,value){YAHOO.speedfc.utilities.common.addOption(select_elem,label,value);}
this.selectSize=function(size_id){var ddSize=document.getElementById('size_select_'+this.line_id);if(ddSize){for(var i=0;i<ddSize.length;i++){if(ddSize.options[i].value==size_id){ddSize.selectedIndex=i;if(size_id==this.no_size){ddSize.style.display='none';var text_label=document.getElementById('size_text_tag_'+this.line_id);if(text_label)
text_label.style.display='none';}
return true;}}}
this.size_id=null;return false;}
this.selectQty=function(qty){var qtyCmb=document.getElementById('qty_select_'+this.line_id);YAHOO.speedfc.utilities.common.setSelectValue('qty_select_'+this.line_id,qty);return true;}
this.setSize=function(size_id){this.size_id=size_id;this.setQtyCombo();this.skuAvailableOffline();var callback={success:function(o){var response=YAHOO.lang.JSON.parse(o.responseText);var atc=document.getElementById('atc');var atc_off=document.getElementById('atc_off');var atc1=document.getElementById('atc1');var atc_off1=document.getElementById('atc_off1');if(atc1==null&&atc!=null&&typeof atc!=undefined&&atc_off!=null&&typeof atc_off!=undefined){if(response.available=="true"&&(this.size_id||this.size_id!='')){atc.style.display='inline';atc_off.style.display='none';}
else{atc.style.display='none';atc_off.style.display='inline';}}},failure:function(o){}};postData='item='+this.item_id+'&color='+this.color_id+'&size='+this.size_id;YAHOO.util.Connect.asyncRequest('POST','/detail/checkOnlineAvailability',callback,postData);}
this.setItemId=function(item_id){this.item_id=item_id;}
this.setShipTo=function(ship_combo,orig_dest){var ship_to=ship_combo.value;var ship_to_hidden_prev_index=YAHOO.util.Dom.get(ship_combo.name+'_prev_index');var orig_dest=ship_to_hidden_prev_index.value;if(ship_to=='AddNew'){YAHOO.speedfc.utilities.common.showAddRecipientPanel(ship_combo);ship_combo.options[orig_dest].selected=true;return;}
this.ship_to=ship_to;}
this.setQty=function(qty){if(!qty){if(this.enable_zero==true)
qty=0;else
qty=1;}
this.qty=qty;if(document.getElementById('atc_off1')!=null&&skuSelect[0]!=null){var activate_btn=false;for(var i=0;i<skuSelect.length;i++){if(skuSelect[i].qty>0){activate_btn=true;break;}}
var atc=document.getElementById('atc');var atc_off=document.getElementById('atc_off');var atc1=document.getElementById('atc1');var atc_off1=document.getElementById('atc_off1');if(activate_btn){atc.style.display='inline';atc_off.style.display='none';if(atc1!=null&&atc_off1!=null){atc1.style.display='inline';atc_off1.style.display='none';}}
else{atc.style.display='none';atc_off.style.display='inline';if(atc1!=null&&atc_off1!=null){atc1.style.display='none';atc_off1.style.display='inline';}}}}
this.hideSwatchPads=function(){if(this.color_size.length==1){return;}
for(var swatch_pad in this.color_size){for(var color_id in this.color_size[swatch_pad]){if(this.color_size[swatch_pad].length>1){this.enable_swatches_hiding=false;return;}}}}
this.setDefaults=function(line_id){if(line_id==null){line_id=0;}
this.line_id=line_id;this.hideSwatchPads();this.selectSize(this.defaults['size']);this.setQtyCombo();this.selectQty(this.defaults['qty']);this.setQty(this.defaults['qty']);var ship_to=YAHOO.util.Dom.get("ship_to_"+line_id);if(ship_to)
this.ship_to=ship_to.value;}
this.replaceImg=function(){var img=document.getElementById(this.imageElementId+this.line_id);if(this.imageFunction){this.imageFunction("",this.item_id+'_'+this.color_id);return;}
if(!img)return;img.src=img.src.replace(/[0-9]+_[0-9]+.jpg/,this.item_id+'_'+this.color_id+'.jpg');}
this.getValue=function(var_name){var variables=[];variables['item_id']=this.item_id;variables['color_id']=this.color_id;variables['size_id']=this.size_id;variables['qty']=this.qty;return variables[var_name];}
this.checkAvailable=function(){var sku_id=this.color_size[this.swatch_pad][this.color_id][this.size_id]['sku_id'];if(typeof this.available[sku_id]!='undefined'&&((this.available[sku_id]<=0)||(this.available[sku_id]-this.qty<0)))
{if(typeof this.available_confirmed[sku_id]=='undefined'){if(this.backorderable[sku_id]){return this.confirmBackorder(sku_id);}
return false;}}
delete this.available_confirmed[sku_id];return true;};this.confirmBackorder=function(sku_id){confirm_bo=new YAHOO.speedfc.utilities.sfcPanel("confirmbo");confirm_bo.setProperties({width:"286px",fixedcenter:true,constraintoviewport:true,underlay:"shadow",close:false,visible:false,draggable:false,modal:true});ss=this;YAHOO.speedfc.product.sku.yes_action=function(){ss.available_confirmed[sku_id]=1;confirm_bo.hide();ss.addToBag();return true;};YAHOO.speedfc.product.sku.no_action=function(){confirm_bo.hide();return false;};body='<div id="backorder_overlay">'+'<div style="margin-bottom:20px; text-align: right">'+'<img src="/images/panel_styles/default/close.jpg" alt="close" onclick="YAHOO.speedfc.product.sku.no_action();" style="cursor: pointer;"/>'+'</div>'+'<div style="">'+'<form action="#">'+'We\'re Sorry, that item is currently on back order. Would you still like'+'to add it to your shopping bag?<br/><br/>'+'<div style="margin-top: 5px">'+'<a href="#" onclick="return YAHOO.speedfc.product.sku.yes_action();">Yes, I still want it.</a><br/>'+'</div><div style="margin-top: 5px">'+'<a href="#" onclick="return YAHOO.speedfc.product.sku.no_action();">No, thanks.</a><br/>'+'</div>'+'</form>'+'</div>';confirm_bo.setBody(body);confirm_bo.show();var underlay=document.getElementById('confirmbo_mask');if(underlay)
YAHOO.util.Event.addListener(underlay,"click",function(){confirm_bo.hide();});};this.addToBag=function(){if(!this.checkSizeQty())return;if(!this.ship_to){YAHOO.speedfc.utilities.common.alert("please select 'ship to' and try again");return;}
if(this.ship_to===undefined){this.ship_to='Me';}
var sku_id=sku_id=this.color_size[this.swatch_pad][this.color_id][this.size_id]['sku_id'];if(this.backorderable[sku_id]&&!this.checkAvailable())return;var postData='i='+this.item_id+'&c='+this.color_id+'&s='+this.size_id+'&q='+this.qty+'&st='+escape(this.ship_to)+'&url_from='+encodeURIComponent(window.location);if(this.line_id!=null){postData+='&ost='+escape(this.ship_to)}
var sUrl="/cart/ajaxadd";outerThis=this;var callback={success:function(o){YAHOO.speedfc.cart.add.addedToCart(o);},failure:function(o){if(o.responseText==undefined)return;YAHOO.speedfc.cart.add.open_header_cart("There was an error while adding the item to your bag.");},argument:{extvar:this}};return YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);}
this.qtyChangeMsg=function(content){qty_panel=new YAHOO.speedfc.utilities.sfcPanel("confirmbox");qty_panel.setProperty("width","286px");qty_panel.setBody(content);e=document.getElementById('combos_qs');if(e){e.style.display='none';}
qty_panel.show();}
this.printPopup=function(){var sUrl="/detail/print";var params='/'+this.item_id;if(this.color_id)
params+='/'+this.color_id;if(this.size_id&&this.qty)
params+='/'+this.size_id+'/'+this.qty
YAHOO.speedfc.utilities.common.popup(sUrl+params,'print',820,761,true);}
this.showSendDetails=function(){var callback={success:function(o){send_details=new YAHOO.speedfc.utilities.sfcPanel("send_details");send_details.setProperties({width:"680px",x:(document.documentElement.clientWidth-514)/2,y:145,visible:false,draggable:false,modal:true});send_details.setBody(o.responseText);if(typeof quickViewPanel!='undefined'){quickViewPanel.hide();};scroll(0,0);send_details.show();return false;},failure:function(o){}};YAHOO.util.Connect.asyncRequest('POST','/detail/sendDetailsToFriend/',callback,'item='+this.item_id+'&color='+this.color_id);}
this.availableInLocalStore=function(){if(document.getElementById("local_store_info_"+this.line_id)==null)return;var cookie=YAHOO.speedfc.product.detail.getCookie("local_store");if(!cookie){document.getElementById("local_store_info_"+this.line_id).style.display="none";return;}
var local_store=cookie.split("_");var callback={success:function(o){var skuSelection=o.argument.extvar;var response=YAHOO.lang.JSON.parse(o.responseText);if(response.error)
return;var availability;for(var i=0,len=response.length;i<len;++i){availability="<span class='out_stock'>Out of Stock</span>";if(response[i].availability>0)
availability="<span class='in_stock'>In Stock</span>";if(response[i].store_number==local_store[1]){document.getElementById("local_store_availability_"+skuSelection.line_id).innerHTML=availability;document.getElementById("local_store_name_"+skuSelection.line_id).innerHTML="<a href='/locator/showstore/"+local_store[1]+"' target='_blank'>"+local_store[2]+"</a>";document.getElementById("local_store_info_"+skuSelection.line_id).style.display="";}
else{}}},failure:function(o){},argument:{extvar:this}};YAHOO.util.Connect.asyncRequest('POST','/detail/checkClosestStoresAvailability',callback,'item='+this.item_id+'&color='+this.color_id+'&size='+this.size_id+"&zip="+local_store[0]+"&sn="+local_store[1]);document.getElementById("zip_"+this.line_id).value=local_store[0];}
this.skuAvailableOffline=function(){if(!document.getElementById('fis_btn_'+this.line_id))return;var callback={success:function(o){var skuSelection=o.argument.extvar;if(o.responseText=="available"){var av_btn=document.getElementById('fis_btn_'+skuSelection.line_id).style.display="inline";var av_btn=document.getElementById('zip_'+skuSelection.line_id).disabled=false;var av_btn=document.getElementById('fis_btn_off_'+skuSelection.line_id).style.display="none";skuSelection.availableInLocalStore();}
else{var av_btn=document.getElementById('fis_btn_'+skuSelection.line_id).style.display="none";var av_btn=document.getElementById('zip_'+skuSelection.line_id).disabled=true;var av_btn=document.getElementById('fis_btn_off_'+skuSelection.line_id).style.display="inline";document.getElementById('local_store_info_'+skuSelection.line_id).style.display="none";}},failure:function(o){var skuSelection=o.argument.extvar;var av_btn=document.getElementById('fis_btn_'+skuSelection.line_id).style.display="none";var av_btn=document.getElementById('zip_'+skuSelection.line_id).disabled=true;var av_btn=document.getElementById('fis_btn_off_'+skuSelection.line_id).style.display="inline";document.getElementById('local_store_info_'+skuSelection.line_id).style.display="none";},argument:{extvar:this}};YAHOO.util.Connect.asyncRequest('POST','/detail/checkAvailability',callback,'item='+this.item_id+'&color='+this.color_id+'&size='+this.size_id);}
this.enableZero=function(value)
{this.enable_zero=value;}
this.checkSizeQty=function(){if((!this.size_id&&this.countProps(this.color_size[this.swatch_pad][this.color_id])>1)||!this.qty){var errTxt="Please select the following:\r\n";errTxt+=!this.size_id?" - Size\r\n":"";errTxt+=!this.qty?" - Quantity\r\n":"";YAHOO.speedfc.utilities.common.alert(errTxt);return false;}
if(!this.size_id){this.size_id=this.defaults['size'];}
return true;}
this.setImageFunction=function(func){this.imageFunction=func;}
this.goToPDP=function(item_desc){var color_id=this
var href="/detail/"+item_desc+"/"+this.item_id+"/"+this.color_id
+"/"+this.size_id+"/"+this.qty;window.location=href;},this.countProps=function(obj){var i=0;if(typeof obj=="object"){for(prop in obj){if(typeof obj[prop]!='undefined'&&typeof obj[prop]!='function'){i++;}}}
return i;}};
