// 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();
}function Ajax()
{
    var xmlHttp = null;
    var verb = 'GET';var body = null;
    var url = '';handler = '';var element = '';
    var date = new Date();
        
    this.GetData = function(_url,_body,_verb,_handler)
    {
        if(_verb != '') {   verb = _verb;    }
        if(_body != '') {   body = _body;    }
        
        url = _url;
        handler = _handler;
        
        xmlHttp = AJ_X();
        if(xmlHttp != null)
        {
            xmlHttp.onreadystatechange = AJ_SC;
            xmlHttp.open(verb,url,true);
            xmlHttp.send(body);
        }
    }
    
    this.SendRequest = function(_url)
    {
		url = Ajax_AppendTimestamp(_url);
		
		xmlHttp = AJ_X();
        if(xmlHttp != null)
        {
			xmlHttp.onreadystatechange = function(){};
            xmlHttp.open(verb,url,true);
            xmlHttp.send(body);
        }
    }
    
    this.UpdateInnerHtml = function(_url,_element)
    {    
        url = _url;
        element = _element;
        
        xmlHttp = AJ_X();
        
        if(xmlHttp != null)
        {
            xmlHttp.onreadystatechange = Ajax_UpdateInnerHtml;
            xmlHttp.open(verb,url,true);
            xmlHttp.send(body);
        }
    }
	
	function Ajax_AppendTimestamp(_url){
		if(_url.indexOf('?') > -1){
			_url += '&nocache=' + date.getTime();
		}
		else{
			_url += '?nocache=' + date.getTime();
		}
		return _url;
	}

    function Ajax_UpdateInnerHtml(){
        if (xmlHttp.readyState == 4)
        {
            if (is404Page(xmlHttp.responseText))
                eval(handler + '(\'\')');
            else if (xmlHttp.status == 200)
            {
                document.getElementById(element).innerHTML = xmlHttp.responseText;
            }
        }
    }

    function AJ_SC()
    {
        if (xmlHttp.readyState == 4)
        {
            if (is404Page(xmlHttp.responseText))
                eval(handler + '(\'\')');
            else if (xmlHttp.status == 200)
            {
                var re = new RegExp('\'', 'gi');
                var r = xmlHttp.responseText.replace(re,'\\\'');
                var reNL = new RegExp('\n', 'g');
                r = r.replace(reNL,'');
                var reCR = new RegExp('\r', 'g');
                r = r.replace(reCR,'');
                eval(handler + '(\'' + r + '\')');
            }
        }
    }
    
    function AJ_X()
    {
        var oX = null;
        try
        {
            oX = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e)
        {
            try
            {
                oX = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(E)
            {
                oX = null;
            }
        }
        
        if((oX == null) && (typeof XMLHttpRequest != 'undefined'))
        {
            oX = new XMLHttpRequest();
        }
        return oX;
    }      
    
    function is404Page(sText) 
    {
        return sText.indexOf("The page you requested has been moved or does not exist") >= 0;
    }
}//This function required prototype.js or /daily/js/ajax.js to already be included
function Dedup()
{
	var url = window.location.href;
	var fDelete = false;

	//Checking for SEM links.
	if( (ParamExists("kword", url)) || (ParamExists("semcid", url)) )
	{
		fDelete = true;
	}
	//Checking for Email links
	else if ( (ParamExists("emlcid", url)) || ( (ParamExists("eml", url)) && (GetParam("tpid", url) == "1") ) )
	{	
		fDelete = true;
	}
	// Trip Advisor links or other Distribution Partners
	else if ( ParamExists("mdpcid", url) )
	{
		fDelete = true;
	}
	// Online Advertising links
	else if ( ParamExists("olacid", url) )
	{
		fDelete = true;
	}
	// MSN links
	else if ( ParamExists("mdpcid", url) && ParamExists("msncid", url) )
	{
		fDelete = true;
	}
	// Affinity Marketing
	else if ( ParamExists("afmcid", url) )
	{
		fDelete = true;
	}
	// EAPs - may need to check cookie
	else if ( ParamExists("eapid", url) && (GetParam("eapid", url) != "0" ) )
	{
		fDelete = true;
	}
	// affcid: if affcid param is present and not cjXXX then dedupe
	else if ( ParamExists("affcid", url) && (GetParam("affcid", url).indexOf("cj") != 0) )
	{
		fDelete = true;
	}
	
	if (fDelete)
	{
		try{
			if(typeof(Prototype) != 'undefined'){
				var ajax = new Ajax.Request('/pub/agent.dll',{method: 'get', parameters: 'qscr=uasc&flag=d', onFailure: DeleteError});
			}
			else{
				var ajax = new Ajax();
				ajax.SendRequest('/pub/agent.dll?qscr=uasc&flag=d');
				ajax = null;
			}
		}
		catch(e){
		}
	}
}

function DeleteSuccess() {}
function DeleteError() {}

function ParamExists(strParameterAnyCase, strQueryAnyCase)
{
  return GetParam(strParameterAnyCase, strQueryAnyCase).length > 0;
}

// from LaunchKanaRealtime.js. Made the comparisons case insensitive. 
// The returned query parameter value is always in lower case
function GetParam( strParameterAnyCase, strQueryAnyCase )
{
	var strQuery = strQueryAnyCase.toLowerCase();
	var strParameter = strParameterAnyCase.toLowerCase();

        // the value string
        var strValue = "" ;

        // can we find the specified parameter in the query string? (first try with "?")
        var strParamEquals = "?" + strParameter + "=" ;
        var iParamStart    = strQuery.indexOf( strParamEquals ) ;

        if ( iParamStart == -1 )
        {
            // no - can we find the specified parameter in the query string? (now try with "&")
            strParamEquals = "&" + strParameter + "=" ;
            iParamStart    = strQuery.indexOf( strParamEquals ) ;
        }

        // did we find the specified parameter?
        if ( iParamStart != -1 )
        {
            // yes - get the starting location for the value string
            var iValueStart = iParamStart + strParamEquals.length ;

            // get the value string pointed to by the parameter
            strValue = strQuery.substring( iValueStart, strQuery.length ) ;

            // is there another parameter in the value string?
            var iNextParameter = strValue.indexOf( "&" ) ;

            if ( iNextParameter != -1 )
            {
                // yes - truncate the value string before that parameter
                strValue = strValue.substring( 0, iNextParameter ) ;
            }
        }

        // unescape the value string
        strValue = unescape( strValue ) ;

        return( strValue ) ;
}

//Make function call
Dedup();
var OpinionLab = (function(){
	var custom_var,_sp='%3A\\/\\/',_rp='%3A//',_poE=0.0,_poX=0.0,_sH=screen.height,_d=document,_w=window,_ht=escape(_w.location.href),_hr=_d.referrer,_tm=(new Date()).getTime(),_kp=0,_sW=screen.width;

	function _fC(_u){
		_aT=_sp+',\\/,\\.,-,_,'+_rp+',%2F,%2E,%2D,%5F';
		_aA=_aT.split(',');
		for(i=0;i<5;i++){
			eval('_u=_u.replace(/'+_aA[i]+'/g,_aA[i+5])')
		}
		return _u
	};
	
	function _fPe(){
		if(Math.random()>=1.0-_poE){
			O_LC();
			_poX=0.0
		}
	};

	function _fPx(){
		if(Math.random()>=1.0-_poX)
			O_LC()
	};
	
	function _populateCustomVar(){		
		var t = (typeof(s_exp) != 'undefined') ? s_exp.prop11 :
				(typeof(s_prop11) != 'undefined') ? s_prop11 : '';

		var g = (typeof(s_exp) != 'undefined') ? s_exp.prop12 :
				(typeof(s_prop12) != 'undefined') ? s_prop12 : '';
		
		custom_var = g + '|' + t;
	};
		
	function _replacePageName(){
		var page_name = null;
		
		page_name = (typeof(s_exp) != 'undefined') ? escape(s_exp.pageName)+'.html' :
					(typeof(s_pageName) != 'undefined') ? escape(s_pageName)+'.html' : null;
		
		if(page_name){
			_domain=_ht.replace('https%3A//', '').replace('http%3A//','');
			_ht=_ht.substr(0,_ht.indexOf('%3A//'))+'%3A//'+_domain.substr(0,_domain.indexOf('/'))+'\/'+page_name;
			
			if (typeof(bIsCAFR) != 'undefined') {
				if (bIsCAFR == true) {
					_lG='fr-CA.';
					_rp='%3A//'+_lG
				}
			}
		}
	};
	
	return {
		O_LC:function(){
			_replacePageName();
			_populateCustomVar();
			_w.open('https://secure.opinionlab.com/ccc01/comment_card.asp?time1='+_tm+'&time2='+(new Date()).getTime()+'&prev='+_fC(escape(_hr))+'&referer='+_fC(_ht)+'&height='+_sH+'&width='+_sW+'&custom_var='+custom_var,'comments','width=535,height=192,screenX='+((_sW-535)/2)+',screenY='+((_sH-192)/2)+',top='+((_sH-192)/2)+',left='+((_sW-535)/2)+',resizable=yes,copyhistory=yes,scrollbars=no')
		}
	,	O_GoT:function(_p){
			_d.write('<a href=\'javascript:O_LC()\'>'+_p+'</a>');
		}
	};
})();var BaynoteEnabled = true;
var BaynoteJSVersion="$Revision: 1.20 $";
if(typeof(baynote_globals)=="undefined")var baynote_globals=new Object();function BNLog(){this.timeBase=new Date().getTime();this.lines=new Array();this.lastLine="";this.repCount=0;}
BNLog.prototype.log=function(str){if(str==this.lastLine){++this.repCount;return;}
if(this.repCount>0){this.lines.push("___ ABOVE REPEATED "+this.repCount+" TIME"+((this.repCount>1)?"S":""));}
this.lastLine=str;this.repCount=0;var elapsed=new Date().getTime()-this.timeBase
this.lines.push(elapsed+": "+str);}
BNLog.prototype.toString=function(){if(this.repCount>0){this.lines.push("___ ABOVE REPEATED "+this.repCount+" TIME"
+((this.repCount>1)?"S":""));this.lastLine="";this.repCount=0;}
return this.lines.join("\n");}
if(typeof(bnLog)=="undefined"){var bnLog=new BNLog();}
function BNCriticalSectionQueue(){this.waitList=new Object();this.lastId=0;}
BNCriticalSectionQueue.prototype.issueId=function(){return++this.lastId;}
BNCriticalSectionQueue.prototype.enqueue=function(id,item){this.waitList[id]=item;}
BNCriticalSectionQueue.prototype.getWaiter=function(id){return(id==null)?null:this.waitList[id];}
BNCriticalSectionQueue.prototype.firstWaiter=function(){return this.getWaiter(this.nextWaiterKeyAfter(null));}
BNCriticalSectionQueue.prototype.nextWaiterAfter=function(id){return this.getWaiter(this.nextWaiterKeyAfter(id));}
BNCriticalSectionQueue.prototype.nextWaiterKeyAfter=function(id){for(var currKey in this.waitList){if(typeof(this.waitList[currKey])!="object")continue;if(id==null)return currKey;if(id==currKey)id=null;}
return null;}
BNCriticalSectionQueue.prototype.nextPredecessor=function(target,start){for(var currWaiter=start;currWaiter!=null;currWaiter=this.nextWaiterAfter(currWaiter.id)){if(currWaiter.enter||(currWaiter.number!=0&&(currWaiter.number<target.number||(currWaiter.number==target.number&&currWaiter.id<target.id)))){return currWaiter;}}
return null;}
function BNCriticalSection(csQueue){this.csQueue=csQueue;this.debug=1;}
BNCriticalSection.prototype.enter=function(enterFunc){this.enterFunc=enterFunc;this.id=this.csQueue.issueId();this.csQueue.enqueue(this.id,this);this.enter=true;this.number=(new Date()).getTime();this.enter=false;this.attempt(this.csQueue.firstWaiter());}
BNCriticalSection.prototype.leave=function(){if(this.debug)bnLog.log("LEAVE "+this.id);this.number=0;}
BNCriticalSection.prototype.attempt=function(start){var nextReady=this.csQueue.nextPredecessor(this,start);if(nextReady!=null){if(this.debug)bnLog.log("WAIT "+this.id);var me=this;return setTimeout(function(){me.attempt(nextReady);},50);}
if(this.debug)bnLog.log("ENTER "+this.id);this.enterFunc();}
function BNResourceManager(){this.csQueue=new BNCriticalSectionQueue();this.critSec=null;this.debug=1;this.resources=new Object();this.waiting=new Object();}
BNResourceManager.prototype.getResource=function(rId){return this.resources[rId];}
BNResourceManager.prototype.loadResource=function(rId,rAddress,rType){if(typeof(this.resources[rId])!="undefined")return;this.resources[rId]=null;var critSec=new BNCriticalSection(this.csQueue);critSec.enter(function(){bnResourceManager.inject(rId,rAddress,rType,critSec);});}
BNResourceManager.prototype.inject=function(rId,rAddress,rType,critSec){this.critSec=critSec;if(this.debug)bnLog.log("INJECT "+this.critSec.id+" ("+rId+")");if(!rType||rType=="script"){var scriptTag1=document.createElement("script");scriptTag1.language="javascript";scriptTag1.src=rAddress;var head=document.getElementsByTagName("head");head[0].appendChild(scriptTag1);}
else if(rType=="img"){var img=document.createElement("IMG");var handler=function(){bnResourceManager.registerAndAddResource(rId,img);};if(img.addEventListener)img.addEventListener("load",handler,false);else if(img.attachEvent)img.attachEvent("onload",handler);else img["onload"]=handler;img.src=rAddress;}
else alert("Unexpected resource type to loadResource: "+rType);}
BNResourceManager.prototype.waitForResource=function(rId,callbackCode,rAddress,rType){with(this){if(getResource(rId)){this.runCallback(callbackCode);}
else{if(typeof(waiting[rId])=="undefined")waiting[rId]=new Array();var waitingList=waiting[rId];waitingList[waitingList.length]=callbackCode;if(rAddress)this.loadResource(rId,rAddress,rType);}}}
BNResourceManager.prototype.wakeUpWaiting=function(rId){with(this){var waitingList=waiting[rId];if(!waitingList)return;for(var i=0;i<waitingList.length;i++){if(waitingList[i]){var codeToEval=waitingList[i];waitingList[i]=null;if(this.debug&&codeToEval)bnLog.log("CALLBACK "+rId+": "+codeToEval);this.runCallback(codeToEval);}}}}
BNResourceManager.prototype.registerAndAddResource=function(rId,resource){if(this.debug)bnLog.log("REGISTER "+this.critSec.id+" ("+rId+")");this.resources[rId]=resource;this.wakeUpWaiting(rId);this.critSec.leave();setTimeout("bnResourceManager.wakeUpWaiting('"+rId+"')",5000);}
BNResourceManager.prototype.registerResource=function(rId){this.registerAndAddResource(rId,true);}
BNResourceManager.prototype.runCallback=function(callback){if(typeof(callback)=="string")eval(callback);else if(typeof(callback)=="function")callback();else alert("Invalid callback, type="+typeof(callback));}
if(typeof(bnResourceManager)=="undefined"){var bnResourceManager=new BNResourceManager();}
function BNSystem(){this.testServer=null;}
BNSystem.prototype.getCookieValue=function(cookieName,cookieSubDomain){if(!cookieSubDomain)cookieSubDomain=baynote_globals.cookieSubDomain;if(cookieSubDomain)cookieName+=("-"+cookieSubDomain);var cookieValue=document.cookie;var cookieStartsAt=cookieValue.indexOf(" "+cookieName+"=");if(cookieStartsAt==-1)cookieStartsAt=cookieValue.indexOf(cookieName+"=");if(cookieStartsAt==-1)cookieValue=null;else{cookieStartsAt=cookieValue.indexOf("=",cookieStartsAt)+1;var cookieEndsAt=cookieValue.indexOf(";",cookieStartsAt);if(cookieEndsAt==-1)cookieEndsAt=cookieValue.length;cookieValue=unescape(cookieValue.substring(cookieStartsAt,cookieEndsAt));}
return cookieValue;}
BNSystem.prototype.setCookie=function(cookieName,cookieValue,cookiePath,cookieExpires,cookieDomain,cookieSubDomain){cookieValue=escape(cookieValue);if(cookieExpires=="NEVER"){var nowDate=new Date();nowDate.setFullYear(nowDate.getFullYear()+500);cookieExpires=nowDate.toGMTString();}
else if(cookieExpires=="SESSION")cookieExpires="";if(cookiePath!="")cookiePath=";Path="+cookiePath;if(cookieExpires!="")cookieExpires=";expires="+cookieExpires;if(!cookieDomain)cookieDomain=(baynote_globals.cookieDomain)?baynote_globals.cookieDomain:"";if(cookieDomain!="")cookieDomain=";domain="+cookieDomain;if(!cookieSubDomain)cookieSubDomain=baynote_globals.cookieSubDomain;if(cookieSubDomain)cookieName+=("-"+cookieSubDomain);var cookieStr=cookieName+"="+cookieValue+cookieExpires+cookiePath+cookieDomain;if(cookieStr.length>4096)return false;document.cookie=cookieStr;return true;}
BNSystem.prototype.removeCookie=function(cookieName,cookieDomain){this.setCookie(cookieName,"","/","Mon, 1 Jan 1990 00:00:00",cookieDomain);}
BNSystem.prototype.getURLParam=function(name,url){if(!url)var url=window.location.href;var regex=new RegExp("[\\?&]"+name+"=([^&#]*)");var match=regex.exec(url);if(!match)return null;else return match[1];}
BNSystem.prototype.getTestServer=function(){if(this.testServer!=null)return this.testServer;var testServer=this.getURLParam("bn_test");if(testServer)this.setCookie("bn_test",testServer,"/","SESSION");else if(testServer=="")this.removeCookie("bn_test");else{testServer=this.getCookieValue("bn_test");if(!testServer)testServer="";}
this.testServer=testServer;return testServer;}
if(typeof(bnSystem)=="undefined"){var bnSystem=new BNSystem();}
if(typeof(BNTag)=="undefined"){function BNTag(previousTag){if(previousTag){this.id=previousTag.id+1;this.server=previousTag.server;this.customerId=previousTag.customerId;this.code=previousTag.code;}
else this.id=0;this.attrs=new Object();this.css=new Object();}}
BNTag.prototype.getCommonResourceId=function(){return"Common";}
BNTag.prototype.getCommonResourceAddress=function(tag){return(this.server+"/baynote/tags2/common.js");}
BNTag.prototype.getFailsafeResourceId=function(){return"Failsafe";}
BNTag.prototype.getFailsafeResourceAddress=function(){return(this.server+"/baynote/customerstatus2?customerId="+this.customerId+"&code="+this.code+"&x="+this.id+(new Date().getTime()));}
BNTag.prototype.show=function(parentElemId){if(this.id==0)document.write("<span id='bn_placeholder_global'></span>");this.placeHolderId="bn_placeholder"+this.id;var placeHolderType;if(this.placeHolderElement)placeHolderType=this.placeHolderElement;else placeHolderType=this.popup?"span":"div";if(parentElemId){var placeHolder=document.createElement(placeHolderType);placeHolder.id=this.placeholderId;document.getElementById(parentElemId).appendChild(placeHolder);}
else document.write("<"+placeHolderType+" id='"+this.placeHolderId+"'></"+placeHolderType+">");window["bn_tags"][this.id]=this;var testServer=bnSystem.getTestServer();if(testServer){var reValidTestServer=new RegExp("^https?://[^/]*\.baynote\.(com|net)(:\d+)?(/.*)?");if(reValidTestServer.test(testServer))this.server=testServer;else alert("Ignoring invalid test server \""+testServer+"\"");}
this.showWhenReady(this);baynote_tag=new BNTag(this);}
BNTag.prototype.showWhenReady=function(tag){var failsafeId=this.getFailsafeResourceId();if(!bnResourceManager.getResource(failsafeId)){bnResourceManager.waitForResource(failsafeId,function(){tag.showWhenReady(tag);},this.getFailsafeResourceAddress(),"img");return;}
var commonId=this.getCommonResourceId();if(!bnResourceManager.getResource(commonId)){bnResourceManager.waitForResource(commonId,function(){tag.showWhenReady(tag);},this.getCommonResourceAddress(),"script");return;}
bnTagManager.show(tag.id);}
BNTag.prototype.noshow=function(){window["bn_tags"][this.id]=this;baynote_tag=new BNTag(this);}
BNTag.prototype.getParam=function(name,defaultValue){var value=this[name];if(typeof(value)=="undefined"||value==null)return defaultValue;else return value;}
if(typeof(baynote_tag)=="undefined"){window["bn_tags"]=new Array();var baynote_tag=new BNTag(null);}/*
 *	baynote_validateSearchBox()
 *
 *	Determine if the service is available and show the search box if it is.
 */
function baynote_validateSearchBox() {
	if(typeof(BaynoteEnabled) != 'undefined' && BaynoteEnabled){
		if(window.location.href.indexOf("https://") == -1){
			var failsafeId = baynote_tag.getFailsafeResourceId();

			baynote_tag.server = "http://expedia-www.baynote.net/";
			baynote_tag.customerId = "expedia";
			baynote_tag.code = "www";
			
			if ((bnResourceManager != "undefined")
					&& (bnResourceManager != null)
					&& (typeof(failsafeId) != "undefined")
					&& (failsafeId != null)) {
				bnResourceManager.waitForResource(failsafeId,
					"baynote_showSearchBox()", 
					baynote_tag.getFailsafeResourceAddress(), 
					"img");
			}
		}
	}
}

/*
 *	baynote_showSearchBox()
 *
 *	Make the search box visible
 */
function baynote_showSearchBox(){
	if(document.getElementById("baynote_searchBox")){
		document.getElementById("baynote_searchBox").style.display = "block";
	}
}

function baynote_handleSubmit(){
	var q = (document.getElementById("baynote_isDefault").value == "1") ? "" : document.getElementById("baynote_q").value;
	var st = document.getElementById("baynote_st").value;
	var cn = document.getElementById("baynote_cn").value;
	var cc = document.getElementById("baynote_cc").value;
	
	var url = "http://search.expedia.com/socialsearch/query" + "?st=" + st + "&cn=" + cn + "&cc=" + cc + "&q=" + q;

	if(window.parent) window.parent.document.location = url;
	else window.location = url;
}

function baynote_handleFocus(){
	var inputElement = document.getElementById("baynote_q");
	var defaultElement = document.getElementById("baynote_isDefault");

	if(defaultElement.value == "1"){
		defaultElement.value = "0";
		inputElement.value = "";
	}
}

function baynote_handleBlur(){
	var inputElement = document.getElementById("baynote_q");
	var defaultElement = document.getElementById("baynote_isDefault");

	if(inputElement.value.length == 0){
		inputElement.value = "Search Expedia";
		defaultElement.value = "1";
	}	
}var s_pageName;
var s_account;
var s_server;
var s_currencyCode;
var s_channel;
var s_pageType;
var s_hier1;
var s_prop1;
var s_prop12;
var s_prop30;
var s_prop34;
/* E-commerce Variables */
var s_campaign;
var s_state;
var s_zip;
var s_events;
var s_products;
var s_purchaseID;
var s_eVar1;
var s_eVar2;
var s_eVar3;
var s_eVar4;
var s_eVar5;
var s_eVar31;
var s_eVar32;
var s_eVar33;
var s_eVar34;
function SiteAn()
{
	s_account = "";
	s_pageName = "";
	s_server="";
	s_currencyCode="";
	s_channel="";
	s_pageType="";
	s_hier1="";
	s_prop1="";
	s_prop12="";
	s_prop30="";
	s_prop34="";
	/* E-commerce Variables */
	s_campaign="";
	s_state="";
	s_zip="";
	s_events="";
	s_products="";
	s_purchaseID="";
	s_eVar1="";
	s_eVar2="";
	s_eVar3="";
	s_eVar4="";
	s_eVar5="";
	s_eVar31="";
	s_eVar32="";
	s_eVar33="";
	s_eVar34="";
}
SiteAn.prototype.SetAccount = function(s){
	s_account = s;
}
SiteAn.prototype.SetPageName = function(s){
	s_pageName = s;
}
SiteAn.prototype.SetCurrencyCode = function(s){
	s_currencyCode = s;
}
SiteAn.prototype.SetPageType = function(s){
	s_pageType = s;
}
SiteAn.prototype.SetHierarchy = function(s){
	s_hier1 = s;
}
SiteAn.prototype.SetChannel = function(s){
	s_channel = s;
}
SiteAn.prototype.SetEvents = function(s){
	s_events = s;
}
SiteAn.prototype.SetTraffic1 = function(s){
	s_prop1 = s;
}
SiteAn.prototype.SetTraffic12 = function(s){
	s_prop12 = s;
}
SiteAn.prototype.SetVar31 = function(s){
	s_eVar31 = s;
}
SiteAn.prototype.SetVar32 = function(s){
	s_eVar32 = s;
}
SiteAn.prototype.SetVar33 = function(s){
	s_eVar33 = s;
}
SiteAn.prototype.SetVar34 = function(s){
	s_eVar34 = s;
}
SiteAn.prototype.SetProp34 = function(s){
	s_prop34 = s;
}
function GetAccount(s,tpid)
{
	sAcc = "devexpediacom";
	if (s.indexOf("expedia.com") != -1 || s.indexOf("us.expediacustomer.com") != -1)
		sAcc = "expedia" + tpid;
	return sAcc;
}var TT_t;var TT_d;var TT_i;var TT_aX;var TT_aY;var tttitle;var tttext;var ttw;var ttbc;var tticon;var ttbgcolor;var ttpath='http://media.expedia.com/media/content/expus/graphics/common/corners/';
function TT(t){TT_t=t;TT_I();TT_sH();TT_D();}
function TT_I(){if(navigator.appName=='Microsoft Internet Explorer' && navigator.appVersion.indexOf('Win')!=-1){TT_cI();}TT_cD();}
function TT_cI(){if(TT_i==null){TT_i=document.createElement('iframe');TT_i.id='TT_i';TT_i.src='';TT_i.style.zIndex='9999';TT_i.style.display='none';TT_i.style.position='absolute';TT_i.frameBorder=0;TT_i.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity=0)';document.body.appendChild(TT_i);}}
function TT_cD(){if(TT_d==null){TT_d=document.createElement('div');TT_d.id='div';TT_d.style.zIndex='10000';TT_d.style.display='none';TT_d.style.position='absolute';document.body.appendChild(TT_d);}}
function TT_sH(){if (ttbc=='666666'){ttbgcolor=' bgcolor="#f7f7f7"';}else{ttbgcolor=' bgcolor="#ffffff"';}TT_d.innerHTML='<table id="TT_tbl" cellpadding="0" cellspacing="0" border="0" width="' + ttw + '"><tr><td height="12"><img src="' + ttpath + 'ttTL' + ttbc + '.gif"></td><td width="100%" style="border-top:1px solid #' + ttbc + ';background-color:#' + ttbc + ';"><img src="' + tticon + '" hspace="3" align="middle"><span style="font-size:11px;font-family:Arial;font-weight:bold;color:white;vertical-align:middle;">' + tttitle + '</span></td><td><img src="' + ttpath + 'ttTR' + ttbc + '.gif"></td></tr><tr><td' + ttbgcolor + ' colspan="3" style="border-left:1px solid #' + ttbc + ';border-right:1px solid #' + ttbc + ';padding:0px 5px;">' + tttext + '</td></tr><tr><td' + ttbgcolor + ' colspan="3" style="border-left:1px solid #' + ttbc + ';border-right:1px solid #' + ttbc + ';padding:0px 5px;"><div style="border-top:1px solid #' + ttbc + ';padding-top:3px;text-align:right;"><img src="/eta/btn_sec_small.gif" hspace="3" align="middle"><a href="javascript://" onclick="HTT();return false;event.cancelBubble=true;" style="font-size:11px;font-family:Arial;font-weight:bold;color:#333399;">Close</a></div></td></tr><tr><td height="7"><img src="' + ttpath + 'ttBL' + ttbc + '.gif"></td><td' + ttbgcolor + ' width="100%" style="border-bottom:1px solid #' + ttbc + ';"><img src="/eta/spaceit.gif" width=1 height=1></td><td><img src="' + ttpath + 'ttBR' + ttbc + '.gif"></td></tr></table>';}
function TT_D(){TT_d.style.display='block';if(TT_i!=null){TT_i.style.display='block';}TT_sP();}
function TT_sP(){var arr=TT_gP().split(',');TT_aX=parseInt(arr[0]);TT_aY=parseInt(arr[1]);TT_d.style.top=TT_aX+'px';TT_d.style.left=TT_aY+'px';if(TT_i!=null){TT_i.style.top=TT_aX+'px';TT_i.style.left=TT_aY+'px';TT_i.style.width=DE('TT_tbl').offsetWidth+'px';TT_i.style.height=DE('TT_tbl').offsetHeight+'px';}}
function HTT(){if(TT_d!=null){TT_d.style.display='none';}if(TT_i!=null){TT_i.style.display='none';}}
function TT_gP(){iX=0;iY=0;el=TT_t;while(el!=null){iX+=el.offsetTop;iY+=el.offsetLeft;el=el.offsetParent;}var st=TT_gST();var wh=TT_gWH();var dh=DE('TT_tbl').offsetHeight;var eh=TT_t.offsetHeight;if(((iX-dh)>st)&&((iX+eh+dh)>=(wh+st))){iX=iX-dh;}else{iX=iX+eh;}return iX+','+iY}
function TT_gST(){if(document.documentElement.scrollTop){return document.documentElement.scrollTop;}if(document.body.scrollTop){return document.body.scrollTop;}if(window.pageYOffset){return window.pageYOffset;}return 0;}
function TT_gWH(){if(window.innerHeight){return window.innerHeight;}if(document.documentElement.clientHeight){return document.documentElement.clientHeight;}if(document.body.clientHeight){return document.body.clientHeight;}return 0;}
function DE(el){return document.getElementById(el);}
function STT(t,ti,te,w,bc,i){tttitle=ti;tttext=te;ttw=w;ttbc=bc;tticon=i;TT(t);}