// by John Ayo, 2005, 2009 // http://www.virginiaquilter.com // Portions derived from JavaScript The Definitive Guide 3rd Edition // by David Flanagan // If cart stored in cookie, use it function writelink() { var allcookies = document.cookie; var pos = allcookies.indexOf("CartNum="); if (pos != -1) { var start = pos + 8; var end = allcookies.indexOf(";", start); if (end == -1) end = allcookies.length; var value = allcookies.substring(start, end); value = unescape(value); // write save invocation link to page if (value != "") { document.write('Save Cart For Later
Saved up to seven days.
Price & availability subject to change.
'); // If item total over 25 go ahead and save if (ItemTot > 24.99) { savecart(); } } } } function savecart() { // Store cart number if available // Note: "%%SoftCart.SessionID%%" will not be parsed by SoftCart in a .js file // it is not meant to be parsed in this script, but rather used to detect when // the page is not being parsed by SoftCart. if (CartNum != "%%SoftCart.SessionID%%") { // Store the cookie var date = new Date(); date.setTime(date.getTime()+(14*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie="CartNum=" + escape(CartNum)+expires+"; path=/; domain=virginiaquilter.com"; // Store again for old Netscape "same server" document.cookie="CartNum=" + escape(CartNum)+expires+"; path=/"; // Store explanation cookie (for the paranoid) document.cookie="CartNumNotes=" + escape("The_CartNum_cookie_stores_your_session_ID_so_that_if_you_leave_the_site_and_come_back_later_you_can_resume_shopping_with_your_previous_selections_intact.")+expires+"; path=/; domain=virginiaquilter.com"; } } function forgetcart() { // Delete cart number cookie if (CartNum != "%%SoftCart.SessionID%%") { // Store the cookie var date = new Date(); date.setTime(date.getTime()-(14*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie="CartNum=" + escape(CartNum)+expires+"; path=/; domain=virginiaquilter.com"; // Store again for old Netscape "same server" document.cookie="CartNum=" + escape(CartNum)+expires+"; path=/"; // Store explanation cookie (for the paranoid) document.cookie="CartNumNotes=" + escape("The_CartNum_cookie_stores_your_session_ID_so_that_if_you_leave_the_site_and_come_back_later_you_can_resume_shopping_with_your_previous_selections_intact.")+expires+"; path=/; domain=virginiaquilter.com"; } }