var _io_request=new IORequest();var _io_config=undefined;var _io_zone=undefined;var _io_state=new IOState();if(typeof console==="undefined"||typeof console.log==="undefined"||typeof console.group==="undefined"){var console={log:function(){},warn:function(){},error:function(){},dir:function(){},group:function(){},groupEnd:function(){}}}function cm_ted_io(A){_io_state.cm_ted_io(A)}function _cm_io_rec(A){if(_io_request!==undefined){_io_request.cm_io_rec(A)}}function _cm_io_cfg(A){if(_io_request!==undefined){_io_request.cm_io_cfg(A,1)}}function cmRecRequest(D,C,B,A){IORequest.rec_request(D,C,B,A)}function cmDisplayRecs(){IORequest.display_recs()}function IORequest(_8){var _9="io_config.js";var _a="V4";this.h_timer=undefined;this.h_script=undefined;this.xmlHttp=undefined;this.i_timeout=0;this.request_type="";this.action_callback=function(_b){return };this.display_status=function(_c,_d){return };this.display_product_table=function(_e){return };this.display_product_images=function(_f){return };this.display_config=function(_10){return };this.cm_alert=function(_11){if(!IORequest.production){alert(_11)}};IOStopWatch=function(){this.start=function(){this.elapsed_time=0;this.t_start=new Date().getTime()};this.stop=function(){this.elapsed_time=new Date().getTime()-this.t_start;return(this.elapsed_time)}};this.stop_watch=new IOStopWatch("stop_watch");this.ajax_timeout=function(_12){if(_io_request.xmlHttp!==undefined){try{if(_io_request.xmlHttp.abort!==undefined){if(typeof _io_request.xmlHttp.abort=="function"){_io_request.xmlHttp.abort()}}}catch(e){_io_request.display_status("IE - no abort property of the xmlHttp request object")}}IORequest.b_timeout=true;if(_12){_io_request.action_callback("config_timeout");IORequest.i_zone=0;setTimeout('IORequest.config_download_failure("ajax timeout");',0)}else{_io_request.display_status("Ajax timeout downloading product ("+_io_request.stop_watch.elapsed_time+"ms)","red");IORequest.log(IORequest.log_warn,"Ajax timeout downloading product",_io_request.stop_watch.elapsed_time+" ms");_io_request.download_product()}};function _13(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else{if(window.ActiveXObject){}else{return null}}}this.javascript_timeout=function(_14){if(IORequest.h_script!==undefined){var h=document.getElementsByTagName("head").item(0);if(h){h.removeChild(IORequest.h_script);IORequest.h_script=undefined}}_io_request.stop_watch.stop();IORequest.timeout_product[IORequest.request_crc]=1;if(_14){_io_request.action_callback("config_timeout");IORequest.i_zone=0;setTimeout('IORequest.config_download_failure("javascript timeout");',0)}else{_io_request.display_status("JavaScript timeout downloading product ("+_io_request.stop_watch.elapsed_time+"ms)","red");IORequest.log(IORequest.log_warn,"JavaScript timeout downloading product",_io_request.stop_watch.elapsed_time+" ms");if((_io_config.file_not_found_pc!==undefined)&&(_io_config.file_not_found_pc>Math.floor(Math.random()*100))){var id=IORequest.offer_type+IORequest.offer_id+"|"+IORequest.request_crc+"|"+(IORequest.offer_type=="P"?IORequest.plain_text_product_id:IORequest.plain_text_cat_id);cmCreatePageElementTag(id,_io_config.file_not_found_id);IORequest.log(IORequest.log_trace,"page element tag for file not found",id)}_io_request.download_product()}};this.stateChanged=function(){if(_io_request.xmlHttp.readyState==4){clearTimeout(_io_request.h_timer);_io_request.h_timer=undefined;if(_io_request.xmlHttp.status==200){var txt=_io_request.xmlHttp.responseText;eval(txt)}else{if(_io_request.xmlHttp.status==404){_io_request.display_status("Ajax - Requested File not found on server - "+_io_request.xmlHttp.status+". Next step in recommendation plan attempted","blue");IORequest.log(IORequest.log_warn,"Ajax - Requested File not found on server - "+_io_request.xmlHttp.status,"next step in recommendation plan attempted");IORequest.b_404=true;if(_io_request.request_type=="config"){setTimeout('IORequest.config_download_failure("ajax 404");',0)}else{if(_io_request.request_type=="product"){_io_request.download_product()}}}else{_io_request.display_status("Ajax - Unexpected status from stateChanged: "+_io_request.xmlHttp.status+".","red");IORequest.log(IORequest.log_error,"Ajax - Unexpected status from stateChanged",_io_request.xmlHttp.status);IORequest.b_404=true;if(_io_request.request_type=="config"){setTimeout('IORequest.config_download_failure("ajax 404");',0)}else{if(_io_request.request_type=="product"){_io_request.download_product()}}}}}else{}};this.get_target_from_plan=function(_15,_16){if(IORequest.current_step>=_15.rec_steps.length){return("_SE_")}var _17=_15.rec_steps[IORequest.current_step];IORequest.log(IORequest.log_trace,"step: "+IORequest.current_step+" offer_id: "+_17.offer_id+" type: "+_17.offer_type+" target",_17.target_id);if(_17.target_id=="_NR_"){return("_NR_")}if(_17.target_id=="_DPF_"){return("_DPF_")}if(_16&&_17.offer_type=="P"){IORequest.current_step++;this.display_status("Looking for Category - found Product: "+_17.target_id+". Next step","green");IORequest.log(IORequest.log_trace,"Looking for Category - found Product: "+_17.target_id,"next step");return(this.get_target_from_plan(_15,1))}if(_17.target_id=="_SP_"){return(IORequest.primary_id||"_NR_")}if(_17.target_id=="_SC_"){return(IORequest.fallback_id||"_NR_")}if(_17.target_id=="_RVP_"||_17.target_id=="_RVC_"||_17.target_id=="_LCP_"||_17.target_id=="_RPP_"||_17.target_id=="_MPC_"){var rc=_io_state.cm_get_product_from_cookie(_17.target_id);if(rc===0){IORequest.current_step++;this.display_status("No "+_17.target_id+"available. Next step","green");IORequest.log(IORequest.log_trace,"No "+_17.target_id+" available","next step");return(this.get_target_from_plan(_15))}else{return(rc)}}this.display_status("unrecognized target id: "+_17.target_id+".","red");IORequest.log(IORequest.log_error,"unrecognized target id",_17.target_id);return("_NR_")};this.issue_page_element_tag=function(_18){if(IORequest.perm_cookie_not_supported===false){var _19=IORequest.find_cookie(IORequest.ses_cookie);if(_19===undefined){var _1a=new Date().getTime().toString();_19=IORequest.set_and_check_cookie(IORequest.ses_cookie,"S"+_1a+"|",true);if(!_19){return }}if(_19.indexOf("|"+_18[0]+"|")==-1){IORequest.log(IORequest.log_trace,"issued page element tag"+this.io_zone.ab_test_id.split(":")[1],this.io_zone.ab_test_id.split(":")[0]);IORequest.log(IORequest.log_trace,"session cookie",_19);IORequest.set_and_check_cookie(IORequest.ses_cookie,_19+_18[0]+"|",true);cmCreatePageElementTag(_18[1],_18[0])}}};this.download_product=function(){IORequest.current_step++;this.io_zone=_io_config.zones[IORequest.zone_id];if(this.io_zone.ab_test_id!="no ab test"){this.issue_page_element_tag(this.io_zone.ab_test_id.split(":"))}IORequest.log(IORequest.log_trace,"ab test id",this.io_zone.ab_test_id);if(!this.io_zone.rec_plan){this.cm_alert("rec_plan not defined - zone_id: "+IORequest.zone_id)}var rc=this.get_target_from_plan(this.io_zone.rec_plan,IORequest.b_timeout||IORequest.b_404);this.action_callback("recommendation_plan");if(rc=="_DPF_"&&(IORequest.default_product_file!==undefined)){_io_request.cm_io_rec(IORequest.default_product_file);return(0)}if(rc=="_SE_"||rc=="_NR_"||rc=="_DPF_"){var _1b="";if(rc=="_SE_"){this.display_status("steps exhausted. Calling zone population function "+this.io_zone.zpf+" without recommendations.","blue");IORequest.log(IORequest.log_trace,"steps exhausted - calling zone population function without recommendations",this.io_zone.zpf);_1b="Steps exhausted.  No recommendations found"}else{this.display_status("calling zone population function "+this.io_zone.zpf+" without recommendations (_NR_)","blue");IORequest.log(IORequest.log_trace,"calling zone population function without recommendations",this.io_zone.zpf);_1b="No recommendations found"}if(this.io_zone.zpf!==undefined){var _1c="[],'"+this.io_zone.name+"','_NR_','','',[],[],'"+_1b+"'";var zpf=this.io_zone.zpf+"("+_1c+")";setTimeout(zpf,0)}setTimeout('IORequest.stack_manager("rc: '+rc+'");',0);return(0)}var _1d=rc;this.offer_id=this.io_zone.rec_plan.rec_steps[IORequest.current_step].offer_id;this.cgi_version=this.io_zone.rec_plan.rec_steps[IORequest.current_step].offer_version;this.offer_type=this.io_zone.rec_plan.rec_steps[IORequest.current_step].offer_type;if(((this.offer_type=="C")&&IORequest.encrypt_cats)||((this.offer_type=="E")&&IORequest.encrypt_cats)||((this.offer_type=="P")&&IORequest.encrypt_prds)){this.prod_id_crc=_1d}else{this.prod_id_crc=IORequest.hex32(IORequest.crc32_str(_1d))}IORequest.request_crc=this.prod_id_crc;IORequest.offer_type=this.offer_type;IORequest.offer_id=this.offer_id;this.group=this.prod_id_crc.substr(0,2);this.url=IORequest.url_prefix[IORequest.access_method]+IORequest.client_id+"/"+_a+"/"+this.offer_type+this.offer_id+"/"+this.offer_type+this.group+"/"+this.prod_id_crc+".js?V="+this.cgi_version;this.display_status("retrieving IO file product ID: "+_1d+" url: "+this.url,"green");IORequest.log(IORequest.log_trace,"retrieving IO file product "+_1d+" - url",this.url);this.action_callback("product_request");if((IORequest.access_method=="ajax local")||(IORequest.access_method=="ajax remote")){this.xmlHttp=_13();if(this.xmlHttp===null){this.cm_alert("Your browser really does not support Ajax!");return }this.h_timer=setTimeout("_io_request.ajax_timeout(0)",IORequest.timeout[this.i_timeout]);this.i_timeout=1;this.request_type="product";this.xmlHttp.onreadystatechange=this.stateChanged;this.stop_watch.start();try{this.xmlHttp.open("GET",this.url,true)}catch(e){clearTimeout(this.h_timer);this.display_status("Ajax Error: Cross Domain request attempted.  Ajax not supported.  Try json x-domain.","red");IORequest.rec_request_abort()}try{this.xmlHttp.send(null)}catch(e1){clearTimeout(this.h_timer);this.display_status("Ajax Error: Host not found.  Ajax not supported.  Try json x-domain.","red");IORequest.rec_request_abort()}}else{this.h_timer=setTimeout("_io_request.javascript_timeout(0)",IORequest.timeout[this.i_timeout]);this.i_timeout=1;this.stop_watch.start();try{var h=document.getElementsByTagName("head").item(0);IORequest.h_script=document.createElement("script");IORequest.h_script.setAttribute("language","javascript");IORequest.h_script.setAttribute("type","text/javascript");IORequest.h_script.setAttribute("src",this.url);h.appendChild(IORequest.h_script)}catch(e2){IORequest.rec_request_abort()}}};this.download_config=function(){this.url=IORequest.url_prefix[IORequest.access_method]+IORequest.client_id+"/"+_9+"?ts="+(((new Date().getTime())/600000)|0);this.display_status("retrieving IO Config file: "+_9+" url: "+this.url,"green");IORequest.log(IORequest.log_trace,"retrieving IO config file "+_9,this.url);this.action_callback("config_request");if((IORequest.access_method=="ajax local")||(IORequest.access_method=="ajax remote")){this.xmlHttp=_13();if(this.xmlHttp===null){this.cm_alert("Your browser really does not support Ajax!");return }this.h_timer=setTimeout("_io_request.ajax_timeout(1)",IORequest.timeout[this.i_timeout]);this.i_timeout=1;this.request_type="config";this.xmlHttp.onreadystatechange=this.stateChanged;this.stop_watch.start();try{this.xmlHttp.open("GET",this.url,true)}catch(e){clearTimeout(this.h_timer);this.display_status("Ajax Error: Cross Domain request attempted.  Ajax not supported.  Try json x-domain.","red");IORequest.rec_request_abort()}try{this.xmlHttp.send(null)}catch(e1){clearTimeout(this.h_timer);this.display_status("Ajax Error: Host not found.  Ajax not supported.  Try json x-domain.","red");IORequest.rec_request_abort()}}else{this.h_timer=setTimeout("_io_request.javascript_timeout(1)",IORequest.timeout[this.i_timeout]);this.i_timeout=1;this.stop_watch.start();try{var h=document.getElementsByTagName("head").item(0);var js=document.createElement("script");js.setAttribute("language","javascript");js.setAttribute("type","text/javascript");js.setAttribute("src",this.url);h.appendChild(js)}catch(e2){IORequest.rec_request_abort()}}};this.cm_io_rec=function(_1e){this.stop_watch.stop();if(this.h_timer!==undefined){clearTimeout(this.h_timer);this.h_timer=undefined}if(this.io_zone.zpf!==undefined){if(_1e!==undefined){var _1f=_1e.pd[0][0];var _20=_1e.hd[6];var _21=_1e.hd[2];if((_20!==undefined)&&(_20.length==8)&&(IORequest.timeout_product[_20])){IORequest.log(IORequest.log_trace,"Product download attempt following timeout for same file.  Requested file CRC",IORequest.request_crc);IORequest.timeout_product[_20]=0;return }this.display_status("Successful download of IO Recommendations for product: "+_1f+' <font color="black">('+this.stop_watch.elapsed_time+" ms)</font>.","green");IORequest.log(IORequest.log_trace,"successful retrieval of IO Recommendations for product "+_1f,this.stop_watch.elapsed_time+" ms");IORequest.log(IORequest.log_iuo,"requested version: "+this.cgi_version+" returned version",_1e.hd[9]);IORequest.log(IORequest.log_product_file,"product file",_1e);var _22=[];var _23=[];var _24=[];var _25=[];var mpc=_io_state.cm_get_product_from_cookie("_MPC_");for(var _26=1;_26<_1e.pd.length;_26++){_25[_26-1]=[];_25[_26-1][0]=_26;if((IORequest.optional_parm=="R")&&(_21!="P")){_25[_26-1][1]=Math.floor(Math.random()*1000)}else{_25[_26-1][1]=_1e.pd[_26][1]*((_1e.pd[_26][2]==mpc)?_io_config.cp:1)}}_25.sort(function(a,b){return(b[1]-a[1])});if((_io_config.brand_multiplier!==undefined)&&(_io_config.brand_multiplier>1)){var mpb=_io_state.cm_get_product_from_cookie("_MPB_");if(mpb!==0){for(var _27=1;_27<_1e.pd.length;_27++){_25[_27-1]=[];_25[_27-1][0]=_27;var _28=_1e.pd[_27][_io_config.brand_index+3];var _29=IORequest.hex32(IORequest.crc32_str(_28));_25[_27-1][1]=_1e.pd[_27][1]*((_29==mpb)?_io_config.brand_multiplier:1)}_25.sort(function(a,b){return(b[1]-a[1])})}}if(_io_config.brand_index!==undefined){_io_state.cm_ted_io({i_offer:"brand",brn:_1e.pd[0][_io_config.brand_index+3]})}l_attribute_array=_1e.pd[0].length;for(var _2a=3;_2a<l_attribute_array;_2a++){var _2b=((_1e.ap!==undefined&&_1e.ap[_2a-3]!==undefined)?_1e.ap[_2a-3]:"");_24.push((_1e.pd[0][_2a]===undefined)?undefined:_2b+_1e.pd[0][_2a].replace(/"/g,'\\"'))}var _2c=[];var _2d=[];if(this.io_zone.filter_cp){var acp=_io_state.cm_get_product_from_cookie("_ACP_");for(var _2e=0;_2e<acp.length;_2e++){if(IORequest.encrypt_prds){_2c[acp[_2e]]=1}else{_2d[acp[_2e]]=1}}}if(this.io_zone.filter_pp){var app=_io_state.cm_get_product_from_cookie("_APP_");for(var _2f=0;_2f<app.length;_2f++){if(IORequest.encrypt_prds){_2c[app[_2f]]=1}else{_2d[app[_2f]]=1}}}for(var _30=0;_30<_io_config.bad_list.length;_30++){_2c[_io_config.bad_list[_30]]=1}if((IORequest.use_site_category===false)&&(_1e.pd[0][2])){_io_state.cm_ted_io({i_offer:"epr_category",cg:_1e.pd[0][2]})}IORequest.reason=[];for(var ii=0;((_22.length<this.io_zone.rec_plan.n_recs)&&(ii<_25.length));ii++){var _31=_25[ii][0];var _32=_1e.pd[_31][0];var _33=IORequest.hex32(IORequest.crc32_str(_32));IORequest.reason[_32]=6;var _34=_32.replace(/"/g,'\\"');var _35=true;if((IORequest.filtered_out_products[_32]===undefined)&&(_2d[_32]===undefined)&&(_2c[_33]===undefined)&&(IOState.h_productview_product[_32]===undefined)){var _36=[];for(var _37=3;((_37<_1e.pd[_31].length)&&(_35===true));_37++){if(IORequest.required_attributes[_37-3]&&!(_1e.pd[_31][_37])){_35=false}else{var _38=((_1e.ap!==undefined&&_1e.ap[_37-3]!==undefined)?_1e.ap[_37-3]:"");_36.push((_1e.pd[_31][_37]===undefined)?undefined:_38+_1e.pd[_31][_37].replace(/"/g,'\\"'))}}if(_35){_22.push(_34);if(IORequest.conflict_resolution===true){IORequest.filtered_out_products[_32]=1}_23.push('["'+_36.join('","')+'"]')}else{IORequest.log(IORequest.log_trace,_34+" required attribute not present","not sent to zpf");IORequest.reason[_32]=1}}else{if((_2d[_32]!==undefined)||(_2c[_33]!==undefined)){IORequest.log(IORequest.log_trace,_34+" recently carted, purchased, or in bad product list","not sent to zpf");IORequest.reason[_32]=2}else{if(IORequest.filtered_out_products[_32]!==undefined){IORequest.log(IORequest.log_trace,_34+" appears in previous zone","not sent to zpf");IORequest.reason[_32]=3}else{if(IOState.h_productview_product[_32]!==undefined){IORequest.log(IORequest.log_trace,_34+" appears in the recommendation list but is also a product for which a product view tag was issued for this page","not sent to zpf");IORequest.reason[_32]=5}}}}}this.display_product_table(_1e,_22);this.display_product_images(_1e,_22);var _39=[];_39._SP_="Recommendations from a product you recently viewed";_39._SC_="Recommendations from a category you recently viewed";_39._NR_="No Recs";_39._RVP_="Recommendations from a product you recently viewed";_39._LCP_="Recommendations from a product you recently added to your cart";_39._RPP_="Recommendations from a Product you recently purchased";_39._RVC_="Recommendations from a category you recently viewed";_39._MPC_="Recommendations from your favorite category";_39._DPF_="Recommendations from your favorite retail store";var _3a=[];var _3b=_22.length?true:false;var _3c=_3b?this.io_zone.rec_plan.rec_steps[IORequest.current_step].target_id:"_NR_";if(!_3b){IORequest.log(IORequest.log_trace,"No recommendations made it through the filters","changing target symbolic from "+this.io_zone.rec_plan.rec_steps[IORequest.current_step].target_id+" to _NR_.")}var _3d=this.io_zone.rec_plan.rec_steps[IORequest.current_step].heading||_39[_3c];_3a.push(_3b?'["'+_22.join('","')+'"]':"[]");_3a.push('"'+this.io_zone.name+'"');_3a.push('"'+_3c+'"');_3a.push('"'+_1f+'"');_3a.push('"'+_1e.pd[0][2]+'"');_3a.push("["+_23.join()+"]");_3a.push('["'+_24.join('","')+'"]');_3a.push('"'+_3d+'"');var _3e=this.io_zone.zpf+"("+_3a.join()+")";if(this.io_zone.zpf!==undefined){setTimeout(_3e,0)}}setTimeout('IORequest.stack_manager("sucessful product retrieval");',0)}};this.cm_io_cfg=function(_3f,_40){this.stop_watch.stop();clearTimeout(_io_request.h_timer);_io_request.h_timer=undefined;if(_io_config===undefined){if(_3f!==undefined){this.action_callback(_40?"server_cfg":"default_cfg");IORequest.log(IORequest.log_trace,"successful retrieval of config file",this.stop_watch.elapsed_time+" ms");IORequest.log(IORequest.log_config_file,"config file",_3f);if(_3f.zp!==undefined){_io_config=new IOConfig(_3f);this.action_callback("config_return")}else{setTimeout('IORequest.config_download_failure("corrupt config file");',0)}if(_40){IORequest.i_zone=0;setTimeout('IORequest.config_downloaded("successful config download");',0)}}}else{IORequest.log(IORequest.log_warn,"config request where _io_config already defined","aborting request")}}}IORequest.crc32_tab=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];IORequest.crc32_add=function(A,B){return IORequest.crc32_tab[(A^B)&255]^((A>>8)&16777215)};IORequest.crc32_str=function(C){var D;var A=C.length;var B;B=4294967295;for(D=0;D<A;D++){B=IORequest.crc32_add(B,C.charCodeAt(D))}return B^4294967295};IORequest.hex32=function(C){var D;var B;var A;D=C&65535;B=D.toString(16).toUpperCase();while(B.length<4){B="0"+B}D=(C>>>16)&65535;A=D.toString(16).toUpperCase();while(A.length<4){A="0"+A}return A+B};IORequest.cookie_info=function(D,C){var H=document.cookie;var B=H.length;var G=H.split(";").length;IORequest.log(IORequest.log_trace,"cookie_length: "+B+" number of cookies",IORequest.cookie_count(D));IORequest.log(IORequest.log_trace,"cookie",H);alert("n: "+G+" l: "+B+" cookie: "+H);if(C){var A=C-B-3-D.length;var F="";for(var E=0;E<A;E++){F+=""+E%10}IORequest.set_and_check_cookie(D,F);IORequest.cookie_info(D)}};IORequest.cookie_count=function(A){var C=document.cookie;var B=0;if(C){B=C.split(";").length}return B};IORequest.find_cookie=function(C){var B=document.cookie.split("; ");var A=C.length;for(var D=0;D<B.length;D++){if((C+"=")==B[D].substring(0,A+1)){return(B[D].substring(A+1))}}return(undefined)};IORequest.rm_cookie=function(A){document.cookie=A+"=;path=/;expires="+new Date(1998,0).toGMTString()+";;"};IORequest.set_and_check_cookie=function(D,C,A,B){document.cookie=D+"="+C+";path=/"+(A?"":";expires="+new Date(2020,0).toGMTString())+(B?";domain="+B:"");C=IORequest.find_cookie(D);if(C===undefined){if(!A){IORequest.perm_cookie_not_supported=true}}return(C)};IORequest.build_array_from_cookie=function(B){var A=IORequest.find_state_cookie();return((A===undefined)?undefined:(A.split(IORequest.cookie_separator))[B])};IORequest.find_state_cookie=function(){var C=IORequest.find_cookie(IORequest.state_cookie);if(C===undefined){var B=((IORequest.ie_version()!==null)&&(IORequest.ie_version()<7))?20:30;if(IORequest.cookie_count()>=B){C=undefined}else{var D=Math.floor(Math.random()*100);C=[D].join()+IORequest.cookie_separator+IORequest.cookie_separator+IORequest.cookie_separator+IORequest.cookie_array_separator+IORequest.cookie_array_separator+IORequest.cookie_array_separator+IORequest.cookie_array_separator+IORequest.cookie_array_separator+IORequest.cookie_array_separator;var A=C;C=IORequest.set_and_check_cookie(IORequest.state_cookie,A)}}return(C)};IORequest.ab_group_number=function(){var A=IORequest.build_array_from_cookie(0);return((A===undefined)?undefined:A.split(",")[0])};IORequest.default_json={zp:[{id:"Default_Zone",rp:[["001",0,99,3]]}],rp:{"001":[["101","_DPF_","0","You might be interested in"]]},oa:{"101":["4","P"]}};IORequest.i_zone=1;IORequest.i_msg=0;IORequest.rec_stack=[];IORequest.filtered_out_products=[];IORequest.b_timeout=false;IORequest.b_404=false;IORequest.zone_id=0;IORequest.primary_id=0;IORequest.fallback_id=0;IORequest.current_step=-1;IORequest.timeout_product=[];IORequest.cookie_separator="~|~";IORequest.cookie_array_separator="|";IORequest.ses_cookie="CoreM_Ses";IORequest.state_cookie="CoreM_State";IORequest.recently_viewed_product=undefined;IORequest.recently_viewed_category=undefined;IORequest.perm_cookie_not_supported=false;IORequest.access_method="json local";IORequest.log_cookie_write=2<<1;IORequest.log_config_file=2<<2;IORequest.log_product_file=2<<3;IORequest.log_trace=2<<4;IORequest.log_warn=2<<5;IORequest.log_error=2<<6;IORequest.log_iuo=2<<7;IORequest.production=false;IORequest.log_mask=IORequest.production?IORequest.log_error:(2<<16)-1;IORequest.log_mask=IORequest.log_mask&~IORequest.log_iuo;IORequest.log=function(C,B,A){if(C==IORequest.log_product_file||C==IORequest.log_config_file){console.group();console.dir(A);console.groupEnd()}else{if(C==IORequest.log_warn){console.warn(B+": ",A)}else{if(C==IORequest.log_error){console.error(B+": ",A)}else{if(IORequest.log_mask&C){console.log(B+": ",A)}}}}};IORequest.ie_version=function(){return(/MSIE (\d+\.\d+);/.test(navigator.userAgent)?RegExp.$1:null)};IORequest.url_prefix=[];IORequest.url_prefix["ajax local"]="";IORequest.url_prefix["ajax remote"]="/limelight/";IORequest.url_prefix["json local"]="";IORequest.url_prefix["json remote"]="http://coremetric.vo.llnwd.net/o33/";IORequest.rec_request=function(D,C,B,A){IORequest.plain_text_product_id=C;IORequest.plain_text_cat_id=B;IORequest.log(IORequest.log_trace,"cmRecRequest",D+","+C+","+B+","+A);IORequest.rec_stack.push([D,(IORequest.encrypt_prds?IORequest.hex32(IORequest.crc32_str(C)):C),(IORequest.encrypt_cats?IORequest.hex32(IORequest.crc32_str(B)):B),A])};IORequest.rec_request_abort=function(){IORequest.rec_stack=[];IORequest.filtered_out_products=[];IORequest.log(IORequest.log_trace,"Aborted request","communication exception")};IORequest.display_recs=function(){IORequest.i_msg=0;IORequest.i_zone=1;IORequest.filtered_out_products=[];_io_config=undefined;if(IORequest.chris_dot_html_config){_io_config=new IOConfig(IORequest.chris_dot_html_config);IORequest.log(IORequest.log_config_file,"config file",IORequest.chris_dot_html_config);IORequest.i_zone=0;IORequest.stack_manager("chris.html")}else{_io_request.download_config()}};IORequest.config_downloaded=function(A){IORequest.stack_manager(A)};IORequest.config_download_failure=function(B){_io_config=new IOConfig(IORequest.default_json);for(var A=0;A<IORequest.rec_stack.length;A++){_io_config.add_zone(IORequest.rec_stack[A][0])}IORequest.stack_manager(B)};IORequest.stack_manager=function(A){if(IORequest.rec_stack.length){var B=IORequest.rec_stack.shift();IORequest.i_zone++;IORequest.i_msg=0;IORequest.zone_id=B[0];IORequest.primary_id=B[1];IORequest.fallback_id=B[2];IORequest.optional_parm=B[3];IORequest.current_step=-1;IORequest.b_timeout=false;IORequest.b_404=false;if(_io_config.zones[IORequest.zone_id]===undefined){IORequest.log(IORequest.log_error,"cmRecRequest: zone "+IORequest.zone_id+" is not defined in the configuration file","no action taken");IORequest.stack_manager("zone: "+IORequest.zone_id+" is not defined in the configuration file")}else{_io_request.display_status("stack_manager called - "+A+" - parms: "+B.join(", "),"green");IORequest.log(IORequest.log_trace,"stack_manager called - "+A+" - parms",B.join(", "));_io_request.download_product()}}else{if(IORequest.i_zone==3){IORequest.i_zone=2}_io_request.display_status("All cmRecRequests completed","green");IORequest.log(IORequest.log_trace,"All cmRecRequests completed for zone",IORequest.zone_id);IORequest.i_zone=1;IORequest.i_msg=0}};IORequest.inspect_json=function(F,E,D){var H="",C,G;if(D===null||D===undefined){D=0}if(E===null||E===undefined){E=1}if(E<1){return'<font color="red">Error: Levels number must be > 0</font>'}if(F===null||F===undefined){return'<font color="red">Error: Object <b>NULL</b></font>'}H+="<ul>";var A;for(A in F){if(true){try{C=typeof (F[A]);H+="<li>("+C+") "+A+((F[A]===null)?(": <b>null</b>"):(':  <font color="red">'+F[A]+"</font>"))+"</li>";if((C=="object")&&(F[A]!==null)&&(D+1<E)){H+=IORequest.inspect_json(F[A],E,D+1)}}catch(B){if(typeof (B)=="string"){G=B}else{if(B.message){G=B.message}else{if(B.description){G=B.description}else{G="Unknown"}}}H+='<li><font color="red">(Error) '+A+": "+G+"</font></li>"}}}H+="</ul>";return H};function IOConfig(A){this.io=A;this.cp=this.io.cp||1.1;if(this.io.fnf!==undefined){this.file_not_found_id=this.io.fnf[0];this.file_not_found_pc=this.io.fnf[1]}this.bad_list=this.io.bl||[];this.ps=this.io.ps===undefined?1:this.io.ps;if(this.io.bp!==undefined){this.brand_index=this.io.bp[0];this.brand_multiplier=this.io.bp[1]}this.zones=[];this.n_zones=this.io.zp.length;this.rec_plan=[];for(var B=0;B<this.n_zones;B++){this.zones[this.io.zp[B].id]=new IOZone(this.io.zp[B],this.rec_plan,this.io.rp,this.io.oa)}this.add_zone=function(D){var C={id:D,rp:[["001",0,99,3]]};this.zones[D]=new IOZone(C,this.rec_plan,this.io.rp,this.io.oa)}}function IOZone(D,B,G,F){var E=undefined;this.name=D.id;var C=this.name+"_zp";if((window[C]!==undefined)&&(typeof window[C]=="function")){this.zpf=C}else{if((window.io_rec_zp!==undefined)&&(typeof window.io_rec_zp=="function")){this.zpf="io_rec_zp"}else{this.zpf=undefined}}this.filter_pp=(((D.fp!==undefined)&&(D.fp===0))?0:1);this.filter_cp=(((D.fc!==undefined)&&(D.fc===0))?0:1);if(D.rp.length==1){if(B[D.rp[0][0]]===undefined){B[D.rp[0][0]]=new IORecPlan(D.rp[0][0],G,F,D.rp[0][3])}this.rec_plan=B[D.rp[0][0]];this.ab_test_id="no ab test"}else{var H=IORequest.ab_group_number();this.rn=(H===undefined)?0:H;for(var A=0;((A<D.rp.length)&&(this.rec_plan===undefined));A++){if(this.rn>=D.rp[A][1]&&this.rn<=D.rp[A][2]){if(B[D.rp[A][0]]===undefined){B[D.rp[A][0]]=new IORecPlan(D.rp[A][0],G,F,D.rp[A][3])}this.rec_plan=B[D.rp[A][0]];this.ab_test_id=((D.rp[A][4]!==undefined)?D.rp[A][4]:"no ab test")}}}}function IORecStep(B,A){this.offer_id=B[0];this.target_id=B[1];this.offer_type=this.offer_id?A[this.offer_id][1]:"N";this.offer_version=this.offer_id?A[this.offer_id][0]:0;this.heading=(B[3]!==undefined)?B[3]:"";this.to_string=function(){return("offer_id: "+this.offer_id+" target_id: "+this.target_id+" offer_type: "+this.offer_type+" offer_version: "+this.offer_version)}}function IORecPlan(E,D,C,B){this.rec_steps=[];this.id=E;this.n_recs=B;for(var A=0;A<D[E].length;A++){this.rec_steps.push(new IORecStep(D[E][A],C))}}IOState.h_productview_product=[];IOState.productview_product="";IOState.productview_category="";function IOState(){var E=document;var C="undefined";var B=(IORequest.production?"~":"~");var A=":";var J=[];var I=[];var H=[];var G=[];var F=[];var D=[];var T=[];var S=[];var R=[];var Q=-1;var P=["p_viewed","p_carted","p_purchased","c_viewed","c_n_views","b_viewed","b_n_views"];var O=["pv","pc","pp","cv","cn","bv","bn"];var N=P;var M=false;var L=[];if(IORequest.basket_pages!==undefined){for(var K=0;K<IORequest.basket_pages.length;K++){L[IORequest.basket_pages[K]]=1}}this.cm_get_product_from_cookie=function(Y){if(J.length!==0||(cm_build_all_recent_arrays()===true)){if(Y=="_RVP_"){return(IORequest.recently_viewed_product)}if(Y=="_RVC_"){return(IORequest.recently_viewed_category)}if(Y=="_LCP_"){return(D[0]||0)}if(Y=="_RPP_"){return(T[0]||0)}if(Y=="_MPC_"){var X=0;for(var W=1;W<S.length;W++){if(parseInt(H[S[W]].n_viewed,10)>parseInt(H[S[X]].n_viewed,10)){X=W}}return(S[X]||0)}if(Y=="_MPB_"){var V=0;for(var U=1;U<R.length;U++){if(parseInt(G[R[U]].n_viewed,10)>parseInt(G[R[V]].n_viewed,10)){V=U}}return(R[V]||0)}if(Y=="_DFTP_"){return(IORequest.default_prd)}if(Y=="_DFTC_"){return(IORequest.default_cat)}if(Y=="_APP_"){return(T)}if(Y=="_ACP_"){return(D)}}return(0)};cm_initialize_id=function(U,V){U[V]=[];U[V].index=-1;U[V].n_bought=0;U[V].n_viewed=0;U[V].n_carted=0};cm_build_hash_from_array=function(W){var V=[];V.max_index=0;for(var U=0;U<W.length;U++){cm_initialize_id(V,W[U])}return V};cm_id_array_from_index_array=function(d,c,b,a,Z,Y){var X=[];X.max_length=c;if(d){var W=d.split(",");for(var e=0;e<W.length;e++){var V=b[W[e]];X.push(V);if(Z!==undefined){var U=Z.split(",");if((!(a===undefined))&&(U.length>0)){a[V][Y]=U[e]}}}if(X.length>X.max_length){X.length=X.max_length}}return X};cm_create_integer_array_from_id_array=function(W,U,Z){var X=[];for(var V=0;V<W.length;V++){var Y=W[V];if(U[Y].index==-1){U[Y].index=U.max_index++}X.push(U[Y][Z])}return X};cm_create_id_array_from_hash=function(U){var V=[];for(var W in U){if(typeof W!="function"){V[U[W].index]=W}}return V};cm_add_action=function(b,U,Z,X,a){var Y;var W=b;if(Z){W=IORequest.hex32(IORequest.crc32_str(b));IORequest.log(IORequest.log_trace,"crc of "+b,W)}if(W!==undefined){Y=[W];Y.max_length=X.max_length;if(U[W]===undefined){cm_initialize_id(U,W)}if(a!==undefined){U[W][a]++}for(var V=0;V<X.length;V++){if(X[V]!=W){Y.push(X[V])}}if(Y.length>Y.max_length){Y.length=Y.max_length}}else{Y=X}return(Y)};cm_remove_element_from_array=function(Y,W,V){var U=[];if(V){W=IORequest.hex32(IORequest.crc32_str(W))}for(var X=0;X<Y.length;X++){if(!(W==Y[X])){U.push(Y[X])}}return U};cm_build_all_recent_arrays=function(){var W=[];var U=[];var a=[];var Z=IORequest.find_state_cookie(IORequest.state_cookie);if(Z!==undefined){var X=(Z===undefined)?4:(Z.split(IORequest.cookie_separator).length-1);J=IORequest.build_array_from_cookie(0).split(",");W=IORequest.build_array_from_cookie(1).split(B);I=cm_build_hash_from_array(W);U=IORequest.build_array_from_cookie(2).split(B);H=cm_build_hash_from_array(U);if(X>3){a=IORequest.build_array_from_cookie(3).split(B);G=cm_build_hash_from_array(a)}var V=IORequest.build_array_from_cookie(X).split(IORequest.cookie_array_separator);if(M&&(g_b_a_arrays[0].substring(0,2)==N[0].substring(0,2))){for(var Y=0;Y<V.length;Y++){V[Y]=V[Y].substring(N[Y].length+1)}}F=cm_id_array_from_index_array(V[0],IORequest.a_max_elements[0],W);D=cm_id_array_from_index_array(V[1],IORequest.a_max_elements[1],W);T=cm_id_array_from_index_array(V[2],IORequest.a_max_elements[2],W);S=cm_id_array_from_index_array(V[3],IORequest.a_max_elements[3],U,H,V[4],"n_viewed");if(X>3){R=cm_id_array_from_index_array(V[5],IORequest.a_max_elements[5],a,G,V[6],"n_viewed")}if(IORequest.recently_viewed_product===undefined){IORequest.recently_viewed_product=(F.length===0?0:F[0])}if(IORequest.recently_viewed_category===undefined){IORequest.recently_viewed_category=(S.length===0?0:S[0])}return(true)}else{return(false)}};cm_build_html_table_from_array=function(a,Z,b,Y){var X=(Y?2:1);var W=Z.length;var V="";var U=(X==1?"<TD COLSPAN=2>":"<TD>");if(W>0&&(Z[0]!==undefined)){V="<TR><TH ROWSPAN="+W+">"+a+"</TH>"+U+(X==2?b[Z[0]][Y]+"</TD><TD>":"")+Z[0]+"</TD></TR>";for(var c=1;c<W;c++){V+="<TR>"+U+(X==2?b[Z[c]][Y]+"</TD><TD>":"")+Z[c]+"</TD></TR>"}}else{V="<TR><TH ROWSPAN=1>"+a+"</TH><TD COLSPAN=2>No "+a+"</TD></TR>"}return(V)};cm_get_products_in_cart=function(){if(cm_build_all_recent_arrays()===true){return(D)}else{return([])}};this.cm_format_cookie_arrays=function(V){if(cm_build_all_recent_arrays()===true){var U="<TABLE BORDER=2 CELLPADDING=2>";U+="<TR> <TH COLSPAN=3>Recent "+(V=="products"?"Products":"Categories")+"</TH> </TR>";if(V=="products"||V===undefined){U+=cm_build_html_table_from_array("Viewed Products",F,I);U+=cm_build_html_table_from_array("Carted Products",D,I);U+=cm_build_html_table_from_array("Purchased Products",T,I)}if(V=="categories"||V===undefined){U+=cm_build_html_table_from_array("Category Views",S,H,"n_viewed")}return(U+"</TABLE>")}else{return("<H3>Can't create table.  Cookies disabled</H3>")}};this.cm_ted_io=function(Z){var Y=false;if(cm_build_all_recent_arrays()===true){if(Z.i_offer!==undefined){if(Z.i_offer=="epr_category"){if(Z.cg.length<=IORequest.max_cat_length){S=cm_add_action(Z.cg,H,IORequest.encrypt_cats,S,"n_viewed");Y=true}}if(Z.i_offer=="brand"){IORequest.log(IORequest.log_trace,"adding "+Z.brn,"g_a_brn_viewed array");R=cm_add_action(Z.brn,G,1,R,"n_viewed");Y=true}}else{if(Z.tid==1||Z.tid==6||Z.tid==5){IORequest.log(IORequest.log_cookie_write,"initial "+IORequest.state_cookie,IORequest.find_state_cookie())}if(5==Z.tid){var W=""+Z.pr;var V=""+Z.cg;if(W.length<=IORequest.max_prd_length){F=cm_add_action(W,I,IORequest.encrypt_prds,F);Y=true}if((IORequest.use_site_category===true)&&(V.length<=IORequest.max_cat_length)){S=cm_add_action(V,H,IORequest.encrypt_cats,S,"n_viewed");Y=true}IOState.b_product_view=true;IOState.h_productview_product[W]=1;IOState.productview_product=W;IOState.productview_category=V}if((4==Z.tid)&&(5==Z.at)&&(Z.pr.length<=IORequest.max_prd_length)){D=cm_add_action(Z.pr,I,IORequest.encrypt_prds,D);Y=true}if(4==Z.tid&&9==Z.at){if(Z.pr.length<=IORequest.max_prd_length){T=cm_add_action(Z.pr,I,IORequest.encrypt_prds,T);Y=true}}}if(Y){var U=[cm_create_integer_array_from_id_array(F,I,"index").join(","),cm_create_integer_array_from_id_array(D,I,"index").join(","),cm_create_integer_array_from_id_array(T,I,"index").join(","),cm_create_integer_array_from_id_array(S,H,"index").join(","),cm_create_integer_array_from_id_array(S,H,"n_viewed").join(","),cm_create_integer_array_from_id_array(R,G,"index").join(","),cm_create_integer_array_from_id_array(R,G,"n_viewed").join(",")];if(M){for(var c=0;c<N.length;c++){U[c]=N[c]+A+U[c]}}var d=J.join();var b=cm_create_id_array_from_hash(I).join(B);var e=cm_create_id_array_from_hash(H).join(B);var f=cm_create_id_array_from_hash(G).join(B);var X=U.join(IORequest.cookie_array_separator);var a=[d,b,e,f,X].join(IORequest.cookie_separator);IORequest.set_and_check_cookie(IORequest.state_cookie,a);IORequest.log(IORequest.log_cookie_write,"write "+IORequest.state_cookie,a)}}}};