// * Copyright (c) 2009 Cheezburger Network. All rights reserved.

	var CheezburgerNetworkGAAccount = "UA-4387187-3";
	var CheezburgerNetworkList = ["superhappyrobots.com", "myweddingisabigdeal.com", "dontjudgemyhair.com"];

	try {
		// Initialize the new account global
		// Assumes _gat has already been initialized
		var pageTrackerCheezburgerNetwork = _gat._getTracker(CheezburgerNetworkGAAccount);
		
		//console.log("starting scripts");
		ICHC_GA_TrackNetworkPage();
		
		//ICHC_GA_LinkSession may have to be called in the footer of the page
		//ICHC_GA_LinkSession();
		
	}	catch(err) {}

	function ICHC_GA_TrackNetworkPage () {
		// Assumes pageTrackerCheezburgerNetwork has already been initialized
		try {
		
			//console.log("starting TrackNetworkPage");
			pageTrackerCheezburgerNetwork._setDomainName("none");
			//console.log("set Domain Name");
			pageTrackerCheezburgerNetwork._setAllowLinker(true);
			//console.log("allow linker");
			pageTrackerCheezburgerNetwork._setAllowHash(false);
			//console.log("disallow hash");

			pageTrackerCheezburgerNetwork._trackPageview();
			//console.log("track pageview");
		} catch(err) {}
	}

	function ICHC_GA_LinkSession() {
		//console.log("waiting for page to be ready");
		
	// Assumes JQuery has been initialized
		$(document).ready(function() {
			//console.log("starting LinkSession");
		
			// Each site we want to be considered "in the network" needs to be listed in CheezburgerNetworkList
			// Iterate through the list
			jQuery.each(CheezburgerNetworkList, function(index, value) {
			
				// Exclude any internal links from the current site
				if (location.host != value) {
					//console.log("starting filtering of anchors");
					$('a[href]').filter("[href^=http://" + value + "]")
						.click(function() {
						pageTrackerCheezburgerNetwork._link(this.href);
						//console.log("attached to " + this.href);
					});
				}	
			});
				
		});
	}


	
