function buildWebbug(varProtocol, varCVID,varPAPC,varPAGENAME,varIP,varP1,varP2,varP3,varP4,varP5,varP6,varP7,varP8,varP9,varP10,varP11,varP12)
{	
    var strValidChars="0123456789.";
    var blnIsIP_Addr = true;
    var strTempVar;
    var strWebBugURL;
    var strGetURI;
    var strSplitURI;
    var intLastIndex;
    var strUptoLastDot;
    var intNextIndex;
    var strBetweenDots;
    var strBrowserInfo;
    var strAppversion;
    var strOperatingSystem;
    
    strBrowserInfo = navigator.appName + "--";
    
    //determine browser type
    if (strBrowserInfo.indexOf("Microsoft") != -1) 
    {
        strBrowserInfo += navigator.userAgent.match(/MSIE \d+.\d+/);
    } 
    else if (strBrowserInfo.indexOf("Netscape") != -1) 
    {
        strBrowserInfo += navigator.userAgent.match(/Netscape.*/);
    }

    strAppversion = navigator.appVersion;
    strOperatingSystem = strAppversion.substr(strAppversion.lastIndexOf(';') + 1,(strAppversion.indexOf('\)')-1 )- (strAppversion.lastIndexOf(';')));
    strBrowserInfo += "--" + navigator.platform + "--"+strOperatingSystem;
    strBrowserInfo = strBrowserInfo.replace(/ /g,"");
	
    
    strGetURI = window.location.hostname;
    strURL = window.location.href;
    strSplitURI = strGetURI.split("."); 
    intLastIndex = strGetURI.lastIndexOf(".");		
    strUptoLastDot = strGetURI.substring( 0, intLastIndex );	
    intNextIndex = strUptoLastDot.lastIndexOf(".");		
    strBetweenDots = strGetURI.substring( intNextIndex + 1, strGetURI.length );
    strWebBugURL = '';
    
	//check for akamaized pages
	if (!(strGetURI.indexOf('akamai') == -1)) {
		
		if (!(strURL.indexOf('freebizmag') == -1)) {
			strWebBugURL = "img.freebizmag.com/index.wbg?"; 
		} 
		else if (!(strURL.indexOf('businessmagazinenetwork') == -1)) {
			strWebBugURL = "img.businessmagazinenetwork.com/index.wbg?"; 
		} 
		else{
			strWebBugURL = "img.freebizmag.com/index.wbg?"; 
		}
		
	} else {
		
		for(i = 0; i < strGetURI.length && blnIsIP_Addr == true; i++)
		{
			strTempVar = strGetURI.charAt(i);
			
			//check for external IP
			if(strValidChars.indexOf(strTempVar) == -1)
			{
				blnIsIP_Addr=false;
				break;	
			}
		}
	
    
		if (blnIsIP_Addr == true || strGetURI.indexOf("staging")!= -1 || strSplitURI.length < 2)
		{	//internal
			strWebBugURL = "img.int.synapsegroupinc.com/index.wbg?";
		}	
		else //external
		{
			strWebBugURL = "img." + strBetweenDots + "/index.wbg?";
		}
    }
    
    
    //write webbug
    document.write("<img src='" + varProtocol + "://" + strWebBugURL +"||1||" + varCVID + "||" + varPAPC + "||" + varPAGENAME + "||null||" + strBrowserInfo + "||||4||" + varP1 + "||" + varP2 + "||" + varP3 + "||" + varP7 + "||" + varP8 + "||" + varP9 + "||null||" + varIP + "||" + varP4 + "||" + varP5 + "||" + varP6 + "||" + varP10 + "||" + varP11 + "||" + varP12 + "' width=\"1\" height=\"1\">");
}
