var d = new Date();
var curr_year = d.getFullYear();

document.write(''+
'<div id="ftr">\n'+
'  <div id="tNav" class="clearfix">\n'+
	'<ul>\n'+
		'<li><a href="https://www.survey.arrow.com/se.ashx?s=218043747221A91F" rel="windowCenter" class="popupwindow">Feedback</a></li>\n' +
		'<li><a href="http://' + env + '.arrownac.com/terms/">Terms of Use</a></li>\n'+
		'<li><a href="http://' + env + '.arrownac.com/privacy/">Privacy Policy</a></li>\n'+
		'<li><a href="http://' + env + '.arrownac.com/sitemap/">Sitemap</a></li>\n'+
	'</ul>\n'+
	'<p id="copy">&copy; ' + curr_year + ' <a href="http://www.arrow.com/" rel="windowCenter" class="popupwindow">Arrow Electronics</a>, Inc. All rights reserved.</p>\n'+
'  </div>\n'+
'</div>\n'

);

/* GOOGLE ANALYTICS */ 
if(document.domain == 'www.arrownac.com'){
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-21048962-1']);
    _gaq.push(['_trackPageview']);
  } else if (document.domain == 'components.arrow.com'){
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-21048962-2']);
    _gaq.push(['_trackPageview']);
  };
  (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);
  })();
  (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);
  })();
  $(document).ready(function(){
    filetypes = /\.zip$|\.exe$|\.pdf$|\.doc$|\.mp3$|\.wmv$|\.mov$/i;
    $('a').each(function (){
      if($(this).attr('href') !== undefined ) {
        if($(this).is('a#submit_search')) {
          $(this).click(function(){
            _gaq.push(['_trackPageview', '/partsearch/'])
          });
        }
        else if($(this).is('a#login_submit')) {
          $(this).click(function(){
            _gaq.push(['_trackPageview', '/myarrow/'])
          });
        }
        else if($(this).is('a[href^="mailto"]')) {
          $(this).click(function(){
            _gaq.push(['_trackPageview', '/email/' + $(this).attr('href')])
          });
        }
        else if($(this).is('a[href^="https://secure.trackvia.com"]')) {
          $(this).click(function(){
            _gaq.push(['_trackPageview', '/download/' + $(this).attr('href')])
          });
        }
        else if($(this).attr('href').match(filetypes)) {
          $(this).click(function(){
            _gaq.push(['_trackPageview', '/download/' + $(this).attr('href')])
          });
        }
        else if($(this).is('a[href^="http://247.arrownac.com"]')) {
          $(this).click(function(){
            _gaq.push(['_trackPageview', '/banner_ad/' + $(this).attr('href')])
          });
        }
        else if(this.hostname !== location.hostname) {
          $(this).click(function(){
            _gaq.push(['_trackPageview', '/outgoing/' + $(this).attr('href')])
          });
        }
      }
    });
  });			
