function setAddToCart(rowId, productID)
{
		document.shoppingCartForm.selectedProductID.value=productID;
		document.shoppingCartForm.selectedLineItemNo.value=rowId;
		return true;
}

function setRemoveItem(rowId)
{
		document.shoppingCartForm.selectedLineItemNo.value=document.shoppingCartForm.lineItemNo[rowId].value;
		document.shoppingCartForm.selectedProductID.value=document.shoppingCartForm.productID[rowId].value;
		return true;
}

function setBuyThisItem(rowId)
{
//		document.shoppingCartForm.selectedLineItemNo.value=document.shoppingCartForm.lineItemNo[rowId].value;
//		document.shoppingCartForm.selectedProductID.value=document.shoppingCartForm.productID[rowId].value;
		document.shoppingCartForm.selectedItemQuantity.value=document.shoppingCartForm.itemQuantity[rowId].value;
		return true;
}

function showHide(element_suf) {
    if (document.getElementById("area_" + String(element_suf)).style.display=="none"){
        document.getElementById("area_" + String(element_suf)).style.display="";
    } else {
        document.getElementById("area_" + String(element_suf)).style.display="none";
    }
}

function collapseTrees(element_suf, flag) {
    if(element_suf == 1){
        if(flag == true)
            document.getElementById("area_1").style.display="none";
        else
            document.getElementById("area_1").style.display="";
    }

    if(element_suf == 2){
        if(flag == true)
            document.getElementById("area_2").style.display="";
        else
            document.getElementById("area_2").style.display="none";
    }
}

function processBillStateSelection()
{
   if(document.checkoutForm.billUSAState.value == "")
   {
       document.checkoutForm.billNonUSAState.disabled = false;
       document.checkoutForm.billCountry.value = "";
   }else{
       document.checkoutForm.billNonUSAState.value = "";
       document.checkoutForm.billNonUSAState.disabled = true;
       document.checkoutForm.billCountry.value = "UNITED STATES";
   }
}

function processShipStateSelection()
{
   if(document.checkoutForm.shipUSAState.value == "")
   {
       document.checkoutForm.shipNonUSAState.disabled = false;
       document.checkoutForm.shipCountry.value = "";
   }else{
       document.checkoutForm.shipNonUSAState.value = "";
       document.checkoutForm.shipNonUSAState.disabled = true;
       document.checkoutForm.shipCountry.value = "UNITED STATES";
   }
}

function processBillCountrySelection()
{
   if(document.checkoutForm.billCountry.value != "UNITED STATES")
   {
       document.checkoutForm.billUSAState.value = "";
       document.checkoutForm.billNonUSAState.disabled = false;
   }else{
       document.checkoutForm.billNonUSAState.value = "";
       document.checkoutForm.billNonUSAState.disabled = true;
   }
}

function processShipCountrySelection()
{
   if(document.checkoutForm.shipCountry.value != "UNITED STATES")
   {
       document.checkoutForm.shipUSAState.value = "";
       document.checkoutForm.shipNonUSAState.disabled = false;
   }else{
       document.checkoutForm.shipNonUSAState.value = "";
       document.checkoutForm.shipNonUSAState.disabled = true;
   }
}

function processOtherStateSelection(addressType)
{
   if(addressType == "bill")
   {
       document.checkoutForm.billUSAState.value = "";
   }else if (addressType == "ship"){
       document.checkoutForm.shipUSAState.value = "";
   }
}

function openTerms() {
	window.open("/ShoppingExperience/action/termsAndConditions", "", "width=650px, height=400px, resizable, scrollbars=yes")
}
