function setupSlideShow() {
	//Set the campaign and offer code when a particular link is clicked.
	jQuery('#promoslides .pics a').bind('click', function(e) {
  	var offer    = this.id;
  	var campaign = jQuery(this).parent().attr("id").toUpperCase();
		var utm_c = offer;
		var utm_m = campaign;
		var utm_s = campaign
		    
		/* If we got a campaign on the URL, use that instead 
		 * But don't touch the UTM_X codes, because we use GA to track hpm conversions. 
 		 */
		c = jQuery.url.param("c");
		o = jQuery.url.param("o");
		
		/* If we already have a campaign code cookie, then we need to use that. */
		if (null != jQuery.cookie('campaignc') && typeof(jQuery.cookie('campaignc')) != 'undefined') {
			campaign = jQuery.cookie('campaignc'); 
			if (campaign.length == 6) {
				campaign = c.substring(0,3);
	 	    offer    = c.substring(3);
		  } else {
		    offer = '';
		  }
		} else {
		  if (typeof(c) != "undefined")  { 
				/* If there is no campaign cookie, and there is a C code in the URL, 
			 	 * turn that into the campaign code
			   */
		    if (c.length == 6) {
  		    campaign = c.substring(0,3);
	 	      offer    = c.substring(3);
	      } else {
		      campaign = c;
		      if (typeof(o) != "undefined") { offer = o; }
		    }
		  }
	  	jQuery.cookie('orderOfferCode', offer, { path: '/', expires: 30 });
	  	jQuery.cookie('campaignc', campaign, { path: '/', expires: 30 });
   	}
  	this.href = this.href + "?utm_campaign=" + utm_c + "&utm_source=" + utm_s + "&utm_medium=" + utm_m;
	});
		// Bind the pause button toggle actions
		jQuery('#pause').toggle(function(e) { 
	  	jQuery('#pause a').addClass('active');
	  	jQuery('#promoslides .pics').cycle('pause'); 
	  	return false; 
		}, function(e) { 
	  	jQuery('#pause a').removeClass('active');
	  	jQuery('#promoslides .pics').cycle('resume'); 
	  	return false;
		});        
		// Start the slideshow
		jQuery('#promoslides .pics').cycle({
	  	fx: 'fade',
	  	timeout: 8000,
	  	pager: '#nav'	
		});
}

function setCookies() {
	/* If we already have a campaign code cookie, then we need to use that. */
	if (null == jQuery.cookie('campaignc') && null != jQuery.url.param("c")) {
		jQuery.cookie('campaignc', jQuery.url.param("c"), { domain: 'kajeet.com', path: '/', expires: 30 });
	}
	if (null == jQuery.cookie('orderOfferCode') && null != jQuery.url.param("o")) {
		jQuery.cookie('orderOfferCode', jQuery.url.param("o"), { domain: 'kajeet.com', path: '/', expires: 30 });
	}	
}	
