/* These variables are used by the web bug include files. */
var webBugURL;
var webBugPage = "index.wbg";

var hostname = window.location.hostname; //Variable to find URI (ex. "mail.yahoo.com")
var hostnameSplit = hostname.split(".");


/* Obtain the web bug URL. */
if ((hostname.indexOf("synapse") != -1) || (hostname.indexOf("staging") != -1) || (hostnameSplit.length < 2) 
	|| (hostname.indexOf("loadtest") != -1)) {
    /* If the hostname has "int" or "staging" in it, or if it is less than two period-separated parts long,
     * this is Dev, QA, Admin, or Staging so use the internal web bug URL.
     */
    webBugURL = "img.int.synapsegroupinc.com";
} else {
    /* This is the Consumer site so obtain the web bug URL based on the Consumer site domain. */
    var indexOfLastDot = hostname.lastIndexOf("."); //find last "." (ex. "." before "com")
    var hostnameUptoLastDot = hostname.substring(0, indexOfLastDot); //grabbing everything before ".com" (ex. "mail.yahoo")
    var indexOfSecondFromLastDot = hostnameUptoLastDot.lastIndexOf(".");  //find second from last "." (ex. "." before "yahoo")
    var domain = hostname.substring(indexOfSecondFromLastDot + 1, hostname.length); //grabbing only "yahoo.com"
    
    if (domain.indexOf("magcustomerservice") != -1) {
    	domain = "mybonuscenter.com";
    }    
    webBugURL = "img." + domain;
}