window.onload = function () { var check = initXMLHTTP(); if (!check) return; isBusy=true; } var xmlhttp; function initXMLHTTP () { try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP") } catch (e) { try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") } catch (e) { xmlhttp=false } } if (!xmlhttp) { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } return xmlhttp; } var oldQueryString,isBusy,zending, cooing=1; function getXmlHttpRequest(){ var request; try { request = new ActiveXObject("Msxml2.XMLHTTP"); Msxml2.XMLHTTP return request; } catch (e) {} try { request = new ActiveXObject("Microsoft.XmlHttp"); return request; } catch (e) {} try { request = new ActiveXObject("MSXML.XmlHttp"); return request; } catch (e) {} try { request = new ActiveXObject("MSXML3.XmlHttp"); return request; } catch (e) {} if (window.XMLHttpRequest && window.DOMParser && document.implementation && document.implementation.createDocument) { request = new XMLHttpRequest(); return request; } } var qq=""; function doajax(uuid) { if(cooing==1){ qq=uuid; var s="?"; s+="SelectedObjectUUID="+uuid+"&shadow=1"; if (isBusy) { xmlhttp.onreadystatechange = function () {}; xmlhttp.abort(); isBusy = false; } var td=document.getElementById('atmcb'); td.innerHTML=''; xmlhttp.open("GET","http://www.partstown.com/is-bin/INTERSHOP.enfinity/WFS/Reedy-PartsTown-Site/en_US/-/USD/ShadowAddToMYC-AddSrch"+s,true); cooing=0; isBusy = true; xmlhttp.onreadystatechange = processResponse; xmlhttp.send(null); if (typeof analytics !== "undefined" && typeof sioProducts !== "undefined" && sioProducts[uuid] != null) { delete sioProducts[uuid]['quantity']; analytics.track('Wishlisted Product', sioProducts[uuid]); } }else{ alert("Please wait, the previous product hasn't been added yet.") } } function processResponse() { if ( xmlhttp.readyState == 4 ) { if ( xmlhttp.responseText.indexOf('invalid') == -1 ) { cooing=1; if(xmlhttp.responseText.indexOf('login') == -1){ var td=document.getElementById('atmcb'); td.innerHTML=''; } else{ s="?SelectedObjectUUID="+qq; window.location.href="http://www.partstown.com/is-bin/INTERSHOP.enfinity/WFS/Reedy-PartsTown-Site/en_US/-/USD/ViewB2BWishlist-AddItem"+s; } } } }