<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
<ModulePrefs 
  title="Quaker List" 
  height="500"
  title_url="http://echo3.net/"
  scrolling="false"
  directory_title="Quaker List"
  description="Quaker List"
  screenshot="http://grocery-wave.appspot.com/assets/thumbnail.png"
  thumbnail="http://grocery-wave.appspot.com/assets/thumbnail.png"
  author="Michael"
  author_email="michael@echo3.net"
  author_affiliation="Echo3 Online Services, LLC"
  author_photo="http://echo3.net/images/echo3.gif"
  author_link="http://chronita.com/google_gadgets/"
>
<Require feature="dynamic-height" /> 
<Require feature="wave" /> 
</ModulePrefs>
<UserPref name="mode" default_value="0" display_name="Mode" datatype="enum" >
  <EnumValue value="0" display_value="Grocery List" />
  <EnumValue value="1" display_value="Shopping List" />
  <EnumValue value="2" display_value="To-Do List" />
</UserPref>
<Content type="html">
<![CDATA[ 
<style>
BODY {font-family:Arial, sans-serif;background-color:#ffffff;}
FORM {display:inline;padding:0;margin:0;border:none;}
INPUT {position:relative;background-color:transparent;vertical-align:center;font-size:14px;z-index:1;}
A.ilink {font-weight:bold;font-size:12px;color:#8F0515;}
.small-button {background-color:#eeeeee;border:solid 1px #999999;-moz-border-radius:4px;}
.small-text {border:solid 1px #999999;-moz-border-radius:1px;}

.mode_prompt {font-size:12px;color:#000099;font-weight:bold;}
.radio {position:relative;top:2px;}

#shield {position:absolute;left:0;top:0;z-index:100;background-color:#00ffff;}
#wrapper {padding:12px;position:relative;overflow-x:hidden;}
#heading {height:60px;background-color:#ffffff;border-bottom:dashed 1px #ccccff;margin-bottom:10px;}
#user {cursor:pointer;color:#83A2D0;font-size:20px;}
#title {color:#0F4699;font-weight:bold;font-size:24px;}
#list {}
#words {position:absolute;z-index:3;overflow-x:hidden;overflow-y:auto;background-color:#ffffff;border:solid 1px #ffffff;padding-left:5px;}
#products {position:absolute;z-index:3;overflow-x:hidden;overflow-y:auto;background-color:#ffffff;border:solid 1px #ffffff;padding-left:5px;}
.predict {cursor:pointer;}
.pick {}
.hi-pre {background-color:#f0f0ff;}

.row {white-space:nowrap;border:solid 2px #ffffff;height:24px;border:solid 2px #ffffff;}
.title-row {white-space:nowrap;}
.cell {display:inline;height:26px;overflow:hidden;}
.title-cell {font-size:13px;color:#3A69AF;font-weight:bold;display:inline-block;}

.row-handle {position:relative;left:0;top:3px;background-color:#ffffff;cursor:pointer;}
.aisle-handle {position:relative;cursor:pointer;}

.drop-zone {overflow:hidden;}
.aisle-drop-zone {overflow:hidden;}
.drop-inner {border:solid 2px #000066;padding:2px;background-color:#9999cc;height:15px;}

.noedit {border:solid 2px transparent;}

.cB {position:relative;background-color:#ffffff;}
.c0 {position:relative;background-color:#EBF4F9;}
.strike {position:absolute;top:7px;height:5px;border-bottom:solid 1px #000000;z-index:2;}

.bgw {background-color:#ffffff;}
.btn {position:relative;top:4px;}
.icon {position:relative;left:6px;top:4px;padding-right:4px;}
.qty {text-align:center;}
.item {}
.note {}
.comment {display:none;}
.aisle {color:#ffffff;padding:6px;background-color:#000099;font-size:14px;font-weight:bold;}
</style>
<style>
BODY {margin:0;padding:0;}
</style>
<script>
var aisles_ar = new Array();
var suggestions_ar = new Array();
</script>
<script type="text/javascript">
var IE=document.all;var IAB=null;var prefs=null;var in_wave=false;var updated=0;var waveID=null;var user="";var owner="";var list_title="";var user_ar=null;var clr_ar=new Array("#000000","#006600","#000066","#666600","#660066","#660066","#666666","#660000");var itemID=null;var noteID=null;var timerID=null;var wsz_timerID=null;var savall_timerID=null;var saving_timerID=null;var arItems=null;var assets="http://grocery-wave.appspot.com/assets/";var is_wave=false;var saving=0;var mouseOffset=null;var mousePos=null;var dragObject=null;var dropTarget=null;var predicted=null;var moving_idx=null;var moving_hilight=false;var bFirstDownArrow=true;var GROCERY=0,SHOPPING=1,TODO=2;var current_mode=GROCERY;function setMode(c){for(var a=0;a<3;a++){var b=_gel("radio"+a);if(b){b.src=cached(assets+"radio-"+(c==a?"on":"off")+".png");}}if(c!=current_mode){current_mode=c;save();}render();}function cached(a){try{return gadgets.io.getProxyUrl(a);}catch(b){return _IG_GetCachedUrl(a);}}function getUserColor(a){return"#000000";}function getAisle(e){var d="Unsorted";try{var a=(e||"").toLowerCase();for(var f in aisles_ar){for(var b in aisles_ar[f][1]){if(a==aisles_ar[f][1][b]){return aisles_ar[f][0];}}}}catch(c){}return d;}function Item(a,e,d,c,g,j,f,i,b){this.id=parseInt(a);this.mode=e;this.status=d;this.user=(c||"user");this.icon=g;this.item=j;if(e==GROCERY||e==SHOPPING){this.note=f;}else{this.note="";}if(e==GROCERY){this.qty=i;this.aisle=(b||getAisle(j));}else{if(e==SHOPPING){this.qty=i;}this.aisle="";if(e==TODO){this.qty="";}}}function dupItem(a){var b=null;if(a){b=new Item(a.id,a.mode,a.status,a.user,a.icon,a.item,a.note,a.qty,a.aisle);}return b;}function moveItem(b,a){if(b!=a){shields(true);var c=dupItem(arItems[b]);if(a>=arItems.length){c.aisle=arItems[arItems.length-1].aisle;arItems.push(c);arItems.splice(b,1);}else{c.aisle=arItems[a].aisle;arItems.splice(b,1);if(a>b){a--;}if(a<0){a=0;}arItems.splice(a,0,c);}save();}listItems();}function moveAisle(j,e){var f=_gel("aisle"+j);if(f){shields(true);var a=-1;var c=new Array();var d=f.getElementsByTagName("div");for(var g in d){if(d[g]&&d[g].id&&d[g].id.substr(0,"row".length)=="row"){var k=parseInt(d[g].id.substr("row".length));c.push(dupItem(arItems[k]));if(a<0){a=k;}}}var b=c.length;if(a>=0&&b>0){var f=_gel("aisle"+e);var l=-1;if(f){var d=f.getElementsByTagName("div");for(var g in d){if(d[g]&&d[g].id&&d[g].id.substr(0,"row".length)=="row"){l=parseInt(d[g].id.substr("row".length));break;}}}if(l<0){arItems.splice(a,b);for(var g=0;g<b;g++){arItems.push(c[g]);}}else{if(a!=l){for(var g=0;g<b;g++){arItems.splice(l+g,0,c[g]);}if(l<a){a+=b;}arItems.splice(a,b);save();}}}}shields(false);listItems();}function getItemID(){return("item"+Math.random()).replace(/\./,"");}function getNoteID(){return("note"+Math.random()).replace(/\./,"");}function addItem(){if(dragObject){return;}var c=_gel(itemID);if(c){itemID=getItemID();c.id=itemID;var k=c.value;c.value="";if(k){var j=null;c=_gel("qty");if(c){j=c.value;c.value="";}var e=null;c=_gel(noteID);if(c){noteID=getNoteID();c.id=noteID;var a=new Object();a.value=k;e=(c.value||suggestItem(a,true));c.value="";}if(!arItems){arItems=new Array();}var g=arItems.length;for(var d in arItems){if(g<=arItems[d].id){g=arItems[d].id+1;}}user=owner;var f=null;if(is_wave){try{user=wave.getViewer().getDisplayName();f=wave.getViewer().getThumbnailUrl();}catch(b){}}if(current_mode==GROCERY){var a=new Item(g,current_mode,"u",user,f,k,(e||""),(j||"1"));clearList("words");clearList("products");for(var d in arItems){if(arItems[d].aisle==a.aisle){arItems.splice(d,0,a);a=null;break;}}if(a){arItems.unshift(a);}}else{if(current_mode==SHOPPING){arItems.unshift(new Item(g,current_mode,"u",user,f,k,(e||""),(j||"1")));}else{if(current_mode==TODO){arItems.unshift(new Item(g,current_mode,"u",user,f,k,"",""));}}}listItems();save();}}}function deleteItem(a){if(dragObject){return;}if(arItems&&arItems[a]){arItems[a].status="d";save();listItems();}}function editItem(b,d){if(dragObject){if(b){b.blur();}return;}if(b){var c=parseInt(b.id.substr(2));if(arItems&&arItems[c].status=="c"){b.blur();return;}if(d){editing=true;b.style.backgroundColor="#ffffee";b.style.border="inset 2px #cccccc";}else{b.style.backgroundColor="transparent";b.style.border="solid 2px transparent";}if(!d&&b.id){if(arItems&&arItems[c]){var a=b.id.substr(0,1);if(a=="q"){arItems[c].qty=b.value;}else{if(a=="i"){arItems[c].item=b.value;}else{if(a=="n"){arItems[c].note=b.value;}}}save();editing=false;}}}}function checkItem(a,b){if(dragObject){return;}if(arItems&&arItems[b]){if(arItems[b].status=="c"){arItems[b].status="u";if(a){a.src=cached(assets+"unchecked.png");}}else{arItems[b].status="c";if(a){a.src=cached(assets+"checked.png");}}a=_gel("strike"+b);if(a){if(arItems[b].status=="c"){a.style.display="block";}else{a.style.display="none";}}save("modify",arItems[b].id);}}function draggableRow(c,d,a){var b=_gel("row"+d);if(b){if(a){b.style.border="solid 2px #dddddd";b.style.backgroundColor="#eeeeee";}else{b.style.border="solid 2px #ffffff";b.style.backgroundColor="#ffffff";}}if(c){if(a){c.style.cursor="move";}else{c.style.cursor="auto";}}}function draggableAisle(c,d,a){var b=_gel("aisle"+d);if(b){if(a){b.style.border="solid 2px #dddddd";b.style.backgroundColor="#eeeeee";}else{b.style.border="solid 2px #ffffff";b.style.backgroundColor="#ffffff";}}if(c){if(a){c.style.cursor="move";}else{c.style.cursor="auto";}}}function szCells(){getIAB();var o=IAB.width-(12+18);var p=(current_mode==GROCERY||current_mode==SHOPPING?32:0);var a=7+15;var m=(is_wave?24:0);var d,g;if(current_mode==TODO){d=0;g=o-(16+p+a+a+m);}else{d=o-(p+a+a+m);d=Math.ceil((d+d)/3);g=o-(p+a+a+m);g=Math.floor(g/3);}var b=document.getElementsByTagName("div");for(var f in b){var l=0;if(b[f]&&b[f].className){if(b[f].className.indexOf("cell")>=0){if(b[f].className.indexOf("qty")>=0){l=p;}else{if(b[f].className.indexOf("item")>=0){l=g;}else{if(b[f].className.indexOf("note")>=0){l=d;}else{if(b[f].className.indexOf("ckb")>=0){l=a;}}}}}else{if(b[f].className.indexOf("strike")>=0){l=(p+g+d)-a;}}}if(l>0){b[f].style.width=l+"px";if(b[f].className.indexOf("btn")<0){var k=b[f].getElementsByTagName("input");for(var c in k){if(k[c]&&k[c].style){var n=6;if(k[c].id==noteID){n=28;}k[c].style.width=(l-n)+"px";}}}}}var e=_gel("words");if(e){e.style.width=(g-15)+"px";}var e=_gel("products");if(e){e.style.width=(d-15)+"px";}}function cleanUp(a){try{return(a||"").replace(/`/g,"'").replace(/\&amp\;/g,"&");}catch(b){return a;}}function defaultIcon(a){if(a){a.src=cached(assets+"unknown.jpg");}}function listItems(){var d=_gel("list");if(d){var a=null;var g=new Array();var f=0;var j=0;for(var e in arItems){if(arItems[e]&&arItems[e].status!="d"){if(!arItems[e].mode){arItems[e].mode=GROCERY;}if(arItems[e].mode!=current_mode){continue;}var l=getUserColor(arItems[e].user);var c="cB";if((++f)%2){c="c0";}if(current_mode==GROCERY&&arItems[e].aisle!=a){if(j>0){g.push("</div>");}a=arItems[e].aisle;if(arItems[e].aisle){var b=arItems[e].aisle;if(b=="MeatSeafood"){b="Meat & Seafood";}g.push('<div id="aisle',j,'">');g.push('<div id="aisle-drop',j,'" class="aisle-drop-zone" style="height:0px;">');g.push('<div class="drop-inner"></div>');g.push("</div>");g.push('<div class="aisle">');g.push('<img class="aisle-handle"');g.push(' onmouseover="draggableAisle(this, ',j,',1);"');g.push(' onmouseout="draggableAisle(this, ',j,',0);"');g.push(' align="left" alt="" title=""');g.push(' style="left:-4px;top:-1px;"');g.push(' src="',cached(assets+"aisle-dragtarget.png"),'"');g.push("/>");g.push(b,"</div>");j++;}}g.push('<div id="drop',e,'" class="drop-zone" style="height:0px;">');g.push('<div class="drop-inner"></div>');g.push("</div>");g.push('<div id="row',e,'" class="row">');g.push('<div class="',c,'">');g.push('<img class="row-handle"');g.push(' onmouseover="draggableRow(this, ',e,',1);"');g.push(' onmouseout="draggableRow(this, ',e,',0);"');g.push(' align="left" alt="" title=""');g.push(' src="',cached(assets+"dragtarget.png"),'"');g.push("/>");g.push('<div class="qty cell ',c,'">');g.push('<input class="qty noedit" value="',arItems[e].qty,'"');g.push(' id="qn',e,'"');g.push(' onfocus="editItem(this, 1)"');g.push(' onblur="editItem(this, 0)"');g.push(' style="width:0;color:',l,';"/>');g.push("</div>");g.push('<div class="item cell ',c,'">');g.push('<input class="item noedit" value="',cleanUp(arItems[e].item),'"');g.push(' id="in',e,'"');g.push(' onfocus="editItem(this, 1)"');g.push(' onblur="editItem(this, 0)"');g.push(' style="width:0;color:',l,';"/>');g.push("</div>");g.push('<div class="note cell ',c,'">');g.push('<input class="note noedit" value="',cleanUp(arItems[e].note),'"');g.push(' id="nn',e,'"');g.push(' onfocus="editItem(this, 1)"');g.push(' onblur="editItem(this, 0)"');g.push(' style="width:0;color:',l,';"/>');g.push("</div>");g.push('<div class="ckbtn cell ',c,'" style="margin-left:7px;">');g.push('<input align="top" class="btn" type="image" onclick="checkItem(this, ',e,')"');g.push(' height="15"');if(arItems[e].status=="c"){g.push(' src="',cached(assets+"checked.png"),'" />');}else{g.push(' src="',cached(assets+"unchecked.png"),'" />');}g.push("</div>");g.push('<div class="delbtn cell ',c,'" style="margin-left:7px;">');g.push('<input align="top" class="btn" type="image" onclick="deleteItem(',e,')"');g.push(' height="15" src="',cached(assets+"delete.png"),'" />');g.push("</div>");if(arItems[e].icon){g.push('<div id="icon',e,'" class="cell icon">');g.push('<img align="top" height="16" alt="',arItems[e].user,'" title="',arItems[e].user,'"');g.push(' onerror="defaultIcon(this);"');g.push(' src="',arItems[e].icon,'"/>');g.push("</div>");}g.push('<div id="strike',e,'" class="strike" style="display:');if(arItems[e].status=="c"){g.push("block");}else{g.push("none");}g.push('">&nbsp;</div>');g.push("</div>");g.push('<div class="comment">',arItems[e].user,",",arItems[e].status,"</div>");g.push("</div>");}}g.push('<div id="drop',arItems.length,'" class="drop-zone" style="height:0px;">');g.push('<div class="drop-inner"></div>');g.push("</div>");g.push('<div id="aisle-drop',1+j,'" class="aisle-drop-zone" style="height:0px;">');g.push('<div class="drop-inner"></div>');g.push("</div>");g.push('<div style="height:32px;"></div>');var k=g.join("");if(k!=d.innerHTML){d.innerHTML=k;}if(d.offsetHeight<300){d.style.height="300px";}szCells();makeDraggable();}setHeight();}function _jv(a){return'"'+a+'"';}function printList(b,f){if(b){b.write('<div id="heading">');b.write('<img align="right" src="http://grocery-wave.appspot.com/assets/logo.png" title="" alt=""/>');b.write('<span id="user">'+list_title+"</span>");if(f==GROCERY){b.write('<br /><span id="title">GROCERY LIST</span>');}else{if(f==SHOPPING){b.write('<br /><span id="title">SHOPPING LIST</span>');}else{if(f==TODO){b.write('<br /><span id="title">TO-DO LIST</span>');}}}b.write("</div>");b.write('<div style="position:relative;"><table width="100%" cellpadding="4">');b.write("<tr>");if(f==TODO){b.write('<td><div class="title-cell">Item Name</div></td>');}else{b.write('<td width="44" align="center"><div class="qty title-cell">Qty</div></td>');b.write('<td><div class="title-cell">Item Name</div></td>');if(f==GROCERY){b.write('<td width="66%"><div class="title-cell">Notes</div></td>');}else{b.write('<td width="66%"><div class="title-cell">Store</div></td>');}}b.write("</tr>");var e=0;for(var d in arItems){if(!arItems[d]||arItems[d].status=="d"||arItems[d].mode!=f){continue;}var a=getUserColor(arItems[d].user);var g="cB";if((++e)%2){g="c0";}var c="";if(arItems[d].status=="c"){c='<div style="position:relative;top:-10px;width:100%;z-index:2;border-top:solid 1px #000000;"></div>';}b.write('<tr class="'+g+'">');if(f==TODO){b.write('<td><div class="item" style="color:'+a+'">'+arItems[d].item+"</div>"+c+"</td>");}else{b.write('<td><div class="qty" style="color:'+a+'">'+(arItems[d].qty||"&nbsp;")+"</div>"+c+"</td>");b.write('<td><div class="item" style="color:'+a+'">'+arItems[d].item+"</div>"+c+"</td>");b.write('<td><div class="note" style="color:'+a+'">'+(arItems[d].note||"&nbsp;")+"</div>"+c+"</td>");}b.write("</tr>");b.write('<tr><td colspan="3">');b.write("</td></tr>");}b.write("</table></div>");}}function printView(){var b=open();if(!b){alert("permit popup window to print");}else{var a=b.document;a.write("<head>");a.write('<link rel="stylesheet" type="text/css" href="http://grocery-wave.appspot.com/assets/style.css"/>');a.write("</head>");a.write("<body>");var d=0;for(var e=0;e<3;e++){for(var c in arItems){if(arItems[c]&&arItems[c].status!="d"&&arItems[c].mode==e){if(d>0){a.write('<div style="page-break-after:always;"><hr/></div>');}printList(a,e);d++;break;}}}a.write("<script>");a.write("window.print();");a.write("<\/script>");a.write("</body>");a.close();}}function clearList(b){var a=_gel(b);if(a){a.style.height="0";a.style.border="none";a.innerHTML="";bFirstDownArrow=true;predicted="";}}function hiPre(c){if(c){c.className="predict hi-pre pick";var e=c.parentNode;var d=getY(e);var f=parseInt(e.style.height)-15;do{var b=getY(c);var a=(b-d)-e.scrollTop;if(a>f){e.scrollTop++;}else{if(a<0){e.scrollTop--;}}}while(a>f||a<0);}}function loPre(a){if(a){a.className="predict";}}function pick(d,e,f){var b=false;if(!f){f=_gel("words");if(!e){b=true;}}if(!d){if(f){var a=f.getElementsByTagName("div");for(var c in a){if(a[c]&&a[c].className&&a[c].className.indexOf("pick")>=0){d=a[c];break;}}}}var e=(e||_gel(itemID));if(d&&e){if(e.value==d.innerHTML.substr(0,e.value.length)){e.value=cleanUp(d.innerHTML||"");}clearList("words");}if(b){var d=_gel(noteID);d.focus();}}function picked(c){if(!c){sel=_gel("products");if(sel){var a=sel.getElementsByTagName("div");for(var b in a){if(a[b]&&a[b].className&&a[b].className.indexOf("pick")>=0){c=a[b];break;}}}}pick(c,_gel(noteID),_gel("products"));clearList("products");}function suggestItem(e,c){if(current_mode!=GROCERY){return;}if(!e){e=_gel(itemID);}var j=false;var d=new Array();if(e&&e.value){if(e.locked_list){return;}var g=e.value.toLowerCase();for(var b in suggestions_ar){if(g==suggestions_ar[b][0]){for(var f in suggestions_ar[b][1]){if(c){return suggestions_ar[b][1][f];}d.push(suggestions_ar[b][1][f]);j=true;}}}}if(j){var a=_gel("products");if(a){if(d.length<1){clearList("products");}else{if(d.length==1&&d[0]==getValue(noteID)){clearList("products");}else{var k='<div class="predict" onmouseover="hiPre(this)" onmouseout="loPre(this)" onclick="picked(this)">';a.innerHTML=k+d.join("</div>"+k)+"</div>";moving_idx=null;a.style.height="140px";a.style.border="solid 1px #ccccff";a.scrollTop=0;clearList("words");}}}}return j;}function setCaretPosition(d,b){var c=document.getElementById(d);if(c!=null){if(c.createTextRange){var a=c.createTextRange();a.move("character",b);a.select();}else{if(c.selectionStart){c.focus();c.setSelectionRange(b,b);}else{c.focus();}}}}function predictItem(e){if(current_mode!=GROCERY){return;}if(suggestItem(e)){return;}var d=new Array();if(e&&e.value){if(e.value==predicted||e.locked_list){return;}predicted=e.value;var g=e.value.toLowerCase();var j=g.length;for(var b in aisles_ar){for(var f in aisles_ar[b][1]){if(g==aisles_ar[b][1][f].substr(0,j).toLowerCase()){d.push(aisles_ar[b][1][f]);}}}}var a=_gel("words");if(a){if(d.length<1){a.style.height="0";a.style.border="none";}else{d.sort();var c=new Array();for(var f in d){if(f<1||d[f]!=d[f-1]){c.push(d[f]);}}var l='<div class="predict pick" onmouseover="hiPre(this)" onmouseout="loPre(this)" onclick="pick(this)">';var k='<div class="predict" onmouseover="hiPre(this)" onmouseout="loPre(this)" onclick="pick(this)">';a.innerHTML=l+c.join("</div>"+k)+"</div>";moving_idx=null;a.style.height="140px";a.style.border="solid 1px #ccccff";a.scrollTop=0;clearList("products");}}}function editListTitle(c,b){var a=_gel("user");if(a){a.style.display=(c?"none":"inline");if(!c&&b){list_title=getValue("list_title");a.innerHTML=list_title;setTimeout(function(){b();},333);}}var a=_gel("ltf");if(a){a.style.display=(c?"inline":"none");}return false;}function render(){var b=_gel("wrapper");if(b){if(!list_title){list_title=myTitle(owner||user);}var a=new Array();a.push('<div id="heading">');a.push('<img align="right" alt="" title="" src="',cached(assets+"logo.png"),'" />');a.push('<form id="ltf"');a.push(' onsubmit="return editListTitle(0, 1)"');a.push(' onreset="return editListTitle(0, 0)"');a.push(' style="display:none;font-size:12px;">');a.push('<input class="small-text" id="list_title" class="edit" value="',list_title,'"/>');a.push(' <input class="small-button" type="submit" value="save" />');a.push(' <input class="small-button" type="reset" value="cancel" />');a.push("</form>");a.push('<span id="user" onclick="editListTitle(1)">',list_title,"</span>");if(current_mode==GROCERY){a.push('<br /><span id="title">GROCERY LIST</span>');}else{if(current_mode==SHOPPING){a.push('<br /><span id="title">SHOPPING LIST</span>');}else{if(current_mode==TODO){a.push('<br /><span id="title">TO-DO LIST</span>');}}}a.push("</div>");a.push('<div style="margin-bottom:8px;">');a.push('<table width="100%"><tr><td><nowrap>');a.push('<a href="javascript:void(0);" onclick="setMode(0);return false;"');a.push(' class="ilink"><img id="radio0" class="radio" border="0" alt="switch to Grocery List"');a.push(' src="',cached(assets+"radio-"+(current_mode==GROCERY?"on":"off")+".png"),'"/>');a.push("</a>");a.push('<span class="mode_prompt"> GROCERY LIST</span>');a.push("&nbsp;&nbsp;&nbsp;");a.push('<a href="javascript:void(0);" onclick="setMode(1);return false;"');a.push(' class="ilink"><img id="radio1" class="radio" border="0" alt="switch to Shopping List"');a.push(' src="',cached(assets+"radio-"+(current_mode==SHOPPING?"on":"off")+".png"),'"/>');a.push("</a>");a.push('<span class="mode_prompt"> SHOPPING LIST</span>');a.push("&nbsp;&nbsp;&nbsp;");a.push('<a href="javascript:void(0);" onclick="setMode(2);return false;"');a.push(' class="ilink"><img id="radio2" class="radio" border="0" alt="switch to To-Do List"');a.push(' src="',cached(assets+"radio-"+(current_mode==TODO?"on":"off")+".png"),'"/>');a.push("</a>");a.push('<span class="mode_prompt"> TO-DO LIST</span>');a.push('</nowrap></td><td align="right">');a.push('<a href="javascript:void(0);" onclick="printView();return false;"');a.push(' class="ilink" style="margin-left:14px;">PRINT LIST</a>');a.push("</td></tr></table>");a.push("</div>");a.push('<div class="title-row">');a.push('<div class="title-cell" style="width:18px;">&nbsp;</div>');if(current_mode==GROCERY||current_mode==SHOPPING){a.push('<div class="qty title-cell">Qty</div>');}a.push('<div class="item title-cell">Item Name</div>');if(current_mode==GROCERY){a.push('<div class="note title-cell">Notes</div>');}else{if(current_mode==SHOPPING){a.push('<div class="note title-cell">Store</div>');}}a.push('<div class="delbtn title-cell"></div>');a.push("</div>");itemID=getItemID();noteID=getNoteID();a.push('<div class="title-row" style="margin-bottom:6px;">');a.push('<form onsubmit="addItem();return false;">');a.push('<div class="title-cell" style="width:18px;">&nbsp;</div>');if(current_mode==GROCERY||current_mode==SHOPPING){a.push('<div class="qty title-cell">');a.push('<input tabIndex="1" class="qty bgw" id="qty" style="width:0;" value="" /></div>');}a.push('<div class="item title-cell">');a.push('<input tabIndex="2" class="item bgw" id="',itemID,'"');a.push(' onfocus="this.locked_list=false"');a.push(' onkeyup="predictItem(this);" onblur="pick()" style="width:0;" value="" />');a.push('<div id="words" style="width:0;height:0;"></div>');a.push("</div>");if(current_mode==TODO){a.push('<div class="title-cell" style="width:24px;">&nbsp;</div>');}else{a.push('<div class="note title-cell">');a.push('<input tabIndex="3" class="note bgw" id="',noteID,'"');a.push(' style="width:0;" onfocus="this.locked_list=false;clearLockedList();suggestItem()"');a.push(' value="" onblur="picked()" />');a.push('<div id="products" style="width:0;height:0;"></div>');a.push("</div>");}a.push('<div class="ckbtn title-cell">');a.push('<input tabIndex="4" class="btn" type="image" onclick="addItem()" style="position:relative;left:6px;"');a.push(' align="right" height="24" src="',cached(assets+"add.png"),'" />');a.push("</div>");a.push("</form>");a.push("</div>");a.push('<div id="list"></div>');b.innerHTML=a.join("");listItems();}}function clearLockedList(){var a=_gel(itemID);if(a){a.locked_list=false;}}function setHeight(){try{gadgets.window.adjustHeight();}catch(a){_IG_AdjustIFrameHeight();}setTimeout(function(){getIAB();},300);}function handleSave(a){onDelta(null);}function _jesc(a){var c=a;try{c=(a||"").replace(/"/g,'\\"');}catch(b){}return c;}function shields(a){var b=_gel("shield");if(b){b.style.width=(a?IAB.width:"0");b.style.height=(a?IAB.height:"0");}}function onDelta(a){shields(false);if(saving>0){saving--;}}function save(f,d,g){shields(true);saving++;var a=new Date();updated=a.getTime();if(f!="reset"){var c='{"waveid":"'+waveID+'"';c+=',"timestamp":"'+updated+'"';c+=',"owner":"'+owner+'"';c+=',"mode":"'+current_mode+'"';c+=',"list_title":"'+list_title+'"';c+=',"items":[';for(var b in arItems){if(arItems[b]){if(b>0){c+=",";}c+="{";c+='"id":"'+arItems[b].id+'"';c+=',"qty":"'+_jesc(arItems[b].qty)+'"';c+=',"item":"'+_jesc(arItems[b].item)+'"';c+=',"aisle":"'+_jesc(arItems[b].aisle)+'"';c+=',"note":"'+_jesc(arItems[b].note)+'"';c+=',"status":"'+_jesc(arItems[b].status)+'"';c+=',"user":"'+_jesc(arItems[b].user)+'"';c+=',"mode":"'+_jesc(arItems[b].mode)+'"';c+=',"icon":"'+_jesc(arItems[b].icon)+'"';c+="}";}}c+="]";c+="}";var e=encodeURIComponent(c);if(typeof(wave)!="undefined"&&wave&&wave.isInWaveContainer()){wave.setStateCallback(function(){onDelta();});wave.getState().submitDelta({content:e});}}}function myTitle(a){var b=a;if(b){b=b+"'";if(b.substr(b.length-1).toLowerCase()!="s"){b+="s";}}return b;}function handleLoad(b,j,a){var g=0;arItems=new Array();if(b&&b.data){var k=b.data;if(k){var f=null;try{if(j){f=gadgets.json.parse(decodeURIComponent(j));}}catch(d){try{if(j){f=JSON.parse(decodeURIComponent(j));}}catch(d){}}user="";try{user=wave.getViewer().getDisplayName();}catch(d){}var c=new Array();if(f){g=f.timestamp;owner=(f.owner||user);current_mode=(f.mode||getPref("mode")||"0");list_title=(f.list_title||myTitle(owner||user));c=(f.items||new Array());}for(var e in c){if(c[e]&&c[e].item&&c[e].status!="d"){if(c[e].aisle&&!isNaN(c[e].aisle)){c[e].aisle=getAisle(c[e].item);}arItems.push(new Item(c[e].id,c[e].mode,c[e].status,c[e].user,c[e].icon,c[e].item,c[e].note,c[e].qty,c[e].aisle));}}}}setMode(current_mode);updated=parseInt(g);}function load(b){var c=null;try{if(typeof(wave)!="undefined"&&wave&&wave.isInWaveContainer()){in_wave=true;c=wave.getState().get("content");var d=new Object();d.data=c;handleLoad(d,c,b);}}catch(a){}}function setOpacity(a,b){if(a){if(b>100){b=100;}if(IE){a.style.zoom=1;if(b==100){a.style.filter="";}else{a.style.filter="alpha(opacity="+b+")";}}a.style.opacity=b/100;a.style.MozOpacity=b/100;a.opacity=b;}}function getValue(c){var b="";var a=_gel(c);if(a){b=(a.value||"");}return b;}function getPref(a){var c="";if(!prefs){try{prefs=new gadgets.Prefs();}catch(b){prefs=new _IG_Prefs();}}if(prefs){c=(prefs.getString(a)||"");}return c;}function getIAB(){if(self.innerWidth){w=self.innerWidth;h=self.innerHeight;}else{if(document.documentElement&&document.documentElement.clientWidth){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}else{if(document.body){w=document.body.clientWidth;h=document.body.clientHeight;}}}IAB=new Object();IAB.width=w;IAB.height=w;}function init(){getIAB();setOpacity(_gel("shield"),3);waveID=(_args()["waveId"]||"testing");try{if(wave&&wave.isInWaveContainer()){is_wave=true;waveID=wave.getWaveId();wave.setStateCallback(function(){load(true);});}else{load(true);}}catch(a){load(true);}document.onmousemove=mouseMove;document.onmouseup=mouseUp;window.onresize=function(){if(wsz_timerID){clearTimeout(wsz_timerID);}wsz_timerID=setTimeout(function(){szCells();},300);};if(document.addEventListener){document.addEventListener("keydown",keyHandler,false);}else{if(document.attachEvent){document.attachEvent("onkeydown",keyHandler);}else{document.onkeydown=keyHandler;}}}function boot(){if(aisles_ar.length<1){var a=document.createElement("script");a.setAttribute("src",cached("http://grocery-wave.appspot.com/js/aisles.js"));a.setAttribute("type","text/JavaScript");a.onload=function(){boot();};document.getElementsByTagName("head")[0].appendChild(a);}else{if(suggestions_ar.length<1){var a=document.createElement("script");a.setAttribute("src",cached("http://grocery-wave.appspot.com/js/suggestions.js"));a.setAttribute("type","text/JavaScript");a.onload=function(){boot();};document.getElementsByTagName("head")[0].appendChild(a);}else{aisles_ar.push(new Array("Unsorted",new Array()));init();}}}function hitEscape(){var b=true;var a=_gel("words");if(a){if(parseInt(a.style.height)!=0){b=false;a.style.height="0";a.style.border="none";}}var a=_gel("products");if(a){if(parseInt(a.style.height)!=0){b=false;a.style.height="0";a.style.border="none";}}return b;}var arMovers=new Array();function moveHiLight(b){var g=true;if(moving_hilight){return g;}moving_hilight=true;var d=null;var a=null;var f=_gel("words");if(f){if(parseInt(f.style.height)!=0){d=f;a=itemID;}}var f=_gel("products");if(f){if(parseInt(f.style.height)!=0){d=f;a=noteID;}}if(d){g=false;var c=d.getElementsByTagName("div");arMovers=new Array();for(var e in c){if(c[e]&&c[e].className&&c[e].className.indexOf("predict")>=0){if(c[e].className.indexOf("pick")>=0){moving_idx=arMovers.length;}c[e].className="predict";arMovers.push(c[e]);}}var f=_gel(a);moving_idx+=b;if(moving_idx>=arMovers.length){moving_idx=arMovers.length-1;}if(moving_idx<0){moving_idx=0;if(f){f.value=f.was_value;f.locked_list=false;}moving_hilight=false;hitEscape();return;}hiPre(arMovers[moving_idx]);if(f){if(!f.locked_list){f.was_value=f.value;f.locked_list=true;}f.value=cleanUp(arMovers[moving_idx].innerHTML);setCaretPosition(f.id,f.value.length);}}moving_hilight=false;return g;}function hitDownArrow(){var a=moveHiLight(1);if(bFirstDownArrow){bFirstDownArrow=false;if(arMovers.length>1){a=moveHiLight(-1);}}return a;}function hitUpArrow(){return moveHiLight(-1);}function keyHandler(c){var b=true;var a;if(!c||document.all){c=window.event;a=c.keyCode;}else{a=c.keyCode||c.charCode;}if(a==27){b=hitEscape();}else{if(a==38){b=hitUpArrow();}else{if(a==40){b=hitDownArrow();}}}return b;}function getMouseOffset(d,c){c=c||window.event;var b=getPosition(d);var a=mouseCoords(c);return{x:a.x-b.x,y:a.y-b.y};}function getPosition(c){var b=0;var a=0;while(c.offsetParent){b+=c.offsetLeft;a+=c.offsetTop;c=c.offsetParent;}b+=c.offsetLeft;a+=c.offsetTop;return{x:b,y:a};}function getY(a){var b=getPosition(a);return b.y;}function mouseCoords(a){if(a.pageX||a.pageY){return{x:a.pageX,y:a.pageY};}return{x:a.clientX+document.body.scrollLeft-document.body.clientLeft,y:a.clientY+document.body.scrollTop-document.body.clientTop};}var draggingAisle=false;var dragging=false;function dropZone(g){if(dragging){return;}dragging=true;var d=null;var a=99999999;var b=document.getElementsByTagName("div");for(var c in b){if(b[c]&&b[c].className){var e=b[c].className.indexOf("drop-zone");if(e>=0){b[c].style.height="0";if(draggingAisle&&b[c].className!="aisle-drop-zone"){continue;}if(!draggingAisle&&b[c].className!="drop-zone"){continue;}if(!draggingAisle||(e>0&&b[c].id.replace(/-drop/,"")!=dragObject.id)){var f=Math.abs(getPosition(b[c]).y-g);if(f<a){a=f;d=b[c];}}}}}if(d){dropTarget=d;dropTarget.style.height="24px";}dragging=false;}function mouseMove(a){if(dragObject){a=a||window.event;mousePos=mouseCoords(a);dragObject.style.position="absolute";dragObject.style.top=mousePos.y-mouseOffset.y;dragObject.style.left=mousePos.x-mouseOffset.x;dropZone(mousePos.y);return false;}}function makeDraggable(){var a=document.getElementsByTagName("img");for(var b in a){if(a[b]&&(a[b].className=="row-handle"||a[b].className=="aisle-handle")){a[b].onmousedown=function(c){draggingAisle=(this.className=="aisle-handle"?true:false);dragObject=this.parentNode.parentNode;mouseOffset=getMouseOffset(this,c);setOpacity(dragObject,70);return false;};}}}function mouseUp(b){b=b||window.event;var a=mouseCoords(b);if(dragObject&&dropTarget){dropTarget.style.height="0";if(dragObject.id.substr(0,"aisle".length)=="aisle"){moveAisle(parseInt(dragObject.id.substr("aisle".length)),parseInt(dropTarget.id.substr("aisle-drop".length)));}else{moveItem(parseInt(dragObject.id.substr("row".length)),parseInt(dropTarget.id.substr("drop".length)));}}dragObject=null;}try{gadgets.util.registerOnLoadHandler(boot);}catch(err){_IG_RegisterOnloadHandler(boot);}if(!this.JSON){JSON=function(){function f(n){return n<10?'0'+n:n}Date.prototype.toJSON=function(){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z'};var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};function stringify(value,whitelist){var a,i,k,l,r=/["\\\x00-\x1f\x7f-\x9f]/g,v;switch(typeof value){case'string':return r.test(value)?'"'+value.replace(r,function(a){var c=m[a];if(c){return c}c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"':'"'+value+'"';case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null'}if(typeof value.toJSON==='function'){return stringify(value.toJSON())}a=[];if(typeof value.length==='number'&&!(value.propertyIsEnumerable('length'))){l=value.length;for(i=0;i<l;i+=1){a.push(stringify(value[i],whitelist)||'null')}return'['+a.join(',')+']'}if(whitelist){l=whitelist.length;for(i=0;i<l;i+=1){k=whitelist[i];if(typeof k==='string'){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+':'+v)}}}}else{for(k in value){if(typeof k==='string'){v=stringify(value[k],whitelist);if(v){a.push(stringify(k)+':'+v)}}}}return'{'+a.join(',')+'}'}}return{stringify:stringify,parse:function(text,filter){var j;function walk(k,v){var i,n;if(v&&typeof v==='object'){for(i in v){if(Object.prototype.hasOwnProperty.apply(v,[i])){n=walk(i,v[i]);if(n!==undefined){v[i]=n}}}}return filter(k,v)}if(/^[\],:{}\s]*$/.test(text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof filter==='function'?walk('',j):j}throw new SyntaxError('parseJSON');}}}()}
</script>
<div id="wrapper"></div>
<div id="shield" style="width:0;height:0;"></div>
]]> 
</Content>
</Module>

