function beginSaveToList(ckey,sku){delete xmlHttp;createXMLHttpRequest();var url="http://mycatalogues.com/cgi2/mc.shoppinglist_i.cgi?c="+ckey+"&sku="+sku+"&r="+Math.random()*Date.parse(new Date());if(!xmlHttp){url=url+'&pp=1';popup(url,"resizable=no,toolbar=no,scrollbars=no,location=no,menubar=no,resizable=0,width=350,height=250,statusbar=yes","350","200");return false;}else{xmlHttp.onreadystatechange=handleStateChange;xmlHttp.open("GET",url,true);xmlHttp.send(null);}}function handleStateChange(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){begin_updates();}else{alert("Ooops! An error seems to have occured:: Error Code:"+xmlHttp.status);}}}function begin_updates(){var xmlDoc=xmlHttp.responseXML,msgs=xmlDoc.getElementsByTagName("message"),list=xmlDoc.getElementsByTagName("list"),total=xmlDoc.getElementsByTagName("count");update_bits(msgs,list,total);}function update_bits(msgs,list,total){var msg='',count='',itemkey='',currentProd=null,currentMsg=null,currentTot=null;currentMsg=msgs[0];if((currentMsg!==null)&&(currentMsg.childNodes[0]!==null)){msg=currentMsg.childNodes[0].nodeValue;}currentTot=total[0];if((currentTot!==null)&&(currentTot.childNodes[0]!==null)){count=currentTot.childNodes[0].nodeValue;}currentProd=list[0];if((currentProd!==null)&&(currentProd.childNodes[2]!==null)){itemkey=currentProd.childNodes[2].childNodes[0].nodeValue.toLowerCase();}if(msg>''){if(msg.substr(0,4)=='PASS'){document.getElementById('slcount').innerHTML='('+count+')';document.getElementById(itemkey).innerHTML='<img src="http://mycatalogues.com/img_mc/save2list3.gif" width="41" height="19" align="top" border="0" alt="Saved"></img>';}else if(msg.substr(0,4)=='FAIL'){document.getElementById(itemkey).innerHTML='<img src="http://mycatalogues.com/img_mc/save2list4.gif" width="41" height="19" align="top" border="0" alt="Done"></img>';}}}