var _g_eceDefCookieName = "_eceCartv2_" + "12583";
var _g_eceDefCookieMax = 5;
var _g_eceDefCookieSizeMax = 4000;
var _g_eceDefExpDate = new Date();
_g_eceDefExpDate.setTime(new Date().getTime() + (2 * 24 * 60 * 60 * 1000));
function _eceGetSubDomain()
{
if (document.getElementById && location && location.hostname)
{
var _eceUseDomain = location.hostname.toLowerCase();
var _eceUseDomainArray = _eceUseDomain.split(".");
if (_eceUseDomainArray.length >= 2)
{
if (_eceUseDomainArray[_eceUseDomainArray.length - 1].length >= 2)
{
if (isNaN(_eceUseDomainArray[_eceUseDomainArray.length - 1]))
{
var _eceTmpDomainStr = _eceUseDomainArray[_eceUseDomainArray.length - 2] + "." + _eceUseDomainArray[_eceUseDomainArray.length - 1];
if ((_eceUseDomainArray[_eceUseDomainArray.length - 2].length <= 2 || _eceUseDomainArray[_eceUseDomainArray.length - 2] == "com") && _eceUseDomainArray.length > 2)
_eceTmpDomainStr = _eceUseDomainArray[_eceUseDomainArray.length - 3] + "." + _eceTmpDomainStr;
return ("; domain=." + _eceTmpDomainStr);
//return ("; domain=." + _eceUseDomainArray[_eceUseDomainArray.length - 2] + "." + _eceUseDomainArray[_eceUseDomainArray.length - 1]);
}
}
}
}
return "";
}
function _eceGetCookie (cookieName)
{
var retStr = "";
if (document.cookie)
{
if (!cookieName)
cookieName = _g_eceDefCookieName;
var cookieArray = document.cookie.split(";")
var nCount = 0;
for (var n = 0; n < cookieArray.length; n++)
{
while(cookieArray[n].charAt(0) == ' '){cookieArray[n] = cookieArray[n].substring(1)}
if (cookieArray[n].indexOf(cookieName) == 0)
{
retStr += cookieArray[n].substring(cookieName.length+1 + (nCount > 0 ? 1 : 0));
nCount++;
}
}
}
return retStr;
}
function _eceWriteCookie (cookieValue, cookieName)
{
if (cookieValue.length > (_g_eceDefCookieMax * _g_eceDefCookieSizeMax))
{
alert("Maximum cart size exceeded.");
return "";
}
if (!cookieName)
cookieName = _g_eceDefCookieName;
_eceResetCart(cookieName);
for (var n = 0; n < _g_eceDefCookieMax; n++)
{
if ( cookieValue.length > _g_eceDefCookieSizeMax)
{
var setCookie = cookieName + (n > 0 ? n : "") + "=" + cookieValue.substring(0, _g_eceDefCookieSizeMax);
document.cookie = setCookie + "; expires=" + _g_eceDefExpDate.toGMTString() + "; path=/" + _eceGetSubDomain();
cookieValue = cookieValue.substring(_g_eceDefCookieSizeMax);
}
else
{
var setCookie = cookieName + (n > 0 ? n : "") + "=" + cookieValue;
document.cookie = setCookie + "; expires=" + _g_eceDefExpDate.toGMTString() + "; path=/" + _eceGetSubDomain();
break;
}
}
return "";
}
function _eceResetCart(cookieName)
{
if (!cookieName)
cookieName = _g_eceDefCookieName;
var cookieArray = document.cookie.split(";")
for (var n = 0; n < cookieArray.length; n++)
{
while(cookieArray[n].charAt(0) == ' '){cookieArray[n] = cookieArray[n].substring(1)}
for (var x = 0; x < _g_eceDefCookieMax; x++)
{
var useCookiename = cookieName + (x > 0 ? x : "") + "=";
if (cookieArray[n].indexOf(useCookiename) == 0)
document.cookie = useCookiename + "" + "; expires=-1; path=/" + _eceGetSubDomain();
}
}
}
var _g_eceDefCartButton = "https://services.mercantec.com/images/sample_add.jpg";
var _g_eceMerchantID = "12583";
var _g_eceCartButton = "";
var _g_ecePostAddLink = "http://basketandfloral.com/Shopping_cart.htm";
var _g_eceDefQtyText = "Quantity:";
var _g_eceImgAltText = 'alt="' + "Add To Cart" + '"';
var _g_eceQtyText = "";
if (!_g_eceQtyText)
_g_eceQtyText = _g_eceDefQtyText;
if (_g_eceCartButton)
_g_eceImgAltText = "";
else
_g_eceCartButton = _g_eceDefCartButton;
function _eceAttributeOptionsStructure(ID, name, priceUnit, price, displayOrder, selected)
{
this.ID = ID;
this.name = name;
this.priceUnit = priceUnit;
this.price = price;
this.displayOrder = displayOrder;
this.selected = selected;
}
function _eceAttributeStructure(name, type, displayOrder, options)
{
this.name = name;
this.type = type;
this.displayOrder = displayOrder;
this.options = options
}
function _eceProductStructure(ID, name, description, price, shipping, attributesString, attributes)
{
this.ID = ID;
this.name = name;
this.description = description;
this.price = price;
this.shipping = shipping;
this.attributesString = attributesString;
this.attributes = attributes;
}
function _eceAttributeInputStructure(ID, input)
{
this.ID = ID;
this.input = input;
}
var _g_eceProductArray = new Array();
_g_eceProductArray[0] = new _eceProductStructure("139411", "Surprise Bouquet", "Choose what's inside your surprise container.", "$0.00", "$0.00", '
| |
| |
| |
', new Array (new _eceAttributeStructure("", "1", "1", new Array (new _eceAttributeOptionsStructure("299959", "Sm (s)", "$", "56.9900", "1", "True"), new _eceAttributeOptionsStructure("299960", "Md", "$", "65.9900", "2", "False"), new _eceAttributeOptionsStructure("299961", "Lg", "$", "79.9900", "3", "False"))), new _eceAttributeStructure("", "1", "2", new Array (new _eceAttributeOptionsStructure("299962", "What goes inside", "$", "0.0000", "1", "True"), new _eceAttributeOptionsStructure("299963", "Goldfish", "$", "3.0000", "3", "False"), new _eceAttributeOptionsStructure("299964", "Jelly Beans", "$", "5.0000", "5", "False"), new _eceAttributeOptionsStructure("299965", "Gumballs", "$", "3.0000", "6", "False"), new _eceAttributeOptionsStructure("299966", "M & M'S", "$", "5.0000", "4", "False"), new _eceAttributeOptionsStructure("299967", "Popcorn", "$", "0.0000", "7", "False"), new _eceAttributeOptionsStructure("299968", "Pretzels", "$", "0.0000", "8", "False"), new _eceAttributeOptionsStructure("299969", "Peppermint", "$", "0.0000", "9", "False"), new _eceAttributeOptionsStructure("299970", "20 Dollar Bills ", "$", "20.0000", "10", "False"), new _eceAttributeOptionsStructure("299971", "Curly Ribbon", "$", "0.0000", "2", "False"), new _eceAttributeOptionsStructure("300506", "Candy Corn", "$", "3.0000", "11", "False"))), new _eceAttributeStructure("", "1", "3", new Array (new _eceAttributeOptionsStructure("299973", "Add a Mylar", "$", "0.0000", "1", "True"), new _eceAttributeOptionsStructure("299974", "Birthdays", "$", "5.0000", "2", "False"), new _eceAttributeOptionsStructure("299975", "Anniversary", "$", "5.0000", "3", "False"), new _eceAttributeOptionsStructure("299976", "Thank You", "$", "5.0000", "4", "False"), new _eceAttributeOptionsStructure("299977", "New Baby", "$", "5.0000", "5", "False"), new _eceAttributeOptionsStructure("299978", "Good Luck", "$", "5.0000", "6", "False"), new _eceAttributeOptionsStructure("299979", "Miss You", "$", "5.0000", "7", "False"), new _eceAttributeOptionsStructure("299980", "Love You", "$", "5.0000", "8", "False"), new _eceAttributeOptionsStructure("299981", "Congrats", "$", "5.0000", "9", "False"), new _eceAttributeOptionsStructure("300507", "Weddings", "$", "5.0000", "10", "False")))));
function _eceAddToCart(itemID, itemQty, linkThrough, _ecePostAddLink, formObj, attCounter)
{
_ecePostAddLink = unescape(_ecePostAddLink);
if (itemQty.length == 0)
{
alert("Quantity cannot be empty.");
return false;
}
else if (isNaN(itemQty))
{
alert("Quantity must be numeric.");
return false;
}
else if (parseInt(itemQty) < 1)
{
alert("Quantity must be greater than 0.");
return false;
}
var currentName = _eceGetCookie();
var newProdArray = new Array()
var bFound = false;
var attribArray = new Array();
if (formObj && attCounter)
{
for (n = 0; n < formObj.elements.length; n++)
{
var baseName = "a" + attCounter + "-";
if (formObj.elements[n].name.indexOf(baseName) == 0)
{
switch(formObj.elements[n].type)
{
case "select-one":
case "select-multiple":
for (var x = 0; x < formObj.elements[n].options.length; x++)
{
if (formObj.elements[n].options[x].selected)
attribArray[attribArray.length] = formObj.elements[n].options[x].value;
}
break;
case "radio":
case "checkbox":
if (formObj.elements[n].checked)
attribArray[attribArray.length] = formObj.elements[n].value;
break;
case "text":
case "textarea":
if (formObj.elements[n].value.replace(/\s/g, "").length > 0)
{
var name = formObj.elements[n].name.split("-");
if (name.length == 3)
attribArray[attribArray.length] = name[2] + "=" + escape(formObj.elements[n].value);
}
break;
}
}
}
}
if(currentName.length > 0)
{
var prodArray = currentName.split(",")
for (var n = 0; n < prodArray.length; n++)
{
var inputsMatch = true;
var localFound = false;
var item = prodArray[n].split(":")
if (item.length == 2)
item[2] = "";
if (item.length == 3)
{
if (item[0] == itemID && item[2] == attribArray.join("&"))
{
var newQty = parseInt(item[1]) + parseInt(itemQty)
newProdArray[newProdArray.length] = item[0] + ":" + newQty + ":" + item[2];
bFound = true;
}
else if (item[0] != 'm')
newProdArray[newProdArray.length] = item[0] + ":" + item[1] + ":" + item[2];
}
}
}
if (!bFound)
{
newProdArray[newProdArray.length] = itemID + ":" + itemQty + ":" + attribArray.join("&");
}
var cookie = newProdArray.join(",");
_eceWriteCookie (cookie);
// if (document.getElementById && !_ecePostAddLink)
// linkThrough = false;
var postAddLink = (_ecePostAddLink ? _ecePostAddLink : location.href);
if (linkThrough)
location.href = postAddLink;
else
{
if (typeof(this._eceDisplayMiniCart) != 'undefined')
{
if (typeof(this._eceDisplayMiniCart) == 'function')
_eceDisplayMiniCart(true);
}
}
}
function _eceWriteProduct(useQty, useProductInfo)
{
var _ecePostAddLink = escape(_g_ecePostAddLink);
for (var n = 0; n < _g_eceProductArray.length; n++)
{
document.writeln('');
}
}
_eceWriteProduct(false, false);