var bestsellers_links = $('#side-bestsellers li a');
 
bestsellers_links.each(function(index,element){
	  $(element).click(function(){
	  	pageTracker._trackEvent('Element - Bestsellers','Click',String(index+1));
	  });
});

$('#feature').find('a').click(function(){
	link = $(this).attr('href');
	
	pageTracker._trackEvent('Element - Featured','Click','0');
	pageTracker._trackEvent('Element - Featured (Products)',window.location.pathname,link)	
});

$('#featured .product-list-item a').live('click',function(){

	var $this = $(this);
	var p = $this.parents('.product-list-item').slice(0,1);	
	var index = $('#featured .product-list-item').index(p.get(0));
	var link = $this.attr('href');
	
	pageTracker._trackEvent('Element - Featured','Click',String(index+1));
	pageTracker._trackEvent('Element - Featured (Products)',window.location.pathname,link);

});

$('#now-available .product-list-item a').live('click',function(){

	var $this = $(this);
	var p = $this.parents('.product-list-item').slice(0,1);	
	var index = $('#now-available .product-list-item').index(p.get(0));
	var link = $this.attr('href');
	
	pageTracker._trackEvent('Element - Now Available','Click',String(index+1));
});

$('#coming-soon .product-list-item a').live('click',function(){

	var $this = $(this);
	var p = $this.parents('.product-list-item').slice(0,1);	
	var index = $('#coming-soon .product-list-item').index(p.get(0));
	var link = $this.attr('href');
	
	pageTracker._trackEvent('Element - Coming Soon','Click',String(index+1));
});

$('#latest-additions .product-list-item a').live('click',function(){

	var $this = $(this);
	var p = $this.parents('.product-list-item').slice(0,1);	
	var index = $('#latest-additions .product-list-item').index(p.get(0));
	var link = $this.attr('href');
	
	pageTracker._trackEvent('Element - Latest Additions','Click',String(index+1));
});

var related_links = $('#rel-product .product-list-item');

related_links.each(function(index,element){
	  $(element).find('a').click(function(){
	  	pageTracker._trackEvent('Element - Related','Click',String(index+1));
	  });
});

$('.product-content #product-intro-reviews a.create, .product-content .review-button').click(function(){
	var pathname = window.location.pathname;
	matches = pathname.match('^/([0-9]+)-([a-zA-Z0-9\-_]+)/$');	
	if (matches != null) {
		pageTracker._trackEvent('Reviews','Product Page Link',matches[1]);
	};
});

$('input[name=register-submit]').closest('form').submit(function(){
    next = $.jqURL.get('next')
    matches = next.match('^/([0-9]+)-([a-zA-Z0-9\-_]+)/reviews/create/$');	
    if (matches != null) {
        next = 'Reviews';        
    }
    pageTracker._trackEvent('Account','Register (Submit)',matches[1]);
});

$('input[name=review_preview]').closest('form').submit(function(){
	var pathname = window.location.pathname;
    matches = pathname.match('^/([0-9]+)-([a-zA-Z0-9\-_]+)/reviews/create/$');	
    if (matches != null) {
        product = matches[1];
		pageTracker._trackEvent('Reviews','Preview',matches[1]);
    }
});

$('input[name=review_submit]').closest('form').submit(function(){
	var pathname = window.location.pathname;
    matches = pathname.match('^/([0-9]+)-([a-zA-Z0-9\-_]+)/reviews/create/$');	
    if (matches != null) {
        product = matches[1];
		pageTracker._trackEvent('Reviews','Submit',matches[1]);
    }
});

$('input[name=create-review-account]').closest('form').submit(function(){
    next = $.jqURL.get('next')
    matches = next.match('^/([0-9]+)-([a-zA-Z0-9\-_]+)/reviews/create/$');	
    if (matches != null) {
       pageTracker._trackEvent('Reviews','Register Nickname',matches[1]);
    }
});

$('#product-properties table tr a').click(function(){
    var label = $(this).parent().parent().find('td').slice(0,1).text();
    pageTracker._trackEvent('Product Page','Properties Links',label);   
});

$('#product-categories a').click(function(){
    pageTracker._trackEvent('Product Page','Categories Links',label);   
});
