/**
 *
 * etrack API
 *
 * Standard API for tracking flash and flex application using different tracking sytems
 * 
 *
 * @version 1.1
 * @authors Michael.Poellinger@ecomplexx.com, Dorin.Suma@ecomplexx.com
 */

// Plugin of TrackingInterface
var trackingInterface = new TrackingInterface();
    
/**
 *
 * TRACKING CALLBACKS
 * This 
 *
 * @param String applicationID, 
 * @param String applicationDisplayState, 
 * @param String currentLocation,
 * @param String elementID,
 * @param String eventType,
 * @param String params
 * @return
 */
function ExETrack(applicationID, applicationDisplayState, currentLocation, elementID, eventType, params)
{
    var trackingObject                         = new TrackingObject();
    
    // TODO: Deactivate Debug Output
    trackingObject.debugMode                 = true;
    
    trackingObject.applicationID             = applicationID;
    trackingObject.applicationDisplayState    = applicationDisplayState;
    trackingObject.currentLocation             = currentLocation;
    trackingObject.elementID                 = elementID;
    trackingObject.eventType                 = eventType;
    trackingObject.params                     = params;
    trackingObject.track();
    delete trackingObject;
}
/**
 *
 * Standard etrack TrackingObject
 *
 * @constructs
 */
function TrackingObject()
{
    this.applicationID;
    this.applicationDisplayState;
    this.currentLocation;
    this.elementID;
    this.eventType;
    this.params;
    this.debugOutput;
}

/**
 * 
 * Call the method with name from the variable eventType 
 * 
 * @return
 */
TrackingObject.prototype.track = function()
{        
    trackingInterface.track(this);
};    
/**
* Write the debug string on the console
* only if the global variable DebugOutput is set to true
* 
* @param uDebugString String for output on the console
* @return
*/
TrackingObject.prototype.consoleOutput = function ( uDebugString ) 
{
    if (this.debugMode)
    {
        console.log (uDebugString);
        console.log ("applicationID..........: " + this.applicationID);
        console.log ("applicationDisplayState: " + this.applicationDisplayState);
        console.log ("currentLocation........: " + this.currentLocation);
        console.log ("elementID..............: " + this.elementID);
        console.log ("eventType..............: " + this.eventType);
        console.log ("params.................: " + this.params);
        console.log ("------------------------------------------------");
    }
};
