jpmaps.currencyaction='/localaction/currency.cfm';
jpmaps.currencycallback=[];


jpmaps.setcurrency=
  function ( currency ) {
    if (currency!=jpmaps.currencyname) {
      horus.openwin
        ('currencydisclaimer', '/includes/currency.popup.cfm', 300, 400, true);

      if (jpmaps.currencycallback.length>0) {
	var response=horus.ajax(jpmaps.currencyaction, 'set', { abbr: currency });

	if (response) {
	  horus.appendChild
	    ('currencylist', document.getElementById('currency'+jpmaps.currencyname));

	  jpmaps.currencyname=response.getAttribute('horus', 'abbr');
	  jpmaps.currencysymbol=response.getAttribute('horus', 'symbol');

	  horus.appendChild
	    ('thiscurrency', document.getElementById('currency'+jpmaps.currencyname));

	  horus.childText('currencydesc', response.getAttribute('horus', 'description'));

	  for (var i=0; i<jpmaps.currencycallback.length; i++)
	    jpmaps.currencycallback[i](currency);

	}
      } else {
	var href=window.location.href;
	currency='currency='+currency;

	if (/[?&]currency=/i.test(href))
	  window.location.href=href.replace(/([?&])currency=[a-z]+/i, '$1'+currency);
	else
	  window.location.href+=('?'.test(href) ? '&' : '?')+currency;

      }
    }

    return false;
  };


jpmaps.rightbasket=
  function ( items ) {
    horus.childText
      ('rightbasket',
       (!items ? 'nothing' : items==1 ? '1 item' : items+' items')+' in your basket');

  };


jpmaps.clearbasket=function () { jpmaps.rightbasket(0) };
