/*********************************************************************************************\
*       COPYRIGHT © 2008 ENVISION INFORMATION TECHNOLOGIES, LLC.    ALL RIGHTS RESERVED       *
*       DISTRIBUTION, UNAUTHORIZED USE AND MODIFICATION IS STRICTLY PROHIBITED                *
*       ENVISION IT, MADISON, WI    http://www.envisionitllc.com   info@envisionitllc.com     *
\*********************************************************************************************/

function trackAd(anchor, adId, adSpotId, pageViewId)
{
  var xmlHttp = createHTTPRequest();
  
  var params = "adid=" + escape(adId) + "&adspotid=" + escape(adSpotId) + "&pageviewid=" + escape(pageViewId) + "&url=" + escape(anchor.href);
  
  xmlHttp.open("POST","/ad_click.php",true);
  
  //Send the proper header information along with the request
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");
  
  xmlHttp.send(params);
  
  return true;
};

function trackShare(share, pageViewId)
{
  var xmlHttp = createHTTPRequest();
  
  var params = "share=" + escape(share) + "&pageviewid=" + escape(pageViewId);
  
  xmlHttp.open("POST","/sharing_click.php",true);
  
  //Send the proper header information along with the request
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");
  
  xmlHttp.send(params);
  
  return true;
};

function trackSearch(searchId, resultPageNo, resultNo)
{
  var xmlHttp = createHTTPRequest();
  
  var params = "searchid=" + escape(searchId) + "&resultpageno=" + escape(resultPageNo) + "&resultno=" + escape(resultNo);
  
  xmlHttp.open("POST","/search_click.php",true);
  
  //Send the proper header information along with the request
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");
  
  xmlHttp.send(params);
  
  return true;
};

function trackNavigation(navigationId, url, pageViewId)
{
  var xmlHttp = createHTTPRequest();
  
  var params = "navigationid=" + escape(navigationId) + "&url=" + escape(url) + "&pageviewid=" + escape(pageViewId);
  
  xmlHttp.open("POST","/navigation_click.php",true);
  
  //Send the proper header information along with the request
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");
  
  xmlHttp.send(params);
  
  return true;
};

function trackCMSLink(link)
{
  var xmlHttp = createHTTPRequest();
  
  var params = "url=" + escape(link.href) + "&pageviewid=" + escape(cmsPageViewID);
  
  xmlHttp.open("POST","/tracking/track_link.php",true);
  
  //Send the proper header information along with the request
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");
  
  xmlHttp.send(params);
  
  return true;
};