// Customer : Department of State
// Version : Standard Trigger 2.6
// this script implements the survey strategy. After number of pages visited is equal to or
// greater than 'stickFactor' apply the 'samplePercentage' rule to determine if this visitor
// gets the survey.

function cppUrlPatch(s) {
	var translated = "";
	var i; 
	var found = 0;
	for(i = 0; (found = s.indexOf(':', found)) != -1; ) {
		translated += s.substring(i, found) + "|";
		i = found + 1;
		found++;
	}
	translated += s.substring(i, s.length);
	return translated;
}

// ************* configuration variables - change the values, NOT THE NAMES **************
// parameter array which defines the behavior of the trigger - this must be included
// before the trigger script or if on-exit is  being done, must be included before the 
triggerParms = new Array();
triggerParms["mid"] = "qIF7drmS/bPiMsG1Oci3IA=="; // model instance id
triggerParms["cid"] = "CChU3YECWiXwogqx/bPONg=="; // customer id
triggerParms["lf"] = 3; // loyalty factor
triggerParms["lfcookie"] = "ForeseeLoyalty_MID_CChU3YECWiXw";
triggerParms["ascookie"] = "ForeseeSurveyShown_CChU3YECWiXw";
triggerParms["sp"] = 0.3; // sample percentage
triggerParms["npc"] = 1; // no persistent cookies if 1
//triggerParms["cpp_1"] = "userURL:"+ cppUrlPatch (window.location.protocol+"://" + window.location.host + window.location.pathname); // customer parameter 1 - optional. 
//triggerParms["cpp_2"] = "Browser:"+ cppUrlPatch (navigator.userAgent); // customer parameter 1 - optional. 
triggerParms["pu"] = 0; // pop-under control
triggerParms["rw"] = 129600; // resample wait (value in minutes)
triggerParms["dt"] = 0; // disable trigger if 1
triggerParms["width"] = 450; // used by version 2 standard trigger to resize the survey
triggerParms["height"] = 500; // used by version 2 standard trigger to resize the survey
triggerParms["domain"] = ".state.gov"; // domain attached to resample wait
triggerParms["path"] = "/"; // cookie path
triggerParms["omb"] = "1505-0186"; // omb number
triggerParms["alt_width"] = 580; // used by version 2 standard trigger to resize the ADA Complaint survey
triggerParms["alt_height"] = 500; // used by version 2 standard trigger to resize the ADA Complaint survey

// these values will be set to "normal" values until we have version 2 triggers in production
// at that point, we will reset winOptWidth, winOptHeight, winOptTop, winOptLeft to
// 1, 1, 4000, 4000 respectively.  At that point the width and height above will be passed
// to the survey JSP page which will dynamically generate a JavaScript onLoad handler to 
// resize and translate to visible (for normal survey) or close off-screen (for failover)
triggerParms["winOptWidth"] = 1; // set to 1 for version 2 standard trigger
triggerParms["winOptHeight"] = 1; // set to 1 for version 2 standard trigger
triggerParms["winOptTop"] = 4000; // set to 4000 for version 2 standard trigger
triggerParms["winOptLeft"] = 4000; // set to 4000 for version 2 standard trigger

// if window contains one of these paths in its location while browsing 
// then the survey will not poped up. 
var excludeList = new Array();
excludeList[0] = "/UIS/";//trigger script will not work under this path


