// JavaScript Document
// Tracking.js 
// Analytics tracking by Matt Coffee
// extends www.google-analytics.com/ga.js
// extends jquery 1.4.2

//campaign Vars
var activity = "2651402";
var group = "check422";

function clicktrack(linkref, googleEvent, spotLight, floodLight, virtualPage, target) {
	//alert('clicktrack: googleEvent, virtualPage, floodLight, spotLight,  linkref');

	if(googleEvent != null){
		try {
  			_gaq.push(['_trackEvent', googleEvent, 'Interaction']);
			//alert('gaPush');
  		}
		catch(err)
  		{
  			console.log("Error: googleEvent tracking " + googleEvent +"| "+err)
  		}
	}
	
	if(virtualPage != null){
		try {			
  			    _gaq.push(['_trackPageview', '/virtual/' + virtualPage + '/']);

  		}
		catch(err)
  		{
  			console.log("Error: virtualPage tracking " + virtualPage +"| "+err)
  		}
	}
	
	if(floodLight != null){
		try {
			var axel = Math.random() + ""; 
			var ord = axel * 1000000000000000000;
			iframe = "http://fls.doubleclick.net/activityi;src=" + activity + ";type=" + group + ";cat=" + floodLight + ";ord=" + ord +"?";
  			$('body').append('<iframe id="'+ floodLight +'" height="1" width="1" border="0" src="'+iframe+'"/>');
			

  		}
		catch(err)
  		{
  			console.log("Error: floodLight tracking " + floodLight +"| "+err)
  		}

	}
	
	if(spotLight != null){
		try {
  			var click1 = new Image(); 
			var axel = Math.random() + ""; 
			var ord = axel * 1000000000000000000; 
			var imgname ="http://ad.doubleclick.net/activity;src="+ activity + ";type="+ group +";cat=" + spotLight + ";ord=" + ord + "?";
			click1.src = imgname;
			//alert('sportlight');
  		}
		catch(err)
  		{
  			console.log("Error: spotLight tracking " + spotLight +"| "+err)
  		}

	}	
	
	if(linkref != null){
		try {	
			if(target == "_blank") {
				setTimeout(function(){window.open(linkref);}, 500);
			} else {
				setTimeout(function(){document.location.href= linkref;}, 500);
			}
  		}
		catch(err)
  		{
  			console.log("Error: hyperlink " + linkref +"| "+err)
  		}

	}
}
function setIframe(src) {var newdoc = document.getElementById('nd').innerHTML = '<iframe src='+src+' style="border:none;width:1px;height:1px;" marginheight="0" marginwidth="0" frameborder="0"></iframe>';} 
