/*                                                                  
* Copyright © 1999-2009 TeaLeaf Technology, Inc.  
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY TEALEAF ``AS IS'' 
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE DISCLAIMED.  
* IN NO EVENT SHALL TEALEAF BE LIABLE FOR ANY DIRECT, INDIRECT, 
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
* THE POSSIBILITY OF SUCH DAMAGE.
*
* @fileoverview 
* This is the configuration file for capturing Client Events that 
* happen on the rendered Flash movie. 
*
* @version 2009.2.20.1
*                                                                   
*/

if(typeof TeaLeafFlashCfg == "undefined"){
	var TeaLeafFlashCfg = {};

   	if(typeof TeaLeafFlashCfg.Configuration == "undefined"){
	    	TeaLeafFlashCfg.Configuration = {
		 	    "tlversion"                 : "2009.2.20.1",
		    	"tlurl"                     : "/assets/js/TeaLeaf/TeaLeafTarget.html",
            	"tlqueueevents"             : true,
            	"tlqueueeventstimer"        : 30000,
            	"tlqueueeventsmaxsz"        : 8192,	    
           	"tlrepalay"		            : false,
           		"tlflashname"               : "FlashCarousel",	    
	 
			tlFlashCaptureEvents:[
				// mouse events
				{"tlcaptureflashevent": "click",	    "tlattach": true},
				{"tlcaptureflashevent": "doubleClick", 	"tlattach": false},
				{"tlcaptureflashevent": "mouseDown", 	"tlattach": true},
				{"tlcaptureflashevent": "mouseMove", 	"tlattach": false},
				{"tlcaptureflashevent": "mouseOut", 	"tlattach": false},
				{"tlcaptureflashevent": "mouseOver", 	"tlattach": false},
				{"tlcaptureflashevent": "mouseUp", 	    "tlattach": true},
				{"tlcaptureflashevent": "mouseWheel", 	"tlattach": false},
				{"tlcaptureflashevent": "rollOut", 	    "tlattach": false},
				{"tlcaptureflashevent": "rollOver", 	"tlattach": false},

				
				
				//keyboard events
				{"tlcaptureflashevent": "keyDown", 	"tlattach": false},
				{"tlcaptureflashevent": "keyUp", 	"tlattach": false},
				
				//context menu event
				{"tlcaptureflashevent": "menuItemSelect",   "tlattach": false},
				{"tlcaptureflashevent": "menuSelect", 	    "tlattach": false},
				
				//text input event
				{"tlcaptureflashevent": "link",		    "tlattach": false},
				{"tlcaptureflashevent": "textInput", 	"tlattach": false},

				//state change event
				{"tlcaptureflashevent": "currentStateChange",	"tlattach": false},
				{"tlcaptureflashevent": "currentStateChanging", "tlattach": false},
				{"tlcaptureflashevent": "change", 	"tlattach": false},
				

				//state datachange event
				{"tlcaptureflashevent": "activate",	"tlattach": false},
				{"tlcaptureflashevent": "dataChange", "tlattach": false},
				{"tlcaptureflashevent": "deactivate", 	"tlattach": false},
				{"tlcaptureflashevent": "preDataChange", 	"tlattach": false},
				
				//focus events
				{"tlcaptureflashevent": "focusIn", 	        "tlattach": false},
				{"tlcaptureflashevent": "focusOut",         "tlattach": false},
				{"tlcaptureflashevent": "keyFocusChange", 	"tlattach": false},
				{"tlcaptureflashevent": "mouseFocusChange", "tlattach": false}
		    ],

			tlHTTPRequestHeaders:[
				{"tlreqhttpheadername": "Content-Type",		"tlsethttpheader": true,    "tlreqhttpheadervalue": "text/xml"},
				{"tlreqhttpheadername": "X_TEALEAFTYPE", 	"tlsethttpheader": true,    "tlreqhttpheadervalue": "GUI"},
				{"tlreqhttpheadername": "X_TEALEAF", 		"tlsethttpheader": true,    "tlreqhttpheadervalue": "ClientEvent"}
		    	]
	    	};
    	}

	TeaLeafFlashCfg.tlreturnCfg = function(){
        	return TeaLeafFlashCfg.Configuration.tlFlashCaptureEvents;
	}	

	TeaLeafFlashCfg.tlgetHTTPRequestHeaders = function(){
        	return TeaLeafFlashCfg.Configuration.tlHTTPRequestHeaders;
	}

	TeaLeafFlashCfg.tlgetUrl = function(){
		return TeaLeafFlashCfg.Configuration.tlurl;	
	}	

	TeaLeafFlashCfg.tlQueueEvents = function(){
		return TeaLeafFlashCfg.Configuration.tlqueueevents;	
	}	

	TeaLeafFlashCfg.tlQueueTimer = function(){
		return TeaLeafFlashCfg.Configuration.tlqueueeventstimer;	
	}
	
	TeaLeafFlashCfg.tlQueueSize = function(){
		return TeaLeafFlashCfg.Configuration.tlqueueeventsmaxsz;	
	}	

	TeaLeafFlashCfg.tlReplay = function(){
		return TeaLeafFlashCfg.Configuration.tlrepalay;	
	}

	TeaLeafFlashCfg.tlalert = function(tlvar){
		alert("tl: "+tlvar);	
	}
	
	TeaLeafFlashCfg.tlgetID = function(){
		return TeaLeafFlashCfg.Configuration.tlflashname;	
	}	
    

    TeaLeafFlashCfg.tlAddHandler = function(tlitem, tlevt, tlhandler, tlcapture) {		
		try {
			    if( tlitem.addEventListener ) {
					if(navigator.userAgent.toLowerCase().indexOf('safari')!=-1){
						    tlitem.addEventListener('on'+tlevt, tlhandler, tlcapture);                                          
					}
					else{
						    tlitem.addEventListener(tlevt, tlhandler, tlcapture);
					}
			    }
			    else if( tlitem.attachEvent ) {
					tlitem.attachEvent('on'+tlevt, tlhandler);
			    }
		}
		catch(exc) {
		}
	}	
	

    TeaLeafFlashCfg.tlFlashMovie = function (movieName) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[movieName];
        } else {
            return document[movieName];
        }
    }

	TeaLeafFlashCfg.tlFlushXML = function(){
	    var tlflashmovie = TeaLeafFlashCfg.tlFlashMovie(TeaLeafFlashCfg.Configuration.tlflashname);
	    if(tlflashmovie){
		tlflashmovie.tlFlushXML();
	    }
	}
}

TeaLeafFlashCfg.tlAddHandler(window, "beforeunload", TeaLeafFlashCfg.tlFlushXML, false);
TeaLeafFlashCfg.tlAddHandler(window, "unload", TeaLeafFlashCfg.tlFlushXML, false);


