
var Namespace_VideoReporting_WebTrends = function() {

return {

logVideoEvent_WebTrends : function(p_eventType, p_title, p_pos, p_clipId, p_clipAdTag, p_hostPage, p_affiliateName, p_OwnerAffiliateNo, p_isAd, p_ciid, p_refererUrl, p_baseUrl, p_reportingKeywords, p_uri, p_len, p_pctViewed, p_location, p_contentSource, p_keywords, p_playerType)
{
	//unescape
	p_title      = unescape(p_title);
	p_clipAdTag  = unescape(p_clipAdTag);
	p_hostPage   = unescape(p_hostPage);
	videoFormat  = "Flash";
		
	var g_ContID	= p_clipId;
	var g_AdTag		= p_clipAdTag;
	var g_AffName	= p_affiliateName; //"Flash Video";
	var g_ContType	= "V";
	var g_BaseURL	= p_baseUrl; //document.domain;
	
	//var g_SDCURL	= "http://wtnj.worldnow.com/dcs.gif";
	var g_SDCURL    = "http://wtsdc.worldnow.com/dcs.gif"; //new sdc box used for video only

	var dCurrent=new Date();
	var m_objImages=new Image;
	var m_URL = g_SDCURL;
	
	//if no baseurl is passed then use the current domain
	if ((g_BaseURL == '') || (g_BaseURL == null) || (g_BaseURL == "undefined"))
	{
		g_BaseURL = document.domain;
	}
	
	//-1 coming from windows media beacons and flash players will always send 0
	if (p_pos == "-1" || p_pos == "0")
	//if(p_pos != "undefined")
	//if (p_eventType == "OnStartBeacon" || p_hostPage == "FlashPlayer.wnfl")
	{
		//change hostpage which is used as the 'Application' in web trends to "WMPlayer.wnwm" if not "FlashPlayer.wnfl"
		if (p_hostPage != "FlashPlayer.wnfl") {
			p_hostPage = "WMPlayer.wnwm";
			videoFormat = "WindowsMedia";
		}
  
		//alert(p_hostPage);
		
		m_URL+="?WT.sp="+escape(g_AffName).toUpperCase();
			
		if (g_ContType!=null)
		{
			m_URL+="&dcsqry="+escape(g_ContType)+"="+g_ContID;
		}
		if (g_AdTag!="")
		{
			m_URL+="&WT.cg_n="+escape(g_AdTag);
		}

		m_URL+="&WT.ti="    + escape(p_title) + "-" + p_clipId;
		m_URL+="&dcsuri="   + escape(p_hostPage);
		m_URL+="&dcssip="   + escape(g_BaseURL).toLowerCase();
		
	    try
	    {
		    p_isAd = p_isAd.toLowerCase();
            if (p_isAd != "true")
                p_isAd = "false";

	    }
	    catch(err)
	    {
            p_isAd = "false";
	    }
			
		//custom namespace vars
		m_URL+="&WN.contentprovider="   + escape(p_OwnerAffiliateNo); //change to affName
		m_URL+="&WN.videoad="           + p_isAd;
		m_URL+="&WN.videoadid="         + escape(p_ciid);
		m_URL+="&WN.videoformat="       + escape(videoFormat);
		m_URL+="&WN.keywords="          + escape(p_reportingKeywords);
		m_URL+="&WN.cssrc="		        + escape(p_contentSource);
		m_URL+="&WN.cpkw="          	+ escape(p_keywords);
		m_URL+="&WN.pt=" 		+ escape(p_playerType);
		//m_URL+="&WN.duration=" + p_pos;
		
		m_URL+="&dcsdat="+escape(dCurrent.getTime());

	
		if ((window.document.referrer!="")&&(window.document.referrer!="-")){
			if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){
				m_URL+="&dcsref="+escape(window.document.referrer);
			}
		}
			
		if (m_URL.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){
			m_URL=m_URL.substring(0,2040)+"&WT.tu=1";
		}
			
		if (document.images){
			m_objImages.src=m_URL;         
		}
	}
}

};

}();

/* ------------------------------------ */
/* worldnow reporting intergration code */
/* ------------------------------------ */
 
/* Register this function call with master reporting function
otherwise it will not be called */
Namespace_VideoReporting_Worldnow.registerFunctionName('Namespace_VideoReporting_WebTrends.logVideoEvent_WebTrends');