var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-7000042-1']);
_gaq.push(['_trackPageview']);

if (vUserId)
 _gaq.push(['_setCustomVar',1,'UserID',vUserId,1]);

// Run E-commerce Analytics
if (getParam("location") == "olc/results.w") // getParam def in global.js
{
 if (vOrderHeader != null && vOrderLine.length > 0 && _gaq != null)
 {
  _gaq.push(['_addTrans',
             vOrderHeader.orderId,      // order ID - required
             vOrderHeader.affiliation,  // affiliation or store name
             vOrderHeader.total,        // total - required
             vOrderHeader.tax,          // tax
             vOrderHeader.shipping,     // shipping
             vOrderHeader.city,         // city
             vOrderHeader.state,        // state or province
             vOrderHeader.country       // country
  ]);

  $.each(vOrderLine,function(i)
  {
   _gaq.push(['_addItem',
              vOrderLine[i].orderId,      // order ID - required
              vOrderLine[i].sku,          // SKU/code
              vOrderLine[i].productName,  // product name
              vOrderLine[i].category,     // category or variation
              vOrderLine[i].price,        // unit price - required
              vOrderLine[i].quantity      // quantity - required
   ]);
  });

  _gaq.push(['_trackTrans']);

 } // if vOrderHeader...
} // if need to output e-commerce info


(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

