// TeaLeafCfg.js - @version 7.0.0001
if(typeof TeaLeaf == "undefined"){
	var TeaLeaf = {};
	TeaLeaf.tlStartLoad = new Date();

    if(typeof TeaLeaf.Configuration == "undefined"){
	    TeaLeaf.Configuration = {
		    "tlversion" : "2008.3.24.1",
		    "tlSDK" : false
	    };
    }
}

// TeaLeaf.js - @version 7.0.0001
if(TeaLeaf && TeaLeaf.Configuration){
    if( ! Array.prototype.push ) {
	    Array.prototype.stackEnd = 0;
        /**
        * Add push if the browser does not supply
        * them with the Array object (IE6 and earlier)
        * @addon
        */
	    Array.prototype.push = function(obj) {
		    this[this.stackEnd] = obj;
		    this.stackEnd++;
	    }
    }
    if( ! Array.prototype.pop ) {
        /**
        * Add pop if the browser does not supply
        * them with the Array object (IE6 and earlier)
        * @addon
        */
	    Array.prototype.pop = function(obj) {
		    this.stackEnd--;
		    return this[this.stackEnd];
	    }
    }
     
    /**
    * Set TeaLeaf UI Client Event Capture as an SDK. 
    * The default behavior is not set as an SDK 
    * @requires 
    * TeaLeafCfg.js
    * @addon
    */
    TeaLeaf.settlSDK = function(){
        TeaLeaf.Configuration.tlSDK = true;
    }

    /**
    * Reset TeaLeaf UI Client Event Capture not to act as an SDK.
    * The default behavior is not set as an SDK 
    * @requires 
    * TeaLeafCfg.js
    * @addon
    */    
    TeaLeaf.resettlSDK = function(){
        TeaLeaf.Configuration.tlSDK = false;
    }

    /**
    * Array to store all the object that need to be loaded after the page is rendered.
    * NOTE: This will not be used if the UI Client Event Capture is used as an SDK.
    */    
    TeaLeaf.tLoadObjs = new Array();
    /**
    * This function is used for the other javascript files to register their
    * onload functions to be called
    * @param obj object that is registered from other JavaScript to be loaded
    * @param functionName object function that is registered from other JavaScript to be loaded 
    * @requires 
    * TeaLeafCfg.js
    * @addon
    */    
    TeaLeaf.addOnLoad = function(obj, functionName){    
	    if(arguments.length == 1) {	    
		    TeaLeaf.tLoadObjs.push(obj);
	    } else if(arguments.length > 1) {	
			TeaLeaf.tLoadObjs.push(obj[functionName]);
	    }
    }
    /**
    * This function is used to load UI Client Event Caputre or the
    * UI Client Event Capture SDK.
    * @requires 
    * TeaLeafCfg.js
    * @addon
    */    
	TeaLeaf.PageSetup = function() {
	    if(TeaLeaf.Configuration.tlSDK == false ){ 		
	        for(var i=0; i<TeaLeaf.tLoadObjs.length; i++){
                TeaLeaf.tLoadObjs[i]();	    
	        }
	    }
		TeaLeaf.EndLoad = new Date();
	}	
}
if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", TeaLeaf.PageSetup, null); // mozilla
}
else {
	if (typeof(document.readyState) != "undefined") {

		if( typeof document.onreadystatechange == "function" ) {
			TeaLeaf.ReadyStateChange = document.onreadystatechange;
		}
		else {
			TeaLeaf.ReadyStateChange = null;
		}

		document.onreadystatechange = function() {
			if(document.readyState == "complete") {
				TeaLeaf.PageSetup();
			}
			if( TeaLeaf.ReadyStateChange ) {
				TeaLeaf.ReadyStateChange();
			}
		}; // ie
	}
	else {
		if( typeof window.onload == "function" ) {
			TeaLeaf.OnLoad = window.onload;
		}
		else {
			TeaLeaf.OnLoad = null;
		}

		window.onload = function() {
			TeaLeaf.PageSetup();
			if( TeaLeaf.OnLoad ) {
				TeaLeaf.OnLoad();
			}
		}; // other
	}
}
// TeaLeafEventCfg.js - @version 7.0.0001
if(typeof TeaLeaf.Event == "undefined"){
	//	Constructor for the Event
    TeaLeaf.Event = function(type, subtype, source) {    
	    this.date = new Date();
	    if( subtype ) {
		    this.EventType    = type;
		    this.EventSubType = subtype;
		    if( source ) {
			    this.EventSource = source;
		    }
		    else{
		        //default is empty string
		        this.EventSource ="";
		    }
	    }
	    else {
		    this.EventType    = "CUSTOM";
		    this.EventSubType = type;
	    }
    }
    
   if(typeof TeaLeaf.Event.Configuration == "undefined"){  
        TeaLeaf.Event.Configuration = {
            "tlqueueevents"             : true,
            "tlqueueeventstimer"        : 30000,
            "tlqueueeventsmaxsz"        : 8192,
            "tlshowexceptions"          : false,
            "tlurl"                     : "/pubspec/scripts/tealeafTarget.asp",
            "tlsecureurl"               : "/pubspec/scripts/tealeafTarget.asp",
            "tlpageidcookie"            : "TLTHID",
            "tleventcount"              : 0, 
            "tlpageid"                  : "", 
            "tlinitflag"                : false,
            "tlbeforeunloadflag"        : false,
            "tlusetopqueue"             : false,
            "tllastdwelltime"           : "",
            "tlidoflastvisitedcontrol"  : "",
            "tleventunloadflag"         : true,
            "tleventbeforeunloadflag"   : true,

            tlResolution:[
                {"width": 799,       "height": 599,     "type": 0,  "displayText": "small"},
                {"width": 800,       "height": 600,     "type": 1,  "displayText": "800x600"},
                {"width": 1024,      "height": 768,     "type": 2,  "displayText": "1024x760"},
                {"width": 1280,      "height": 1024,    "type": 3,  "displayText": "1280x1024"},
                {"width": 1000000,   "height": 1000000, "type": 4,  "displayText": "large"}
            ],		             
            //This is the list of HTTP headers that are static and are
		    tlHTTPRequestHeadersSet:[
		        {"tlreqhttpheadername": "Content-Type",                     "tlsethttpheader": true,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetContentType()"},
			    {"tlreqhttpheadername": "X-TeaLeaf",                        "tlsethttpheader": true,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetTeaLeafXEvent()"},
			    {"tlreqhttpheadername": "X-TeaLeafType",                    "tlsethttpheader": true,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlEventType()"},
			    {"tlreqhttpheadername": "X-TeaLeafSubType",                 "tlsethttpheader": true,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlEventSubType()"},
			    {"tlreqhttpheadername": "X-TeaLeaf-Page-Url",               "tlsethttpheader": true,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetUrlPath()"},
                {"tlreqhttpheadername": "X-TeaLeaf-UIEventCapture-Version", "tlsethttpheader": true,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetJSVersion()"}
		    ],   
		    //This is the list of HTTP headers that have the eval value at the time of POST
		    tlHTTPRequestHeadersEvalInit:[
			    {"tlreqhttpheadername": "X-TeaLeaf-Screen-Res",         "tlsethttpheader": false,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlResolutionType(screen.width ,screen.height)"},
			    {"tlreqhttpheadername": "X-TeaLeaf-Browser-Res",        "tlsethttpheader": false,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlResolutionTypeBrowser()"},
			    {"tlreqhttpheadername": "X-TeaLeaf-Page-Render",        "tlsethttpheader": true,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetRenderTime()"},
			    {"tlreqhttpheadername": "X-TeaLeaf-Page-Objects",       "tlsethttpheader": false,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetElementCount(\"object\")"},
			    {"tlreqhttpheadername": "X-TeaLeaf-Page-Img-Fail",      "tlsethttpheader": false,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlBadImageCount()"}
		    ],  
		    tlHTTPRequestHeadersEvalBeforeUnload:[
			    {"tlreqhttpheadername": "X-TeaLeaf-Page-Cui-Events",    "tlsethttpheader": false,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetEventCount()"},
			    {"tlreqhttpheadername": "X-TeaLeaf-Page-Cui-Bytes",     "tlsethttpheader": false,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetSendStringBytes(sendStr)"},
			    {"tlreqhttpheadername": "X-TeaLeaf-Page-Dwell",         "tlsethttpheader": false,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetDwellTime()"},
			    {"tlreqhttpheadername": "X-TeaLeaf-Page-Last-Field",   "tlsethttpheader": false,    "tlreqhttpheadervalue": "TeaLeaf.Event.tlGetLastVisitedElementID()"}   
		    ]   
        };  
    }   
}
// TeaLeafEvent.js - @version 7.0.0001
if(TeaLeaf.Event && TeaLeaf.Event.Configuration){
	try{
	    if(!TeaLeaf_PageID){
			TeaLeaf_PageID = null;
		}
	}
	catch(e){
		TeaLeaf_PageID = null;
	}
    
    TeaLeaf.Event.tlQueuedXML = "";
    /**
    * Get TeaLeaf UI Client Event content type that 
    * is sent in the HTTP headers of the TeaLeaf AJAX POST
    * that delivers the XML with the UI Cient Events to the 
    * capture device. 
    * @addon
    */
    TeaLeaf.Event.tlGetContentType = function(){
        var contentType = "text/xml";
        return contentType;
    }
    /**
    * Get TeaLeaf UI Client Event XEvent that 
    * is sent in the HTTP headers of the TeaLeaf AJAX POST
    * that delivers the XML with the UI Cient Events to the 
    * capture device. 
    * @addon
    */
    TeaLeaf.Event.tlGetTeaLeafXEvent = function(){
        var teaLeafXEvent = "ClientEvent";
        return teaLeafXEvent;
    }
    /**
    * Get TeaLeaf UI Client Event type set during
    * TeaLeaf event definition.
    * @addon
    */    
    TeaLeaf.Event.tlEventType = function(){
        return TeaLeaf.Event.SetType;
    }
    /**
    * Get TeaLeaf UI Client Event sub type set during
    * TeaLeaf event definition.
    * @addon
    */        
    TeaLeaf.Event.tlEventSubType = function(){
        return TeaLeaf.Event.SetSubType;
    }
    /**
    * Get the path relative to the host.
    * @addon
    */            
    TeaLeaf.Event.tlGetUrlPath = function(){
		var strpath;
		if(typeof(s_exp) != 'undefined'){
			strpath = s_exp.pageName;
		}
		else if(typeof(s_pageName) != 'undefined'){
			strpath = s_pageName;
		}
        else{
			strpath = window.location.pathname;	
		}
        return strpath;
    }
    /**
    * Get TeaLeaf UI Client Event version that 
    * is sent in the HTTP headers of the TeaLeaf AJAX POST
    * that delivers the XML with the UI Cient Events to the 
    * capture device. 
    * @requires 
    * TeaLeafEventCfg.js
    * @addon
    */
    TeaLeaf.Event.tlGetJSVersion = function(){
        return TeaLeaf.Configuration.tlversion;
    }
    /**
    * Get the resolution type (0-4) based on the resolution defined in 
    * the configuration file. 
    * @param width 
    * @param height 
    * @requires 
    * TeaLeafEventCfg.js
    * @addon
    */
    TeaLeaf.Event.tlResolutionType = function(width, height){ 
        var res = TeaLeaf.Event.Configuration.tlResolution;
        for(var i=0; i<res.length; i++)
        {
            if(width <= res[i].width || height <= res[i].height)
            {
                return res[i].type;
            }
        }
        return res[length-1].type;        
    }
    /**
    * Get the browser resolution type. 
    * @requires 
    * TeaLeafEventCfg.js
    * @addon
    */
    TeaLeaf.Event.tlResolutionTypeBrowser = function(){
        var winWidth = 0;
        var winHeight = 0;  
        if(window.innerWidth){
            winWidth = window.innerWidth;
            winHeight = window.innerHeight;
        }
        else if(document.documentElement && document.documentElement.clientWidth){   
            winWidth = document.documentElement.clientWidth;
            winHeight = document.documentElement.clientHeight;
        }
        else if(document.body && document.body.clientWidth){
            winWidth = document.body.clientWidth;
            winHeight = document.body.clientHeight;
        }
        else{
            var elems = document.getElementsByTagName("body"); 
            if(elems.length > 0){
                winWidth = elems[0].clientWidth;
                winHeight = elems[0].clientHeight;
            }
        }                
        var retType = TeaLeaf.Event.tlResolutionType(winWidth, winHeight);  
        return retType;
    }
    /**
    * Get the page render time. 
    * @requires
    * TeaLeaf.js
    * TeaLeafCfg.js 
    * TeaLeafEventCfg.js
    * @addon
    */    
    TeaLeaf.Event.tlGetRenderTime = function(){
        return TeaLeaf.Event.PageLoadMilliSecs;
    }
    /**
    * Get element count. 
    * @param element DOM element name 
    * @addon
    */        
    TeaLeaf.Event.tlGetElementCount = function(element){
        return document.getElementsByName(element).length;		   	
    }
    /**
    * Get count of broaken images. 
    * @addon
    */            
    TeaLeaf.Event.tlBadImageCount = function() {
		var	cnt = 0;
		var ind;
		for(ind = 0; ind < document.images.length; ind++) {
			var	img = document.images[ind];
			//	IE correctly identifies any images that weren't downloaded as
			//	not complete. Others should too. Gecko-based browsers act
			//	like NS4 in that they report this incorrectly.
    		if (!img.complete) {
        		cnt++;
				continue;
    		}
    		// However, they do have two very useful properties: naturalWidth and
    		// naturalHeight. These give the true size of the image. If it failed
    		// to load, either of these should be zero.
    		if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) {
        		cnt++;
    		}
    	}
    	return cnt;
	}	
    /**
    * Get TeaLeaf current event count. 
    * @addon
    */            	
	TeaLeaf.Event.tlGetEventCount = function(){
        return TeaLeaf.Event.Configuration.tleventcount;		   	
    }
    /**
    * Get sent sting length. 
    * @param sendStr get lenght of sendStr
    * @addon
    */            	
    TeaLeaf.Event.tlGetSendStringBytes = function(sendStr){
        return sendStr.length;		   	
    }
    /**
    * Get user dwell time on a page.
    * @requires
    * TeaLeaf.js
    * TeaLeafCfg.js 
    * TeaLeafEventCfg.js 
    * @addon
    */            	
    TeaLeaf.Event.tlGetDwellTime = function(){
        return TeaLeaf.Event.tlDateDiff(TeaLeaf.tlStartLoad, TeaLeaf.Event.Configuration.tllastdwelltime);
    }
    /**
    * Get the ID of the last visited DOM element that we have listeners attached.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	    
    TeaLeaf.Event.tlGetLastVisitedElementID = function(){
        return TeaLeaf.Event.Configuration.tlidoflastvisitedcontrol;
    }
    /**
    * Get the date difference between two values.
    * @param v1 first time value 
    * @param v2 second time value 
    * @addon
    */            	        
    TeaLeaf.Event.tlDateDiff = function(v1, v2) {
		return Math.abs(v1-v2);
	}
    /**
    * Re-format the XML.
    * @param Str containing XML to be re-formated 
    * @addon
    */            	        
    TeaLeaf.Event.tlFormatXML = function(Str) {
        if (Str) {
			if( Str.replace ) {
            	return Str.replace(/&/g, "&amp;").replace(/\"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
			}
			return Str;
		}
        return "";
    }
    /**
    * Get cookie value.
    * @param name cookie name 
    * @addon
    */            	            
    TeaLeaf.Event.tlGetCookie = function(name){
	    var dc = document.cookie;
	    var prefix = name + "=";
	    var begin = dc.indexOf("; " + prefix);
	    if (begin == -1) {
		    begin = dc.indexOf(prefix);
		    if (begin != 0) {
			    return "";
		    }
	    }
	    else {
		    begin += 2;
	    }
	    var end = document.cookie.indexOf(";", begin);
	    if (end == -1) {
		    end = dc.length;
	    }
	    return unescape(dc.substring(begin + prefix.length, end));
    }  
    /**
    * Set HTTP headers.
    * @param tlreq XMLHTTPRequest object 
    * @param tlheaderconfig JSON array with the HTTP header field values. 
    * @requires
    * TeaLeaf.js
    * TeaLeafCfg.js 
    * TeaLeafEventCfg.js 
    * @addon
    */            	
    TeaLeaf.Event.tlSetHTTPHeaders = function(tlreq, tlheaderconfig){    
        for(var i=0; i<tlheaderconfig.length; i++) {
		    if(tlheaderconfig[i].tlsethttpheader == true){
			    tlreq.setRequestHeader(tlheaderconfig[i].tlreqhttpheadername, eval(tlheaderconfig[i].tlreqhttpheadervalue));
			}
        }
    }
    /**
    * Get TeaLeaf page id.
    * @requires
    * TeaLeaf.js
    * TeaLeafCfg.js 
    * TeaLeafEventCfg.js 
    * @addon
    */            	    
    TeaLeaf.Event.tlGetPageId = function(){
	    //	Have we already calculated this?
	    if(TeaLeaf.Event.Configuration.tlpageid) {
		    return TeaLeaf.Event.Configuration.tlpageid;
	    }
	    //	Calculate the page id.  First see if there is a
	    //	cookie value to be used.  If that value is there,
	    //	then we will use it
	    if( TeaLeaf.Event.Configuration.tlpageidcookie ) {
		    TeaLeaf.Event.Configuration.tlpageid = TeaLeaf.Event.tlGetCookie(TeaLeaf.Event.Configuration.tlpageidcookie);
		    if(TeaLeaf.Event.Configuration.tlpageid) {
			    return TeaLeaf.Event.Configuration.tlpageid;
		    }
	    }
	    //	No cookie.  Look for the page id variable that will be
	    //	set by javascript outside of TeaLeaf.js
	    if( TeaLeaf_PageID ) {
			TeaLeaf.Event.Configuration.tlpageid = TeaLeaf_PageID;
			return TeaLeaf.Event.Configuration.tlpageid;
	    }
    
	    //	Neither of the above options, go ahead and generate the
	    //	page id from a time stamp.
	    TeaLeaf.Event.Configuration.tlpageid = "ID" + TeaLeaf.tlStartLoad.getHours() + "H" +
		    			TeaLeaf.tlStartLoad.getMinutes() + "M" +
			    		TeaLeaf.tlStartLoad.getSeconds() + "S" +
				    	TeaLeaf.tlStartLoad.getMilliseconds();
	    return TeaLeaf.Event.Configuration.tlpageid;
    }
    /**
    * Send failure message.
    * @param url url 
    * @param failedUrl url where failure occured 
    * @param message failure message 
    * @requires
    * TeaLeaf.js
    * TeaLeafCfg.js 
    * TeaLeafEventCfg.js 
    * @addon
    */            	    
    TeaLeaf.Event.tlSendFailure = function(url, failedUrl, message){
	    var tlnow = new Date();
	    var	t1970 = Date.UTC(tlnow.getUTCFullYear(),tlnow.getUTCMonth(),tlnow.getUTCDate(), tlnow.getUTCHours(),tlnow.getUTCMinutes(),tlnow.getUTCSeconds(), tlnow.getUTCMilliseconds());
    
	    var tltimeDur;
	    if( TeaLeaf.tlStartLoad ) {
		    tltimeDur = TeaLeaf.Event.tlDateDiff(tlnow, TeaLeaf.tlStartLoad);
	    }

	    TeaLeaf.Event.Configuration.tleventcount++;
	    tlsendStr = "<ClientEvent count=\"" + TeaLeaf.Event.Configuration.tleventcount +
	    		  "\" Type=\"INFO\" SubType=\"EXCEPTION\" " +
		    	  "PageId=\""        + TeaLeaf.Event.tlGetPageId()+ "\" " +
			      "FailedUrl=\""     + TeaLeaf.Event.tlFormatXML(failedUrl) + "\" " +
			      "Message=\""       + TeaLeaf.Event.tlFormatXML(message)   + "\" " +
			      "TimeDuration=\""  + tltimeDur + "\" " +
			      "DateSince1970=\"" + t1970 + "\" />\r\n";

	    //	Send the request
	    try {
	        var tlExceptionEvent = new TeaLeaf.Event("INFO", "EXCEPTION");
		    tlExceptionEvent.tlSendXML(tlsendStr, true);
	    }   
	    catch(exc) {
	        if( TeaLeaf.Event.Configuration.tlshowexceptions ) {
			    alert(exc.name + ": " + exc.message + "\r\n\r\nPos 4");
			}
	    }
    }   
    /**
    * Create the XMLHTTPRequest transport object.
    * @addon
    */            	                      
    TeaLeaf.Event.tlGetTransport = function(){
	    var	tlreq;
	    if(window.XMLHttpRequest) {
		    try {
			    tlreq = new XMLHttpRequest();
		    }
		    catch(e) {
			    tlreq = null;
		    }
	    }
	    else if(window.ActiveXObject) {
		    try {
			    tlreq = new ActiveXObject("Msxml2.XMLHTTP");
		    }
		    catch(e) {
			    try {
			    	tlreq = new ActiveXObject("Microsoft.XMLHTTP");
			    }
			    catch(e) {
				    tlreq = null;
			    }
		    }
	    }
	    return tlreq;
    }

    TeaLeaf.Event.TransportArray = new Array();
    
    /**
    * Get the XMLHTTPRequest transport object from the Transport Array if not create one.
    * @addon
    */            	                      
    TeaLeaf.Event.tlXMLHTTPObj = function(){   
 	    var i = 0;
	    for(; i < TeaLeaf.Event.TransportArray.length; i++) {
    		if( TeaLeaf.Event.TransportArray[i] && TeaLeaf.Event.TransportArray[i].readyState > 0 ) {
			    if( TeaLeaf.Event.TransportArray[i].readyState == 4 ) {
    				TeaLeaf.Event.TransportArray[i].abort();
    				TeaLeaf.Event.TransportArray[i].onreadystatechange = new function() {};
				    return TeaLeaf.Event.TransportArray[i];
			    }
		    }
		    else {
    			TeaLeaf.Event.TransportArray[i] = TeaLeaf.Event.tlGetTransport();
    			return TeaLeaf.Event.TransportArray[i];
		    }
	    }
	    //	Nope, we need another
    	TeaLeaf.Event.TransportArray[i] = TeaLeaf.Event.tlGetTransport();
    	return TeaLeaf.Event.TransportArray[i];
    }  
    /**
    * Clean the XMLHTTPRequest Transport Array.
    * @addon
    */            	                          
    TeaLeaf.Event.tlCleanXMLHTTPObj = function(obj){
	    //	Zap this one!
	    var i = 0;
	    for(; i < TeaLeaf.Event.TransportArray.length; i++) {
		    if( obj == TeaLeaf.Event.TransportArray[i] ) {
    			TeaLeaf.Event.TransportArray[i] = null;
		    }
	    }   
    }
    /**
    * Add event handler.
    * @param tlitem element that we attach a listener
    * @param tlevt event that we listen for
    * @param tlhandler event handler
    * @addon
    */            	                              
    TeaLeaf.Event.tlAddHandler = function(tlitem, tlevt, tlhandler, tlcapture) {		
		try {
			if( tlitem.addEventListener ) {
				tlitem.addEventListener(tlevt, tlhandler, tlcapture);
			}
			else if( tlitem.attachEvent ) {
				tlitem.attachEvent('on'+tlevt, tlhandler);
			}
		}
		catch(exc) {
			if( TeaLeaf.Event.Configuration.tlshowexceptions ) {
				alert(exc.name + ": " + exc.message + "\r\n\r\nPos 4");
			}
		}
	}	
    /**
    * Remove event handler.
    * @param tlitem element that we attached a listener
    * @param tlevt event that we listened
    * @param tlhandler event handler
    * @addon
    */            	                              
	TeaLeaf.Event.tlRemoveHandler = function(tlitem, tlevt, tlhandler, tlcapture) {
		try {
			if( tlitem.removeEventListener ) {
				tlitem.removeEventListener(tlevt, tlhandler, tlcapture);
			}
			else if( tlitem.detachEvent ) {
				tlitem.detachEvent('on'+tlevt, tlhandler);
			}
		}
		catch(exc) {
			if( TeaLeaf.Event.Configuration.tlshowexceptions ) {
				alert(exc.name + ": " + exc.message + "\r\n\r\nPos 5");
			}
		}
	}
    /**
    * Flush the event queue.
    * @param force forces the flush if true
    * @requires
    * TeaLeaf.js
    * TeaLeafCfg.js 
    * TeaLeafEventCfg.js 
    * @addon
    */            	                              
	TeaLeaf.Event.tlFlushQueue = function(force) {
		var	dataToSend = null;
		var	queueTime = TeaLeaf.Event.Configuration.tlqueueeventstimer;
		var maxTime = queueTime * 3;
		//	Nothing to send
		if(TeaLeaf.Event.Configuration.tlusetopqueue) {
			var now = new Date();
			var diff = (now - top.TeaLeaf.Event.TimeSent);		
			//	If we have queued data, let's send it if appropriate
			if( top.TeaLeaf.Event.tlQueuedXML ) {
				if( force || diff >= queueTime ) {
					dataToSend = top.TeaLeaf.Event.tlQueuedXML;
					top.TeaLeaf.Event.tlQueuedXML = "";
					top.TeaLeaf.Event.TimeSent = now;
				}
			}
			//	Nothing to send
			if( ! dataToSend ) {
				if( ! force && diff < (queueTime / 2) ) {
					//	A little heuristics here--If the time is less than
					//	1/2 the standard time, then assume another frame
					//	is handling the send.  Slow down the transmission
					//	time for this frame.
					
					// we need to do this so we do not end up waiting infinately.
					if(queueTime >= maxTime){
					    queueTime = maxTime;
					}
					else{
					    queueTime = (queueTime * 3) / 2;
					}
				}
				return queueTime;
			}
		}
		else {
			if( ! TeaLeaf.Event.tlQueuedXML ) {
				return queueTime;
			}
			dataToSend = TeaLeaf.Event.tlQueuedXML;
			TeaLeaf.Event.tlQueuedXML = "";
		}
		
		//	Get the Event
		var evt = new TeaLeaf.Event("GUI", "QUEUED");
		evt.tlSendXML(dataToSend);
		return queueTime;

    }
    /**
    * Push XML on the stack.
    * @param tag tag name
    * @addon
    */            	                              
    TeaLeaf.Event.prototype.tlPushXML = function(tag){
	    if( ! this.XMLStack ) {
		    this.XMLStack = new Array();
    	}
	    
	    var strTag = "  <" + tag;
	    if(this.XMLData){
	        this.XMLData += strTag;
	    }
	    else{
	        this.XMLData = strTag;
	    }
    }    
    /**
    * Pop XML from the stack.
    * @param tag tag name
    * @addon
    */            	                              
    TeaLeaf.Event.prototype.tlPopXML = function(){
        if(this.XMLData){
	        this.XMLData += " />\r\n";
	    }
	    else{
            return false;
	    }
    }   
    /**
    * Add data tot he XML stack.
    * @param name0 name of the XML attribute.
    * @param value0 value of the XML attribute.
    * @addon
    */            	                              
    TeaLeaf.Event.prototype.tlAddData = function(nameValueArray){
	    var	ind;
	    var offset = "";
	    if( this.XMLStack ) {
		    for(ind = 0; ind < this.XMLStack.length; ind++) {
			    offset += "  ";
		    }		    
	    }	    
	    for(ind = 1; ind < nameValueArray.length; ind += 2){
	        var name = nameValueArray[ind-1];
		    var tlValue = TeaLeaf.Event.tlFormatXML(nameValueArray[ind]);
		    if( name &&  tlValue ) {
		        var strXMLData = offset + " " + name + "=" +"\""+tlValue+"\"";
		        if(this.XMLData){
			        this.XMLData += strXMLData;
			    }
			    else{
			        this.XMLData = strXMLData;
			    }
		    }
	    }
	    delete nameValueArray;
    }   
    /**
    * Send the XML with the UI Client Events including the HTTP headers if set.
    * @param tlsendStr XML message
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                              
    TeaLeaf.Event.prototype.tlSendXML = function(tlsendStr, tlignoresendfailure){
	    // Get an the request object
	    var tlreq = TeaLeaf.Event.tlXMLHTTPObj();
	    if( ! tlreq ) {
		    return;
	    }
	    //	Send the request
	    try {
		    var	tlurl = this.theUrl;
		    tlreq.onreadystatechange = function(code) {
			    if( tlreq.readyState == 4 ) {
				    //	The try/catch is to catch a netscape bug
				    //	https://bugzilla.mozilla.org/show_bug.cgi?id=238559#c0
				    //	Thanks to JS for the help
				    try {
					    if( tlreq.status != 200 && tlreq.status != 304 ) {
						    TeaLeaf.Event.tlSendFailure(tlurl, tlurl, "Status " + tlreq.status + ": " + tlreq.statusText);
					    }
			    	}
				    catch(e) {
				    }
			    }
		    }

		    tlreq.open("POST", tlurl, false);
			TeaLeaf.Event.tlSetHTTPHeaders(tlreq, TeaLeaf.Event.Configuration.tlHTTPRequestHeadersSet);

           //Set the TeaLeaf HTTP Header Values		
           if( TeaLeaf.Event.Configuration.tlinitflag == true ){           
                TeaLeaf.Event.tlSetHTTPHeaders(tlreq, TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalInit);
           }
           if( TeaLeaf.Event.Configuration.tlbeforeunloadflag == true ){
                TeaLeaf.Event.tlSetHTTPHeaders(tlreq, TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalBeforeUnload);
           }  
    	   

tlreq.send(tlsendStr);


	    }
	    catch(exc) {
		    if( TeaLeaf.Event.Configuration.tlshowexceptions ) {
			    if( exc.name ) {
				    alert(exc.name + ": " + exc.message + "\r\n\r\nURL: " + this.theUrl + "\r\n\r\nPos 3 ");
			    }
			    else {
				    alert(exc + "\r\n\r\nURL: " + this.theUrl + "\r\n\r\nPos 3 ");
			    }
		    }
		    
		    if(tlignoresendfailure == true){
		        TeaLeaf.Event.tlSendFailure(this.theUrl, this.theUrl, exc);
		    }
		    TeaLeaf.Event.tlCleanXMLHTTPObj(tlreq);
	    }
    }
    /**
    * Depending on the configuration settings send the XML or queue the XML message.
    * @requires
    * TeaLeaf.js
    * TeaLeafCfg.js
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                  
    TeaLeaf.Event.prototype.tlSend = function(bRoot){
	    //	Pop everything on the queue
	    if( this.XMLStack ) {
		    while( this.XMLStack.length > 0 ) {
			    this.tlPopXML()
		    }
	    }
	    var	t1970 = Date.UTC(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate(), 
	                    this.date.getUTCHours(),this.date.getUTCMinutes(),this.date.getUTCSeconds(), this.date.getUTCMilliseconds());
	    var timeDur;
	    if( TeaLeaf.tlStartLoad ) {
		    timeDur = TeaLeaf.Event.tlDateDiff(this.date, TeaLeaf.tlStartLoad);
	    }

	    TeaLeaf.Event.Configuration.tleventcount++;
	    sendStr = "<ClientEvent count=\"" + TeaLeaf.Event.Configuration.tleventcount +
			  "\" Type=\"" + this.EventType + "\" SubType=\"" + this.EventSubType+"\"";
	    if( this.EventSource ) {
		    sendStr = sendStr + "\" Source=\"" + this.EventSource;
	    }
	    if(bRoot){
	        sendStr = sendStr + 
		    	    " PageId=\""        + TeaLeaf.Event.tlGetPageId() +"\""+
			        " TimeDuration=\""  + timeDur + "\""+
			        " DateSince1970=\"" + t1970 +
			        "\" >\r\n" +
			        this.XMLData +
			        "</ClientEvent>\r\n";
	    }
	    else{
	        sendStr = sendStr + 
		    	    " PageId=\""        + TeaLeaf.Event.tlGetPageId() +"\""+
			        this.XMLData        +
			        " TimeDuration=\""  + timeDur + "\""+
			        " DateSince1970=\"" + t1970 +
			        "\" />\r\n";
	    }
	    //	Queue the event
	    if( TeaLeaf.Event.Configuration.tlqueueevents ) {
			if( TeaLeaf.Event.Configuration.tlusetopqueue ) {
				if( top.TeaLeaf.Event.tlQueuedXML ) {
					top.TeaLeaf.Event.tlQueuedXML += sendStr;
				}
				else {
					top.TeaLeaf.Event.tlQueuedXML = sendStr;
				}
			}
			else {
				if( TeaLeaf.Event.tlQueuedXML ) {
					TeaLeaf.Event.tlQueuedXML += sendStr;	
				}
				else {
					TeaLeaf.Event.tlQueuedXML = sendStr;
				}
			}
			//	Check the size of the XML.  IF it is getting too
			//	big, send it
			if( TeaLeaf.Event.Configuration.tlqueueeventsmaxsz < TeaLeaf.Event.tlQueuedXML.length ) {	    	
	    		TeaLeaf.Event.tlFlushQueue();
			}
			return;
	    }
	    //	Send the request
	    try {
		    this.tlSendXML(sendStr);
		    this.XMLData = "";
	    }
    	catch(exp) {
	    }
	    this.XMLData = "";
    }
    /**
    * Enable HTTP Headers defined in the TeaLeafEventCfg.js.
    * @param obj determines what set of HTTP headers to be set. 
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                   
    TeaLeaf.Event.tlEnableAllHTTPHeaders = function(obj) {         
        if(obj){
            if(obj == "info"){
                TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersSet, true, "all");            
            }
            else if(obj == "init"){
                TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalInit, true, "all");
            }
            else if(obj == "beforeunload"){
                TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalBeforeUnload, true, "all");
            } 
        } 
        else{
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersSet, true, "all");            
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalInit, true, "all");
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalBeforeUnload, true, "all");        
        }        
    }
    /**
    * Enable HTTP Headers defined in the TeaLeafEventCfg.js.
    * @param obj determines what set of HTTP headers to be set. 
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                   
    TeaLeaf.Event.tlEnableHTTPHeader = function(obj, headerName) { 
        if(obj == "info"){
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersSet, true, headerName);            
        }
        else if(obj == "init"){
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalInit, true, headerName);
        }
        else if(obj == "beforeunload"){
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalBeforeUnload, true, headerName);
        } 
    }
    /**
    * Disable HTTP Headers defined in the TeaLeafEventCfg.js.
    * @param obj determines what set of HTTP headers to be set. 
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                   
    TeaLeaf.Event.tlDisableAllHTTPHeaders = function(obj) {         
        if(obj){
            if(obj == "info"){
                TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersSet, false, "all");            
            }
            else if(obj == "init"){
                TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalInit, false, "all");
            }
            else if(obj == "beforeunload"){
                TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalBeforeUnload, false, "all");
            } 
        } 
        else{
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersSet, false, "all");            
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalInit, false, "all");
            TeaLeaf.Event.tlEventJSONCfgUtil(TeaLeaf.Event.Configuration.tlHTTPRequestHeadersEvalBeforeUnload, false, "all");        
        }        
    }    
    /**
    * Enable queuing of events.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                   
    TeaLeaf.Event.tlEnableQueueEvents = function() { 
        TeaLeaf.Event.Configuration.tlqueueevents = true; 
    }  
    /**
    * Disable queuing of events.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                   
    TeaLeaf.Event.tlDisableQueueEvents = function() { 
        TeaLeaf.Event.Configuration.tlqueueevents = false; 
    }   
    /**
    * Enable showing of exception in an alert message.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                   
    TeaLeaf.Event.tlEnableShowExceptions = function() { 
        TeaLeaf.Event.Configuration.tlshowexceptions = true; 
    }
    /**
    * Disable showing of exception in an alert message.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlDisableShowExceptions = function() { 
        TeaLeaf.Event.Configuration.tlshowexceptions = false; 
    } 
    /**
    * Set queue event flush time.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlSetQueueEventTime = function(tlvalue) { 
    
        TeaLeaf.Event.Configuration.tlqueueeventstimer = tlvalue; 
    }  
    /**
    * Get queue event flush time.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlGetQueueEventTime = function() { 
        return TeaLeaf.Event.Configuration.tlqueueeventstimer; 
    }
    /**
    * Set queue event maximum size.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlSetQueueEventMaxSize = function(tlvalue) { 
        TeaLeaf.Event.Configuration.tlqueueeventsmaxsz = tlvalue; 
    }    
    /**
    * Get queue event maximum size.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlGetQueueEventMaxSize = function() { 
        return TeaLeaf.Event.Configuration.tlqueueeventsmaxsz; 
    } 
    /**
    * Set the url where TeaLeaf posts.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlSetPostURL = function(tlvalue) { 
        TeaLeaf.Event.Configuration.tlurl = tlvalue; 
    }
    /**
    * Get the url where TeaLeaf posts.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlGetPostURL = function() { 
        return TeaLeaf.Event.Configuration.tlurl; 
    }  
    /**
    * Set page id cookie value.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlSetPageIDCookie = function(tlvalue) { 
        TeaLeaf.Event.Configuration.tlpageidcookie = tlvalue; 
    }
    /**
    * Get page id cookie value.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlGetPageIDCookie = function(tlvalue) { 
        return TeaLeaf.Event.Configuration.tlpageidcookie; 
    }   
    /**
    * JSON configuration utility allowing to enable/disable certain DOM events
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
    TeaLeaf.Event.tlEventJSONCfgUtil = function(tlJSONConfig, tlEnable, domEventName) {         
        for(var i = 0; i<tlJSONConfig.length; i++){
            if(domEventName == "all"){
                tlJSONConfig[i].load = tlEnable;
            }
            else if (domEventName == tlJSONConfig[i].domevent){
                tlJSONConfig[i].load = tlEnable;
            }
        }  
    }  
    /**
    * Error handler.
    * @param message error 
    * @param url url
    * @param line line where error occured
    * @requires   
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
	TeaLeaf.Event.tlErrorHandler = function(message, url, line) {	
		var	now = new Date();
		if( ! line ) {
			line = "unknown";
		}
		var	tlevt = new TeaLeaf.Event("INFO", "EXCEPTION");
		var tlAddNameValueArray = new Array("Message", message, 
			                                "URL", escape(url), 
			                                "Line", line);
        tlevt.tlAddData(tlAddNameValueArray);
		tlevt.tlSend();
		TeaLeaf.Event.tlFlushQueue();
		return false;
	}
	/**
    * Handle the before unload event and flush the queue of events.
    *
    * @requires 
    * TeaLeafEventCfg.js
    * @addon
    */            	                                                                			
	TeaLeaf.Event.tlBeforeUnload = function(){
	    if(TeaLeaf.Event.Configuration.tleventbeforeunloadflag == true){ 
            TeaLeaf.Event.Configuration.tleventunloadflag = false;   
		    //	Send in the notice
		    var	tlevt = new TeaLeaf.Event("PERFORMANCE", "BeforeUnload");	
		    TeaLeaf.Event.SetType = tlevt.EventType;

		    if(TeaLeaf.Event.SetSubType == ""){
                TeaLeaf.Event.SetSubType = tlevt.EventSubType;
            }
            else{
                TeaLeaf.Event.SetSubType += "; " + tlevt.EventSubType;
            }                    
            TeaLeaf.Event.Configuration.tlbeforeunloadflag = true;
 		    tlevt.tlSend();
	
		    TeaLeaf.Event.tlFlushQueue(true);
		}	
        TeaLeaf.Event.tlRemoveHandler(window, "beforeunload", eval(TeaLeaf.Event.tlBeforeUnload), false);
        TeaLeaf.Event.tlRemoveHandler(window, "unload", eval(TeaLeaf.Event.tlUnload), false);
	}

	/**
    * Handle the unload event and flush the queue of events.
    *
    * @requires 
    * TeaLeafEventCfg.js
    * @addon
    */            	                                                                				
	TeaLeaf.Event.tlUnload = function(){
        if(TeaLeaf.Event.Configuration.tleventunloadflag ){         
            TeaLeaf.Event.Configuration.tllastdwelltime = new Date();
            TeaLeaf.Event.Configuration.tleventbeforeunloadflag = false;

		    //	Send in the notice
		    var	tlevt = new TeaLeaf.Event("PERFORMANCE", "Unload");
		    TeaLeaf.Event.SetType = tlevt.EventType;
		    
		    if(TeaLeaf.Event.SetSubType == ""){
                TeaLeaf.Event.SetSubType = tlevt.EventSubType;
            }
            else{
                TeaLeaf.Event.SetSubType += "; " + tlevt.EventSubType;
            }
		    tlevt.tlSend();
		    TeaLeaf.Event.tlFlushQueue(true);
        }  
        TeaLeaf.Event.tlRemoveHandler(window, "beforeunload", eval(TeaLeaf.Event.tlBeforeUnload), false);
        TeaLeaf.Event.tlRemoveHandler(window, "unload", eval(TeaLeaf.Event.tlUnload), false);
	}

    /**
    * Event setup.
    * @requires
    * TeaLeafEventCfg.js 
    * @addon
    */            	                                       
	TeaLeaf.Event.EventSetup = function() {
        //Handle Errors
        TeaLeaf.Event.tlAddHandler(window, "error", TeaLeaf.Event.tlErrorHandler, false);                
        if(!TeaLeaf.Client){
            TeaLeaf.Event.tlAddHandler(window, "beforeunload", eval(TeaLeaf.Event.tlBeforeUnload), false);
            TeaLeaf.Event.tlAddHandler(window, "unload", eval(TeaLeaf.Event.tlUnload), false);
        }

		//	If we are queueing events, set up the timer
		if( TeaLeaf.Event.Configuration.tlqueueevents ) {
			TeaLeaf.Event.tlTimerRoutine = function() {
				//	Amount of time until the next timeout
				var	timeAmount = TeaLeaf.Event.Configuration.tlqueueeventstimer;
				try {
					timeAmount = TeaLeaf.Event.tlFlushQueue();
				}
				catch(exc) {
					if( TeaLeaf.Event.Configuration.tlshowexceptions ) {
						alert(exc.name + ": " + exc.message + "\r\n\r\nPos 7");
					}
				}
				//NOTE:  Use setTimeout instead of setInterval since
				//	setInterval is only JS 1.2 and later
				setTimeout('TeaLeaf.Event.tlTimerRoutine()', timeAmount);
			}
			setTimeout('TeaLeaf.Event.tlTimerRoutine()', TeaLeaf.Event.Configuration.tlqueueeventstimer);
		}
    	TeaLeaf.Event.Loaded = true;
	}
	//	Get the appropriate URL
	var	tmpUrl;
	if( window.location.protocol == "http:" ) {
    	tmpUrl = TeaLeaf.Event.Configuration.tlurl;
	}
	else {
    	tmpUrl = TeaLeaf.Event.Configuration.tlsecureurl;
	}

	//	Is this an absolute vs relative url
	if( tmpUrl.substr(0, 1) == "/" ) {
    	TeaLeaf.Event.prototype.theUrl = window.location.protocol + "//" + window.location.host + tmpUrl;
	}
	else {
    	TeaLeaf.Event.prototype.theUrl = window.location.href.substr(0, window.location.href.lastIndexOf("/")+1) + tmpUrl;
	}
    TeaLeaf.Event.prototype.XMLData = "";  
    TeaLeaf.addOnLoad(TeaLeaf.Event.EventSetup); 
}
// TeaLeafEnvCfg.js - @version 7.0.0001
if(typeof TeaLeaf.Env == "undefined"){	
	TeaLeaf.Env = {};

    if(typeof TeaLeaf.Env.Configuration == "undefined"){
        TeaLeaf.Env.Configuration = {
            "tlinitpost" : true 
        };
    }
}
// TeaLeafEnv.js - @version 7.0.0001
if(TeaLeaf.Env && TeaLeaf.Env.Configuration) {		
	/**
    * Send a page summary about Window, Document, Navigator and Screen 
    * object when the page is loaded.
    * @requires
    * TeaLeafEvent.js 
    * @addon
    */            	                                       
	TeaLeaf.Env.tlSendPageSummary = function() {
	    if( TeaLeaf.Configuration.tlSDK == false ){	    
	        if( TeaLeaf.Env.Configuration.tlinitpost == true ) {                 
                TeaLeaf.Env.Configuration.tlinitpost = false; 
                var tlevt = new TeaLeaf.Event("PERFORMANCE", "INIT");
			    TeaLeaf.Event.PageLoadMilliSecs = TeaLeaf.Event.tlDateDiff(TeaLeaf.tlStartLoad, tlevt.date);
                TeaLeaf.Event.SetType = tlevt.EventType;
                
                if(TeaLeaf.Event.SetSubType == ""){
                    TeaLeaf.Event.SetSubType = tlevt.EventSubType;
                }
                else{
                    TeaLeaf.Event.SetSubType += "; " + tlevt.EventSubType;
                }
                TeaLeaf.Event.Configuration.tlinitflag = true;                
                TeaLeaf.Env.tlInfo(tlevt);    
                TeaLeaf.Env.tlDOMDocumentInfo(tlevt);
                TeaLeaf.Env.tlDOMWindowInfo(tlevt);
                TeaLeaf.Env.tlDOMNavigatorInfo(tlevt);
                TeaLeaf.Env.tlDOMScreenInfo(tlevt);
			    tlevt.tlSend(true);
            }
	    }
    }
	/*
    * Gather Basic Info.
    * @param tlevt TeaLeaf event used for reporting on the Document object.  
    * @requires
    * TeaLeafEvent.js 
    * @addon
    */            	                                           
    TeaLeaf.Env.tlInfo = function(tlevt){
        tlevt.tlPushXML("Info");
        var tlAddNameValueArray = new Array("PageLoadMilliSecs", TeaLeaf.Event.tlGetRenderTime(),
				                                    "Version", TeaLeaf.Event.tlGetJSVersion(), 
				                                    "TimezoneOffset", tlevt.date.getTimezoneOffset());
        tlevt.tlAddData(tlAddNameValueArray);  
        tlevt.tlPopXML();
    }
    
	/*
    * Gather Information about the Document object.
    * @param tlevt TeaLeaf event used for reporting on the Document object.  
    * @requires
    * TeaLeafEvent.js 
    * @addon
    */            	                                           
    TeaLeaf.Env.tlDOMDocumentInfo = function(tlevt){
        tlevt.tlPushXML("Document");
        var tlAddNameValueArray1 = new Array("URL", document.URL,
		                                    "Title", document.title,
						                    "Referer", document.referer,
						                    "ContentType", document.contentType,
						                    "LastModified", document.lastModified,
						                    "CharacterSet", document.characterSet,
						                    "Height", document.height,
						                    "Width", document.width);
		tlevt.tlAddData(tlAddNameValueArray1);
        var tlAddNameValueArray2 = new Array("Anchors", document.anchors.length,
						                     "Applets", document.applets.length,
						                     "Embeds", document.embeds.length,
						                     "Forms", document.forms.length,
						                     "Images", document.images.length,
						                     "BadImages", TeaLeaf.Event.tlBadImageCount(),
						                     "Links", document.links.length,
						                     "Plugins", document.plugins.length);
		tlevt.tlAddData(tlAddNameValueArray2);
		tlevt.tlPopXML();
    }
	/**
    * Gather Information about the Window object.
    * @param tlevt TeaLeaf event used for reporting on the Window object.
    * @requires
    * TeaLeafEvent.js 
    * @addon
    */            	                                           
    TeaLeaf.Env.tlDOMWindowInfo = function(tlevt){
	    tlevt.tlPushXML("Window");
	    var tlAddNameValueArray = new Array("WindowHref", escape(window.location.href),
						                    "WindowProtocol", window.location.protocol,
						                    "WindowHost", window.location.host,
						                    "WindowHostName", window.location.hostname,
						                    "WindowPort", window.location.port,
						                    "WindowPathName", window.location.pathname);	
		tlevt.tlAddData(tlAddNameValueArray);
		if( window.innerHeight && window.innerWidth ) {
		    var tlAddNameValueArrayWinClientSize = new Array("ClientSize", window.innerHeight + "x" + window.innerWidth);
		    tlevt.tlAddData(tlAddNameValueArrayWinClientSize);
		}
		else if( document.body.clientWidth && document.body.clientHeight ) {
		    var tlAddNameValueArrayDocClientSize = new Array("ClientSize", document.body.clientHeight + "x" + document.body.clientWidth);
            tlevt.tlAddData(tlAddNameValueArrayDocClientSize);
		}
		var tlAddNameValueArrayScreen = new Array("FullScreen", navigator.fullScreen,
						                          "Frames", window.frames.length);
        tlevt.tlAddData(tlAddNameValueArrayScreen);
		tlevt.tlPopXML();
    }
	/**
    * Gather Information about the Navigator object.
    * @param tlevt TeaLeaf event used for reporting on the Navigator object.
    * @requires
    * TeaLeafEvent.js 
    * @addon
    */            	                                           
    TeaLeaf.Env.tlDOMNavigatorInfo = function(tlevt){
	    tlevt.tlPushXML("Navigator");
		//	Navigator Info
		var tlAddNameValueArray = new Array("AppCodeName", navigator.appCodeName,
						"AppName", navigator.appName,
						"AppVersion", navigator.appVersion,
						"BrowserLanguage", navigator.browserLanguage,
						"CookieEnabled", navigator.cookieEnabled,
						"CPUClass", navigator.cpuClass,
						"Language", navigator.language,
						"OSCPU", navigator.oscpu,
						"Platform", navigator.platform,
						"Product", navigator.product,
						"SystemLanguage", navigator.systemLanguage,
						"UserAgent", navigator.userAgent,
						"UserLanguage", navigator.userLanguage,
						"Vendor", navigator.vendor,
						"VendorSub", navigator.vendorSub);
		tlevt.tlAddData(tlAddNameValueArray);
		tlevt.tlPopXML();
    }    
	/**
    * Gather Information about the Screen object.
    * @param tlevt TeaLeaf event used for reporting on the Navigator object.
    * @requires
    * TeaLeafEvent.js 
    * @addon
    */            	                                           
    TeaLeaf.Env.tlDOMScreenInfo = function(tlevt){ 
 	    tlevt.tlPushXML("Screen");
		//	Screen Info
		var tlAddNameValueArray = new Array("AvailHeight", screen.availHeight,
						                    "AvailLeft", screen.availLeft,
						                    "AvailTop", screen.availTop,
						                    "AvailWidth", screen.availWidth,
						                    "BufferDepth", screen.bufferDepth,
						                    "ColorDepth", screen.colorDepth,
						                    "DeviceXDPI", screen.deviceXDPI,
						                    "DeviceYDPI", screen.deviceYDPI,
						                    "FontSmoothingEnabled", screen.fontSmoothingEnabled,
						                    "Height", screen.height,
						                    "Left", screen.left,
						                    "LogicalXDPI", screen.logicalXDPI,
						                    "LogicalYDPI", screen.logicalYDPI,
						                    "Top", screen.top,
						                    "UpdateInterval", screen.updateInterval,
						                    "Width", screen.width);
		tlevt.tlAddData(tlAddNameValueArray);	
		tlevt.tlPopXML();

    }
	/**
    * Initialize the call to tlSendPageSummary when UI Client Event
    * Capture is not used as an SDK.
    * @addon
    */            	                                           
	TeaLeaf.Env.CallInit = function() {	
        TeaLeaf.addOnLoad(TeaLeaf.Env.tlSendPageSummary);
	}	
	TeaLeaf.Env.CallInit();
}
