/**
 * Javascript for DART Floodlight tracking
 */
 
/**
 * Returns the element that containts the Floodlight iframe for tracking
 */
function getFloodlightDest() {
  var dest = document.getElementById('DCLK_FLDiv');
  if (!dest) {
    dest = document.body.appendChild(document.createElement('div'));
    dest.setAttribute('id', 'DCLK_FLDiv');
    dest.style.position = 'absolute';
    dest.style.left = '0px';
    dest.style.top = '0px';
    dest.style.width = '1px';
    dest.style.height = '1px';
    dest.style.visibility = 'hidden';
  }
  
  return dest;
}

/**
 * Return an "num" value for Floodlight
 */
function getFloodlightNum() {
  var axel = Math.random()+"";
  return axel * 10000000000000;
}

/**
 * Called when the "registration page" is reached
 */
function trackRegistrationComplete() {
  getFloodlightDest().innerHTML = '<iframe id="DCLK_FLIframe" src="http://fls.doubleclick.net/activityi;src=2042874;type=virtu862;cat=virtu346;ord=1;num='+getFloodlightNum()+'?" width="1" height="1" frameborder="0"></iframe>';
}

/**
 * Called when the "completed page" is reached
 */
function trackPromBuildComplete() {
  getFloodlightDest().innerHTML = '<iframe id="DCLK_FLIframe" src="http://fls.doubleclick.net/activityi;src=2042874;type=virtu862;cat=virtu183;ord=1;num='+getFloodlightNum()+'?" width="1" height="1" frameborder="0"></iframe>';
}
