//
//-------------------------------------------------------------------
// Licensed Materials - Property of IBM
//
// WebSphere Commerce
//
// (c) Copyright IBM Corp. 2006
//
// US Government Users Restricted Rights - Use, duplication or
// disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//-------------------------------------------------------------------
//

var busy = false;
//
// ***
// * This javascript function is used by the 'Add to Shopcart' button.  Since the HTML form is shared by both 'Add to Shopcart' and 'Add to Wish List' button,
// * appropriate values are set using this javascript before the form is submitted.
// * The variable 'busy' is used to avoid submitting the same forms multiple times when users click the button more than once.
// ***
//

function Add2ShopCart(form)
{
       if (!busy) {
              busy = true;
              form.action="/webapp/wcs/stores/servlet/OrderItemAdd";
              form.URL.value='/webapp/wcs/stores/servlet/OrderCalculate?URL=OrderItemDisplay';
              form.submit();
       }
}

function Add2ShopCart2(form, url)
{
       if (!busy) {
              busy = true;
              form.action="/webapp/wcs/stores/servlet/OrderItemAdd";
              form.URL.value='/webapp/wcs/stores/servlet/OrderCalculate?URL='+url;
              form.submit();
       }
}

function Add2ShopCart3(protocol, form, url)
{      
	     if (!busy) {
              busy = true;
              form.action=protocol + "/webapp/wcs/stores/servlet/OrderItemAdd";
              form.URL.value = url;
              form.submit();
       }
}

function Add2ShopCart4(form, url)
{      
	     if (!busy) {
	     	      busy = true;
              form.action="/webapp/wcs/stores/servlet/OrderItemAdd";
              form.URL.value = url;
              form.submit();
       }
}

// This javascript function is used by the 'Add to Wish List' button to set appropriate values before the form is submitted
function Add2WishList(form)
{
       if (!busy) {
              busy = true;
              form.action="/webapp/wcs/stores/servlet/InterestItemAdd"
              form.URL.value='/webapp/wcs/stores/servlet/nterestItemDisplay'
              form.submit()
       }
}

