/// <reference path="jquery-1.3.2.min-vsdoc2.js" />
/// <reference path="IBFunctions.js" />

// ********************* ********************* ********************* ********************* ********************* //
function loadJQueryActions() {
	RemoveLinkToLists();
	//if (typeof(ANALYTICSTRACKERID) != "undefined") { ConfigAnalyticsForExitLinks(); } // already done from Analytics.js
}
// ********************* ********************* ** HANDLE MOSS MISBEHAVIOURS ************** ********************* //
function RemoveLinkToLists() { removeLinkToLists(document); }
function RemoveLinkToLists(node) {
	if(isMarkedNode(this)==true) { return; }
	markNode(this, true);
	// 
	$('*[href*="/Lists"]',node).each(function(i) {
		var style=$(this).attr('style');
		var classes=$(this).attr('class');
		var html=$(this).html();
		$(this).replaceWith($('<div'+(classes?' class="'+classes+'"':'')+(style?' style="'+style+'"':'')+'>'+html+'</div>'));
	});
	$('.ms-unselectedtitle',node).attr({ onmouseover:"", onfocus:"" });
	$('.ms-vb-title',node).each(function(i) {
		$(this).mouseover(function() {
			removeLinkToLists();
		});
	});
	$('.ms-menutoolbar',node).remove();
}
function markNode(node, markQ) { node.markedQ=markQ; }
function isMarkedNode(node) { return (node.markedQ==true); }
// ********************* ********************* ** GOOGLE ANALYTICS * ********************* ********************* //
function ConfigAnalyticsForExitLinks() {
	// ADD onclick action: <a href="outbound link" onClick="RecordOutboundLink(this, 'Outbound Links', 'example.com');return false;">

	$('a').each(function() {
		if (this.href && isLinkExternal(this.href) == true) {
			$(this).bind('click', function() {
				RecordOutboundLink(this.href, 'Outbound Links', this.href);
				return false;
			});
		}
	});

	$('.linksCombo option').each(function() {
		if (this.value && isLinkExternal(this.value) == true) {
			$(this).bind('click', function() {
				RecordOutboundLink(this.value, 'Outbound Links', this.value);
				return false;
			});
		}
	});
}
// ********************* ********************* ********************* ********************* ********************* //
