/*****************************************************
 *  EMBED OF MocitoAVM Video
 *****************************************************/


var gaJsHost    = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
var gSource     = unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E");
document.write(gSource);          
G = {
        gID     : "UA-3174946-1",
        track   : function(_VALUE_)
        {
            _VALUE_ = (!_VALUE_) ? "" : _VALUE_;
            var pageTracker = _gat._getTracker(this.gID);
            pageTracker._initData();
            pageTracker._trackPageview(_VALUE_);
            //alert(_VALUE_);
        }
};


var MocitoVideo = {

    mocServer       : "www.mocito.com",
    //mocServer       : (document.location.host=="linsrv-mms02") ? "linsrv-mms02" : "www.mocito.com",
    mocVideoFile    : "user_content\/mocitovideo\/mocitovideo.php",
    autoPlay        : "true",
    endScreen       : "",

    
    parameters      : {
                        width       : "248",
                        height      : "184",
                        wmode       : "window"
                        },
    

    getMocServer    : function()        { return this.mocServer; },
    getMocVideoFile : function()        { return this.mocVideoFile; },
    

    setWidth        : function(_VALUE_) { this.setParameter("width", _VALUE_); },
    getMocVideoW    : function()        { return this.getParameter("width"); },
    
    setHeight       : function(_VALUE_) { this.setParameter("height", _VALUE_); },
    getMocVideoH    : function()        { return this.getParameter("height"); },
    
    
    getAutoPlay     : function()        { return this.autoPlay; },
    setAutoPlay     : function(_VALUE_) { this.autoPlay = _VALUE_; },
    
    getEndScreen    : function()        { return this.endScreen; },
    setEndScreen    : function(_VALUE_) { this.endScreen = _VALUE_; },
        
    
    transID         : "",
    videoURL        : "",
    host            : document.location.host,
    prot            : document.location.protocol,

    setTransID      : function(_VALUE_) { this.transID = _VALUE_; },
    getTransID      : function()        { return this.transID; },
    
    setVideoURL     : function(_VALUE_) { this.videoURL = _VALUE_; },
    getVideoURL     : function()        { return this.videoURL; },
    
    getHost         : function()        { return this.host; },
    getProt         : function()        { return this.prot; },


    
    googleTrack     : function(_VALUE_) { G.track("AVM embed on:'" + this.getHost() + "'"); },
    
    
    setParameter    : function(_paraName, _paraValue)
    {
        this.parameters[_paraName] = _paraValue;
    },
    getParameter    : function(_paraName)
    {
        return this.parameters[_paraName];
    },
    
    getParameters   : function()
    {
        var addPara = "";
        for(p in this.parameters)
        {
            if (this.parameters[p])
                addPara += p + "='" + this.parameters[p] +"' "; 
        }
        return addPara; 
    },
    
    getSource   : function()
    {
        var dataURL = this.getProt() + "\/\/" + this.getMocServer() + "\/" + this.getMocVideoFile();
        var source  = "";
        
        var falshVar = "";
        
        if (this.getTransID())
            falshVar+="trans_id=" + this.getTransID() + "&"; 
            
        if (this.getVideoURL())
            falshVar+="video_source=" + this.getVideoURL() + "&";  
                       
        if (this.getAutoPlay())
            falshVar+="auto_play=" + this.getAutoPlay() + "&";
            
        if (this.getEndScreen())
            falshVar+="end_screen=" + this.getEndScreen() + "&";            
        
        source  = "<object "
                + this.getParameters()
                + "type='application\/x-shockwave-flash' "
                + "data='" + dataURL + "'>"
                + "<param name='movie'      value='" + dataURL + "' />"
                + "<param name='FlashVars'  value='" + falshVar +"' />"
                + "<\/object>"; 
                
        return source;
        
    },

    /*--- VIDEO INIT ---*/
    init        : function(videoID)
    {
    
/*        if (!videoID)
        {
            var _initERROR  = "VIDEO ERROR:\n"
                            + "To display the character video on your page\n"
                            + "it's necessary to call the MocitoVideo method INIT with your VIDEO_ID\n\n"
                            + "Example:\n"
                            + "<script type='text/javascript'>\n"
                            + "MocitoVideo.init('yourVideoID');\n"
                            + "</script>";
            alert(_initERROR);
            return false;
        }
        else
*/
        {
            this.setTransID(videoID);
            //alert( this.getTransID() );
            //alert(this.getAutoPlay());
            document.write(this.getSource());
            this.googleTrack();
        }
    },
    
    
    /*--- IE HACK ---*/
    eof : "END OF FILE"
};
