$(document).ready(function() {	
   $('.similar_items').find('a').click(function(){
	   txt = $(this).attr('href');
	   type = 'textLink'; 
	   if($(this).find('img').attr('src')) {
		   type='imgLink';
	   }	   
	   _gaq.push(["_trackEvent", "SimilarItems", type, txt]);	   
//	   if(typeof fp_clicktrack == 'function') {		   
//		   fp_clicktrack('SimilarItems',type,txt);
//	   }	   
	   return true;
   });
   $('.item-container.item-container-ad').find('a').click(function(){
	  obtrack_lost = $(this).parent().find('.strip-text-content .rec-src-link').text();
	  obtrack_title = $(this).parent().find('.strip-text-content .strip-rec-link-title').text();
	  _gaq.push(["_trackEvent", "outbrainOut", obtrack_lost, obtrack_title]);
	  return true;
   }); 
//   if(typeof fp_clicktrack == 'function') {		   
//	   fp_clicktrack('gschannel','returned',gs_channels);
//   }
   _gaq.push(["_trackEvent", "gschannel", 'returned', gs_channels]);
});
updatebg = false
function showTakeover() {
	try { 
		enable_takeover();
		clearInterval(updatebg);
	} catch (e) {}
}
$(document).ready(function() {
	try { 
		enable_takeover();
	} catch (e) {
		updatebg = setInterval('showTakeover()',5000);
	}
});
/*highlight tracking*/
window.onload = function() {
	var sel_text = null;
	var max_querylen = 60;
	var min_len = 3;
    var b = document.getElementsByTagName("body")[0];
    if (b) {
        b.onmouseup = function(c) {         	
			sel_text = getText();
          	f = sel_text.length;
          	d = cnt(sel_text);

            if (sel_text != null && d < max_querylen && f > min_len) {
                _gaq.push(["_trackEvent", "CopyText", "Highlighted", sel_text]);
           }
			
			function cnt(b) {
			    var d = b;
			    var c = 0;
			    a = d.replace(/\s/g, " ");
			    a = a.split(" ");
			    for (z = 0; z < a.length; z++) {
			        if (a[z].length > 0) {
			            c++
			        }
			    }
			    return c
			};
			
			function getText(){
				    if (window.getSelection) {
				        d = window.getSelection()
				    } else {
				        if (document.getSelection) {
				            d = document.getSelection()
				        } else {
				            if (document.selection) {
				                d = document.selection.createRange().text
				            } else {
				                return '';
				            }
				        }
				    }
					return d.toString();
				}
        }
    }
}
/* end highlight tracking*/
