// Currency formatting taken from:
// http://www.web-source.net/web_development/currency_formatting.htm
function currency_formatted(amount) {
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}

/* Interface plugin hack  -
   The interface plugin makes calls to a deprecated versin of the jquery
   deque function, this hack will act as a proxy between the old syntax
   and the new syntax. It is required for calls to TransferTo used with
   the shopping cart.
======================================================================*/
( function( $ ) {
      $.dequeue = function( a , b ){
              return $(a).dequeue(b);
      };
})( jQuery );

// This will return an object with the parameters from both params
// Properties from the second param will overwrite the first
function merge_objects(object1, object2) {
  resulting_object = new Object
  
  // Grab properties from object 1
  for (attribute in object1) {
    if (object1[attribute] != undefined) {
      resulting_object[attribute] = object1[attribute]
    }
  }
  
  // Grab properties from object 2
  for (attribute in object2) {
    if (object2[attribute] != undefined) {
      resulting_object[attribute] = object2[attribute]
    }
  }
  
  return resulting_object
}
