/* The following function is called from various event handlers through the LSLP page. It essentially takes an event ID and a user can then override the method and attach pixel tag events to the ID whenever needed. */

PixelTagUtility = {
	fireThirdPartyPixelTag : function(pixelTagOptions) {
		/*	
		switch(pixelTagOptions.thisEventId) {
			case 1:
				var spotTag1 = new SpotlightPixelTag({
					baseURL:'http://ad.doubleclick.net/activity',
					paramSrc:'1139716',
					paramType:'radcl947',
					paramCat:'dmacl747'
				});
				spotTag1.writePixelTag();
				break;
			case 2:
				var spotTag2 = new SpotlightPixelTag({
					baseURL:'http://ad.doubleclick.net/activity',
					paramSrc:'1139716',
					paramType:'sladd750',
					paramCat:'dmade779'
				});
				spotTag2.writePixelTag();
				break;
			case 6:
				var spotTag6 = new SpotlightPixelTag({
					baseURL:'http://ad.doubleclick.net/activity',
					paramSrc:'1139716',
					paramType:'elavd400',
					paramCat:'dmabr209'
				});
				spotTag6.writePixelTag();
				break;
			case 7:
				var spotTag7 = new SpotlightPixelTag({
					baseURL:'http://ad.doubleclick.net/activity',
					paramSrc:'1139716',
					paramType:'soffe549',
					paramCat:'dmavi096'
				});
				spotTag7.writePixelTag();
				break;
			case 8:
				var spotTag8 = new SpotlightPixelTag({
					baseURL:'http://ad.doubleclick.net/activity',
					paramSrc:'1139716',
					paramType:'ecadd697',
					paramCat:'dmaas114'
				});
				spotTag8.writePixelTag();
				break;
			case 10:
				var spotTag10 = new SpotlightPixelTag({
					baseURL:'http://ad.doubleclick.net/activity',
					paramSrc:'1139716',
					paramType:'eladd128',
					paramCat:'dmalo014'
				});
				spotTag10.writePixelTag();
				break;
			case 25:
				var spotTag25 = new SpotlightPixelTag({
					baseURL:'http://ad.doubleclick.net/activity',
					paramSrc:'1139716',
					paramType:'edire214',
					paramCat:'dmage699'
				});
				spotTag25.writePixelTag();
				break;
			default:
				break;
		}
		*/
	},
	/* not sure that we need the following util methods */
	generateYahooPixelTag : function(yahooPixelOptions) {
		
	},
	generateGooglePixelTag : function(googlePixelOptions) {
		
	},
	generateSpotlightPixelTag : function(spotlightPixelOptions) {
		
	},
	generateOmniturePixelTag : function(omniturePixelOptions) {
		
	}
}

function YahooPixelTag(yahooPixelOptions) {
	// constructor for Yahoo Pixel tag object
}

function GooglePixelTag(googlePixelOptions) {
	// constructor for Google Pixel tag object
}

function SpotlightPixelTag(spotlightPixelOptions) {
	// constructor for Spotlight Pixel tag object
	var o = spotlightPixelOptions;
	this.baseURL = o.baseURL;
	this.paramSrc = o.paramSrc;
	this.paramType = o.paramType;
	this.paramCat = o.paramCat;
	//needs to be generated every time the pixel tag is written to ensure it isn't getting cached
	//this.paramOrd = (Math.random()) * 10000000000000; 
}

SpotlightPixelTag.prototype.writePixelTag = function() {
	var cacheBlocker = (Math.random()) * 10000000000000; 
	var imgString = '<img src="' + this.baseURL + ';src=' + this.paramSrc + ';type=' + this.paramType + ';cat=' + this.paramCat + ';ord=' + cacheBlocker + '?" width="1" height="1" border="0" style="display:none" />';
	jQuery('body').append(imgString);
}

function FloodlightPixelTag(floodlightPixelOptions) {
	// constructor for Spotlight Pixel tag object
	var o = floodlightPixelOptions;
	this.baseURL = o.baseURL;
	this.paramSrc = o.paramSrc;
	this.paramType = o.paramType;
	this.paramCat = o.paramCat;
}

FloodlightPixelTag.prototype.writePixelTag = function() {
	var cacheBlocker = (Math.random()) * 10000000000000; 
	var iframeString = '<IFRAME SRC="' + this.baseURL + ';src=' + this.paramSrc + ';type=' + this.paramType + ';cat=' + this.paramCat + ';ord=1;num=' + cacheBlocker + '?" WIDTH="1" HEIGHT="1" FRAMEBORDER="0"></IFRAME>';
	jQuery('body').append(iframeString);
}

function OmniturePixelTag(omniturePixelOptions) {
	// constructor for Omniture Pixel tag object
}

DisplayAdPixelTag = {
	// display ad params vary by both make and dmaCode
	displayAdParams : {"buick_505": "107069","gmc_505": "107071","pontiac_505": "107070","chevrolet_504": "107078"},
	writePixelTag : function() {
		var thisKey = make.toLowerCase() + "_" + dmaCode;
		var thisId = DisplayAdPixelTag.displayAdParams[thisKey];
		if (thisId != undefined) {
			var imgString = '<img src="http://ad.yieldmanager.com/pixel?id=' + thisId + '&t=2" width="1" height="1" />';
			jQuery('body').append(imgString);
		}
	}
}