function displaySelectionWindow(c,b,a){var d="<div id='listselectiondiv' style='overflow: hidden; width:400px; height:150px;'><div id='listselectiontitle' style='width:400px; height:25px; background-color:#ddd; font-size:16px; font-weight: bold; text-align:center; padding-top: 5px;'>"+c[0]+"</div><form id='listselctionform' name='listselectionform' onsubmit='return "+a+"'; return false;'><table cellspacing='0' cellpadding='5' border='0' id='listselectiontable' style='padding:10px;'><tr><td><label for='listselect'>"+c[1]+"</label></td><td align='left'>"+b+"</td></tr><tr><td><label for='newListNameEntry'>"+c[2]+"</label></td><td><input name='newListNameEntry' id='newListNameEntry' style='width:200px;' maxlength='100'></td></tr></table><div id='newlistdivbuttons' style='width:400px; height:25px; text-align:center;'><input type='button' name='OK' value='"+c[3]+"' style='width:100px;' onClick='"+a+";'> <input type='button' name='Cancel' value='"+c[4]+"' style='width:100px;' onClick='hideModalWindow();'></div></form></div>";showModalWindow(400,150,d);if(document.getElementById("listselect").options.length>1){document.getElementById("listselect").focus();document.getElementById("newListNameEntry").disabled=true}else{document.getElementById("newListNameEntry").focus()}return false}function displayDeleteWindow(c,a){var b="<div id='deletelistdiv' style='overflow: hidden; width:320px; height:140px;'><div id='deletelistdivtitle' style='width:320px; height:25px; background-color:#ddd; font-size:16px; font-weight: bold; text-align:center; padding-top: 5px;'>"+c[0]+"</div><form id='listdeleteform' name='listdeleteform' onsubmit='return "+a+"; return false;'><table cellspacing='0' cellpadding='5' border='0' id='listrenametable' style='padding:10px;'><tr><td><p>"+c[1]+"</p></td></tr></table><div id='deletelistdivbuttons' style='width:320px; height:25px; text-align:center;'><input type='button' name='Yes' id='deleteyesbutton' value='"+c[2]+"' style='width:100px;' onClick='"+a+";'> <input type='button' name='No' value='"+c[3]+"' style='width:100px;' onClick='hideModalWindow();'></div></form></div> ";showModalWindow(320,140,b);document.getElementById("deleteyesbutton").focus()}function displayRenameWindow(d,b){var a=document.forms.frmMain.listName.value;var c="<div id='renamelistdiv' style='overflow: hidden; width:350px; height:120px;'><div id='renamelistdivtitle' style='width:350px; height:25px; background-color:#ddd; font-size:16px; font-weight: bold; text-align:center; padding-top: 5px;'>"+d[0]+"</div><form id='listrenameform' name='listrenameform' onsubmit='return "+b+"; return false;'><table cellspacing='0' cellpadding='5' border='0' id='listrenametable' style='padding:10px;'><tr><td><label for='renameListEntry'>"+d[1]+"</label></td><td><input name='renameListEntry' id='renameListEntry' style='width:200px;' maxlength='100' value=\""+a+"\"></td></tr></table><div id='renamelistdivbuttons' style='width:350px; height:25px; text-align:center;'><input type='button' name='OK' value='"+d[2]+"' style='width:100px;' onClick='"+b+";'> <input type='button' name='Cancel' value='"+d[3]+"' style='width:100px;' onClick='hideModalWindow();'></div></form></div> ";showModalWindow(350,120,c);document.getElementById("renameListEntry").focus()}function renameList(){displayRenameWindow(["Rename List","List name:","OK","Cancel"],"checkRenameList()")}function renameRegistry(){displayRenameWindow(["Rename Registry","Registry name:","OK","Cancel"],"checkRenameList()")}function checkRenameList(){var b=false;var a=document.getElementById("renameListEntry").value;if(a&&a.length>0){b=true;hideModalWindow();document.forms.frmMain.listName.value=a;document.forms.frmMain.action.value="Rename List";document.forms.frmMain.submit()}if(!b){alert("Please enter a valid name!");document.getElementById("renameListEntry").focus()}return false}function deleteList(){displayDeleteWindow(["Delete List Confirmation","Are you sure you wish to delete this list (<strong>"+document.forms.frmMain.listName.value+"</strong>)?","Yes","No"],"checkDeleteList()")}function deleteRegistry(){displayDeleteWindow(["Delete Registry Confirmation","Are you sure you wish to delete this registry (<strong>"+document.forms.frmMain.listName.value+"</strong>)?","Yes","No"],"checkDeleteList()")}function checkDeleteList(){hideModalWindow();document.forms.frmMain.action.value="Delete List";document.forms.frmMain.submit()}function addToList(a,b){document.forms.frmAddToListHandler.listProdcode.value=a;document.forms.frmAddToListHandler.quantity.value=b;document.forms.frmAddToListHandler.action.value="Add to List";nsc.get("/store/store.asp?action=do&doaction=getuserlists",function(c,d){if(d=="success"){displaySelectionWindow(["Add to List","Select list:","List name:","OK","Cancel"],c,"checkListName(false)")}})}function addAllToList(){document.forms.frmMultiAddProductHandler.action.value="Add to List";nsc.get("/store/store.asp?action=do&doaction=getuserlists",function(a,b){displaySelectionWindow(["Add All to List","Select list:","List name:","OK","Cancel"],a,"checkListName(true)")})}function addToRegistry(a,b){document.forms.frmAddToListHandler.listProdcode.value=a;document.forms.frmAddToListHandler.quantity.value=b;document.forms.frmAddToListHandler.action.value="Add to Registry";nsc.get("/store/store.asp?action=do&doaction=getuserregistries",function(c,d){if(d=="success"){displaySelectionWindow(["Add to Registry","Select registry:","Registry name:","OK","Cancel"],c,"checkListName(false)")}})}function addAllToRegistry(){document.forms.frmMultiAddProductHandler.action.value="Add to Registry";nsc.get("/store/store.asp?action=do&doaction=getuserregistries",function(a,b){if(b=="success"){displaySelectionWindow(["Add All to Registry","Select registry:","Registry name:","OK","Cancel"],a,"checkListName(true)")}})}function moveToList(){document.forms.frmAddToListHandler.action.value="Move to List";nsc.get("/store/store.asp?action=do&doaction=getuserlists",function(a,b){if(b=="success"){displaySelectionWindow(["Move to List","Select list:","List name:","OK","Cancel"],a,"checkListName(false)")}})}function moveToRegistry(){document.forms.frmAddToListHandler.action.value="Move to Registry";nsc.get("/store/store.asp?action=do&doaction=getuserregistries",function(a,b){if(b=="success"){displaySelectionWindow(["Move to Registry","Select registry:","Registry name:","OK","Cancel"],a,"checkListName(false)")}})}function selectList(a){var b=document.getElementById("newListNameEntry");if(a==0||document.getElementById("listselect").options.length==1){b.disabled=false;b.focus()}else{b.disabled=true}}function checkListName(e){var c=false;var d=document.getElementById("listselect");var b=0;if(d.options[d.selectedIndex].value==0){var a=document.getElementById("newListNameEntry").value;if(a&&a.length>0){c=true;document.getElementById("newListName").value=a}}else{b=d.options[d.selectedIndex].value;c=true}if(c){hideModalWindow();if(document.forms.frmAddToListHandler.action.value=="Move to List"||document.forms.frmAddToListHandler.action.value=="Move to Registry"){if(b==0){document.forms.frmMain.newListName.value=document.forms.frmAddToListHandler.newListName.value}document.forms.frmMain.action.value=document.forms.frmAddToListHandler.action.value;document.forms.frmMain.listId.value=b;document.forms.frmMain.submit()}else{if(e){if(b==0){document.forms.frmMultiAddProductHandler.newListName.value=document.forms.frmAddToListHandler.newListName.value}document.forms.frmMultiAddProductHandler.listId.value=b;document.forms.frmMultiAddProductHandler.submit()}else{document.forms.frmAddToListHandler.listId.value=b;document.forms.frmAddToListHandler.submit()}}}else{alert("Please enter a valid name!");document.getElementById("newListNameEntry").focus()}return false}function checkListItemQtys(b){var a=0;nsc(".list-qty-dropdown").each(function(){if(nsc(this).val()>0){a=a+nsc(this).val()}});if(a<1){alert("Please select a quantity for at least one item!");return false}}nsc(document).ready(function(){nsc("#list-add-to-basket").click(checkListItemQtys);nsc(".list-qty-dropdown-nowebsale").click(function(){alert("This item is no longer available for purchase online. Please contact the store owner.");nsc(".list-qty-dropdown-nowebsale").val(0);return false})});
