// JavaScript


/* Multiple domains traking */

function multipleDomainsTrackingInit(domains) {
  for (var i = 0; i < domains.length; i++) {
    $('a[href*="' + domains[i] + '"]').bind('click', function() {
      _gaq.push(['_link', $(this).attr('href')]);
      return false;
    });
  }
}

/* Events and buy-pages tracking */

function eventsTrackingInit() {
  $('a[href*="secure.shareit.com"]').bind('click', function() {
    _gaq.push(['_trackEvent', 'Order', 'Via link', $(this).attr('href')]);

    /* Licenses */

    if ($(this).attr('href').indexOf('productid=300392553') != -1) {
      _gaq.push(['_trackPageview', 'basic-license-200-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392552') != -1) {
      _gaq.push(['_trackPageview', 'standard-license-350-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392551') != -1) {
      _gaq.push(['_trackPageview', 'professional-license-500-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392548') != -1) {
      _gaq.push(['_trackPageview', 'ultimate-license-2500-euro']);
    }

    /* Support subscriptions */

    if ($(this).attr('href').indexOf('productid=300392554') != -1) {
      _gaq.push(['_trackPageview', 'basic-support-80-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392558') != -1) {
      _gaq.push(['_trackPageview', 'standard-support-140-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392562') != -1) {
      _gaq.push(['_trackPageview', 'professional-support-200-euro']);
    }


    if ($(this).attr('href').indexOf('productid=300392556') != -1) {
      _gaq.push(['_trackPageview', 'basic-support-320-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392559') != -1) {
      _gaq.push(['_trackPageview', 'standard-support-560-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392563') != -1) {
      _gaq.push(['_trackPageview', 'professional-support-800-euro']);
    }


    if ($(this).attr('href').indexOf('productid=300392557') != -1) {
      _gaq.push(['_trackPageview', 'basic-support-480-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392560') != -1) {
      _gaq.push(['_trackPageview', 'standard-support-840-euro']);
    }
    if ($(this).attr('href').indexOf('productid=300392564') != -1) {
      _gaq.push(['_trackPageview', 'professional-support-1200-euro']);
    }

  });

  $('a[href*="eepurl.com/bzAJP"]').bind('click', function() {
    _gaq.push(['_trackEvent', 'Newsletter', 'Subscription link', $(this).attr('href')]);
  });

  $('a[href*="dataobjects.uservoice.com"]').bind('click', function() {
  _gaq.push(['_trackEvent', 'Uservoice', 'dataobjects.uservoice.com', $(this).attr('href')]);
  });

  $('a[href*="mailto:"]').bind('click', function() {
    _gaq.push(['_trackEvent', 'Email', 'To', $(this).attr('href')]);
  });
}


/* UserVoice tab initialization */

var uservoiceOptions = {
  key: 'dataobjects',
  host: 'dataobjects.uservoice.com', 
  forum: '76041',
  lang: 'en',
  showTab: false
};
function _loadUserVoice() {
  var s = document.createElement('script');
  s.src = ("https:" == document.location.protocol ? "https://" : "http://") + "cdn.uservoice.com/javascripts/widgets/tab.js";
  document.getElementsByTagName('head')[0].appendChild(s);
}
_loadSuper = window.onload;
window.onload = (typeof window.onload != 'function') ? _loadUserVoice : function() { _loadSuper(); _loadUserVoice(); };

