<!--
// addFlag -- flag to detect if Add to shopping cart button has been pushed at least once
var addFlag = 0

function reCalc(strAction)  {
	strForm = document.assocprod
	var i = 0
	var tempValue = ''
	var arrID = "KitID"
	var arrQTY = "KitQTY"
	for (i=0;i<strForm.length;i++)
	{
	strURLAppendID = strForm.elements[i].name
	strURLAppendQTY = strForm.elements[i].value
	if(strURLAppendQTY=='')
		strURLAppendQTY = 0;
    //alert("Value= " + strURLAppendValue + " Name= " + strURLAppendName)
	arrID = arrID + "," + strURLAppendID
	arrQTY = arrQTY + "," + strURLAppendQTY
    }
	//alert(arrID)
	//alert(arrQTY)
	if (strAction == "RECALC"){
		location.href= "reCalc.asp?KitQTY=" + arrQTY
	}
	if (strAction == "ADDTOCART"){
		location.href= "reCalc.asp?KitQTY=" + arrQTY + "&AddToCart=yes"
	}
}

var txtWLCartMsg001, txtWLCartMsg002, txtWLCartMsg003;
if (ShopType = "SC"){
	txtWLCartMsg001 = "You may not add a product to the shopping cart since there is\nalready a gift certificate in the shopping cart.\nYou must either purchase the gift certificate first or\nelse clear the gift certificate out of your shopping cart"
	txtWLCartMsg002 = "You already have this product in your shopping cart.\nIf you want more than one of this item, press the\nView Shopping Cart button at left, then change the\nfigure in the Quantity box as you wish."
	txtWLCartMsg003 = "This product is already in your Shopping Cart.\nTo adjust quantities, click View Shopping Cart and make changes there."
}else{
	txtWLCartMsg001 = "You may not add a product to the wish list since there is\nalready a gift certificate on the wish list.\nYou must either purchase the gift certificate first or\nelse clear the gift certificate off of your whish list"
	txtWLCartMsg002 = "You already have this product on your wish list.\nIf you want more than one of this item, press the\nView wish list button at left, then change the\nfigure in the Quantity box as you wish."
	txtWLCartMsg003 = "This product is already on your wish list.\nTo adjust quantities, click View wish list and make changes there."
}

function addToCart()  {
    // set our next link form value
	document.assocprod.hidNextLink.value = "sy599frm.asp";
  	
	// check if a gift cert is already in cart
	if (strSessionCart.substring(0,4) == 'Gift') {
  		alert(txtWLCartMsg001);
    	return false;
  	}
	
	if (addFlag == 0)  {
		var objCart = strSessionCart;
	   	if (objCart != null)  {
			// get the product number from this form
			sItemParts = sItem.split('~');
			sProdno = sItemParts[0];
			
			// this works because product number is always first in both strings
			var updtFlag = 1;
			cLineItems = objCart.split('|');
			for (i=0;i<cLineItems.length;i++){
				cLineItemParts = cLineItems[i].split('~');
				cProdno = cLineItemParts[0];
				if (cProdno == sProdno){
					alert(txtWLCartMsg002)
					updtFlag = 0;
					return false;
				}
			}

			if (updtFlag == 1)  {
				// add this product to the strCartCookie
				if (strSessionCart == ""){
					// nothing else in the cookie, just add it
    				strSessionCart = sItem;
          			document.assocprod.hidSessionCart.value = strSessionCart;
          			return true;
        		}else{
          			// there is something in the cookie add a "|" then the item string
					strSessionCart = strSessionCart + "|" + sItem;
					document.assocprod.hidSessionCart.value = strSessionCart    
					return true;
				}
			}
		}else{
      		strSessionCart = sItem;
			document.assocprod.hidSessionCart.value = strSessionCart;
			return true;
		}
	}else{
		alert(txtWLCartMsg003)
	}
}

var smsChildVar
function smsSendAFriend(file)  {
  gotoLocation = file
  smsChildVar = window.open(gotoLocation,"","height=450,width=400,locationbar=no,directories=no,scrollbars=no")
}

// -->
