﻿// JSLint Config:
/*jslint browser: true */
/*global cc, jQuery, cc_resx_TR_VChat_Redirecting_to_Live_Models, 
cc_resx_TR_VChat_Click_to_return_to_models_list, cc_resx_TR_VChat_Live_Video_Chat, 
cc_resx_TR_VChat_Sorry_Server_is_full_try_again_later, cc_resx_TR_VChat_Ive_gone_into_Private_Chat,
cc_resx_TR_VChat_Host_did_not_answer, cc_resx_TR_VChat_Account_balance_too_low,
cc_resx_TR_VChat_Username_is_already_logged_In, cc_resx_TR_VChat_you_have_exceeded_the_permitted_free_time, 
cc_resx_TR_VChat_Error_connecting_to_user, cc_resx_TR_VChat_You_have_been_kicked, 
cc_resx_TR_VChat_Maximum_number_of_users_reached, cc_resx_TR_VChat_Sorry_my_room_is_full, 
cc_resx_TR_VChat_Cannot_connect_to_server, cc_resx_TR_VChat_you_have_exceeded_the_permitted_free_time, 
cc_resx_TR_VChat_Free_Chat_timed_out, cc_resx_TR_VChat_Sorry_Im_offline_right_now, 
cc_resx_TR_VChat_Closed, cc_resx_TR_VChat_Click_to_call_again, cc_resx_TR_Reload, 
cc_resx_TR_Please_wait_for_the_host_to_accept, cc_resx_TR_Bad_or_missing_close_amount, 
cc_resx_TR_AUTH_AJAX_ERROR_RETRY, cc_resx_TR_AUTH_AJAX_ERROR, cc_resx_TR_AUTH_AJAX_ERROR_REFRESH, 
cc_resx_TR_An_error_occurred_processing_payment, cc_resx_TR_VChat_Click_to_log_back_in, 
cc_resx_CDN_URL, cc_resx_SITE_URL
*/

//  
//  Author: Kevin Burkitt
//  Date:   2010-05-20
//  
//  Video Chat Helper/Init Functions
//
cc.videochat = function() {

    return {
        /*
        * CONFIG
        */
        camListStatusRefreshSeconds: 40,
        camListRefreshSeconds: 40,
        camListRefreshTimeoutMins: 15,      // Stop auto-upadting the cam list after 15 minutes (don't go on forever)
        camListRefreshStart: 0,             // Cam list auto-update start time
        camListUpdateUrl: '/live/',
        chatGateway: 'http://207.38.117.62/gateway/',
        chatUsername: '',
        chatPassword: '',
        chatHost: '',
        chatMode: '',

        init: function(container) {
            // Initializes Json Download & Page updates of video chat Online/Offline status
            cc.videochat.camListInitPageUpdates(container);

            jQuery('.cc-send-videochat-req', container).unbind('click').click(function() {
                var username = jQuery(this).attr('cc:username');
                cc.videochat.camListShowBookAModelOverlay(username);
            });


            jQuery('.cc-livechat-schedule-popup', container).unbind('click').click(function() {
                var modelid = jQuery(this).attr('cc:model');
                cc.ui.colorbox('/show-livechat-schedule/' + modelid + '/', function() {

                });
            });

            



           


            // jQuery('.cc-videochat-payment').each(function() {
            //     var value = jQuery(this).attr('cc:amount');
            // });
        },

        camListInitPageUpdates: function(container) {
            var trackingHosts = 0;
            var lastHost = '';

            // Search for hostid's - if more than 1 we'll update all, otherwise just the one
            jQuery('.cc-chat-online', container).each(function() {
                trackingHosts += 1;
                if (lastHost === '') {
                    lastHost = jQuery(this).attr('cc:hostid');
                } else {
                    if (jQuery(this).attr('cc:hostid') !== lastHost) {
                        // More than 1 host, init timed update for all hosts 
                        cc.videochat.camListInitHostStatusCheckTimer('');
                        return;
                    }
                }
            });

            if (lastHost !== '') {
                // 1 host: init timed update for this host only
                cc.videochat.camListInitHostStatusCheckTimer(lastHost);
            }

        },

        // 
        camListInitHostStatusCheckTimer: function(host) {
            var h = host;
            setTimeout(function() {
                cc.videochat.camListUpdateHostStatus(h);
            }, cc.videochat.camListStatusRefreshSeconds * 1000);
        },


        ShowLiveChatOverlayEasyCollect: function() {   
        
           
            cc.ui.colorbox('/live/buy-credits-overlay/', cc.auth.initAuthOverlay);

            return false;
        
        },


        camListUpdateHostStatus: function(host) {
            var h = host;
            var url = cc.videochat.camListUpdateUrl;

            if (typeof host !== 'undefined' && host !== '') {
                url = url + host + '/?format=json';
            }

            cc.ajax.getJSON(
                url,
                null,
                function(respData) {
                    if (typeof respData !== 'undefined' && typeof respData.data !== 'undefined') {
                        cc.videochat.camListUpdateStatusFromHostArray(respData.data);
                    }
                },
                function() {
                    // Complete - wait for delay then run again:
                    cc.videochat.camListInitHostStatusCheckTimer(h);
                }
            );
        },

        // Hide/Display page elements from returned json array
        camListUpdateStatusFromHostArray: function(hostArr) {
            jQuery('.cc-chat-online').each(function() {
                var showEle = false;
                var eleHostId = jQuery(this).attr('cc:hostid');
                for (var arrKey in hostArr) {
                    if (typeof hostArr[arrKey] !== 'undefined' && hostArr[arrKey].hostId === eleHostId && hostArr[arrKey].loggedIntoVideoChat === true) {
                        showEle = true;
                        break;
                    }
                }
                if (showEle === true) {
                    jQuery(this).show();
                } else {
                    jQuery(this).hide();
                }
            });

            jQuery('.cc-chat-offline').each(function() {
                var showEle = false;
                var eleHostId = jQuery(this).attr('cc:hostid');
                for (var arrKey in hostArr) {
                    if (typeof hostArr[arrKey] !== 'undefined' && hostArr[arrKey].hostId === eleHostId && hostArr[arrKey].loggedIntoVideoChat === false) {
                        showEle = true;
                    }
                }
                if (showEle === true) {
                    jQuery(this).show();
                } else {
                    jQuery(this).hide();
                }
            });

        },

        // Update the Cam Online/Offline list every X seconds
        camListInitAutoRefresh: function(url, targetId) {
            var u = url;
            var t = targetId;
            setTimeout(
                function() {
                    cc.videochat.camListRefresh(u, t);
                },
                (cc.videochat.camListRefreshSeconds * 1000)
            );
        },

        camListRefresh: function(url, targetId) {
            var u = url;
            var t = targetId;

            // Stop upadting after timeout mins
            var nowDate = new Date();
            if (cc.videochat.camListRefreshStart === 0) {
                cc.videochat.camListRefreshStart = nowDate.getTime();
            } else {
                if ((nowDate.getTime() - cc.videochat.camListRefreshStart) > (cc.videochat.camListRefreshTimeoutMins * 60 * 1000)) {
                    return;
                }
            }

            // Load Ajax
            cc.ajax.load(t, u, null, true, true);
        },

        camListShowBookAModelOverlay: function(username) {
            cc.ui.colorbox('/userprofile/send-videochat-request/' + username + '/', function() {
                // Init Response Form for Ajax Submit
                jQuery('#mail-form').unbind('submit').submit(function() {
                    return cc.userprofile.sendMailSubmit('#mail-form');
                });
            });
        },

        /************************************************
        *
        *  Esensual Flash Object Handlers
        *
        */
        initVideoChat: function(user, pass, host, mode) {

            cc.videochat.chatUsername = user;
            cc.videochat.chatPassword = pass;
            cc.videochat.chatHost = host;
            cc.videochat.chatMode = mode;

            jQuery('#live-head').css('height', '465px');
            jQuery('#videochat-container').html('<div id="videochat-video"></div><div id="videochat-chat"></div>');

            // Set up event handlers for IE
            if (jQuery.browser.msie) {
                if (jQuery('#cc-videochat-events').size() <= 0) {
                    jQuery('body').append('<script FOR="fvideo" EVENT="FSCommand" LANGUAGE="Jscript">fvideo_DoFSCommand(arguments[0],arguments[1]);</script>');
                    jQuery('body').append('<script FOR="fplayer" EVENT="FSCommand" LANGUAGE="Jscript">fplayer_DoFSCommand(arguments[0],arguments[1]);</script>');
                    jQuery('body').append('<div id="cc-videochat-events"></div>');
                }
            }

            // Set Volume
            //todo if (volumeSession.geti() == -1)
            //todo     volumeSession.set(16); //no previous volume setting, take initial

            var url = cc_resx_CDN_URL + "content/videochat/preloader.swf?account_id=" + cc_resx_VIDEOCHAT_ACCOUNT_ID;
            url += "&gateway_ip=" + cc.videochat.chatGateway;
            url += "&user=" + user;
            url += "&pass=" + pass;
            url += "&host_name=" + host;

            url += "&mode_request=" + mode;
            url += "&port=3000"; //todo + port.get();
            url += "&alerts=0";
            url += "&bypass=0";
            url += "&chat_swf=" + cc_resx_CDN_URL + "content/videochat/chat.swf";
            url += "&config_file=" + cc_resx_SITE_URL + "content/videochat-flashconfig.xml";

            var chatHtml = '<object id="fplayer" name="fplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
            chatHtml += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="100%">';
            chatHtml += ' <param name="movie" value="' + url + '">';
            chatHtml += ' <param name="quality" value="high">';
            chatHtml += ' <param name="loop" value="false">';
            chatHtml += ' <param name="scale" value="exactfit">';
            chatHtml += ' <param name="allowscriptaccess" value="always">';
            chatHtml += ' <param name="allowfullscreen" value="true">';
            chatHtml += ' <param name="wmode" value="transparent">';
            chatHtml += ' <param name="bgcolor" value="#000000">';
            chatHtml += ' <embed name="fplayer" src="' + url + '" width="100%" wmode="transparent" height="100%" loop="false" type="application/x-shockwave-flash"';
            chatHtml += ' pluginspage="http://www.macromedia.com/go/getflashplayer" bgcolor="#000000" quality="high" scale="exactfit" swLiveConnect="true" allowScriptAccess="always" allowFullScreen="true"></embed>';
            chatHtml += '</object>';

            jQuery("#videochat-chat").html(chatHtml);
        },

        changeChatMode: function(mode) {
            cc.videochat.initVideoChat(
                cc.videochat.chatUsername,
                cc.videochat.chatPassword,
                cc.videochat.chatHost,
                mode);
        },

        // CALLBACK: from the flash player once it receives the host's url from the gateway
        flashCallback_startVideo: function(url) {
            var movie = cc_resx_CDN_URL + "content/videochat/video.swf";
            movie += "?configFile=" + cc_resx_SITE_URL + "content/videochat-config.xml";
            movie += "&mediaElementWidth=320";
            movie += "&mediaElementHeight=240";
            movie += "&mediaElementBorderStrokeThickness=1";
            movie += "&mediaElementBorderStroke=#909090";

            movie += "&zoomBarMarginTop=5";
            movie += "&zoomBarStrokeThickness=1";
            movie += "&zoomBarStroke=#909090";
            movie += "&zoomBarHeight=26";
            movie += "&zoomBarImg=" + cc_resx_CDN_URL + "content/videochat/theme/images/zoombar.png";
            movie += "&zoomImg=" + cc_resx_CDN_URL + "content/videochat/theme/images/zoombar.png";
            movie += "&zoomImgWidth=0";

            movie += "&fullscreenImg=" + cc_resx_CDN_URL + "content/videochat/theme/images/fullscreen.png";
            movie += "&fullscreenImgWidth=30";

            movie += "&muteImg=" + cc_resx_CDN_URL + "content/videochat/theme/images/mute.png";
            movie += "&muteImgWidth=16";

            movie += "&sliderTrackImg=" + cc_resx_CDN_URL + "content/videochat/theme/images/slider1.png";
            movie += "&sliderTrackImgWidth=70";

            movie += "&sliderKnobImg=" + cc_resx_CDN_URL + "content/videochat/theme/images/sliderknob1.png";
            movie += "&sliderKnobImgWidth=30";
            movie += "&backgroundColor=#a8a8a8";

            movie += "&volume=16";
            movie += "&url=" + url;

            movie = movie.replace(/#/g, "0x"); // no # signs

            var chatVideoHtml = '<object id="fvideo" name="fvideo" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
            chatVideoHtml += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="100%" height="100%">';
            chatVideoHtml += ' <param name="movie" value="' + movie + '">';
            chatVideoHtml += ' <param name="quality" value="high">';
            chatVideoHtml += ' <param name="loop" value="false">';
            chatVideoHtml += ' <param name="scale" value="exactfit">';
            chatVideoHtml += ' <param name="allowscriptaccess" value="always">';
            chatVideoHtml += ' <param name="allowfullscreen" value="true">';
            chatVideoHtml += ' <param name="wmode" value="transparent">';
            chatVideoHtml += ' <param name="bgcolor" value="#000000">';
            chatVideoHtml += ' <embed name="fvideo" src="' + movie + '" width="100%" wmode="transparent" height="100%" loop="false" type="application/x-shockwave-flash"';
            chatVideoHtml += ' pluginspage="http://www.macromedia.com/go/getflashplayer" bgcolor="#000000" quality="high" scale="exactfit" swLiveConnect="true" allowScriptAccess="always" allowFullScreen="true"></embed>';
            chatVideoHtml += '</object>';

            jQuery("#videochat-video").html(chatVideoHtml);
        },

        // CALLBACK: from Esensual flash VIDEO object
        flashCallback_DoVideoCommand: function(command, args) {
            if (command === "volume") {
                //todo volumeSession.set(args); //0 - 100
            }
        },

        // CALLBACK: from Esensual flash CHAT object before StartMediaPlayer()
        flashCallback_DoChatCommand: function(command, args) {
            if (command === "hostVideoInfo") {
                jQuery("#videochat-video").html('');
            } else if (command === "port") {
                //port probe found this port so use it next time to speed up connection
                //todo port.set(args);
            } else if (command === "alerts") {
                //keep track of alerts settings in flash with session cookie
                //todo alerts.set(args);
            }
        },

        // CALLBACK: from Esensual flash object
        flashCallback_Message: function(msgId) {
            var messageStr = '';
            switch (msgId) {
                case '0':
                    messageStr = cc_resx_TR_VChat_Closed + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Redirecting_to_Live_Models + "</a>;";
                    setTimeout(function() {
                        location.href = "/live/";
                    }, 2000);
                    break;
                case '1':
                    messageStr = cc_resx_TR_VChat_Free_Chat_timed_out + "<br /><a onclick=\"location.reload(true); return false;\" href=\"#\" title=\"" + cc_resx_TR_Reload + "\">" + cc_resx_TR_VChat_Click_to_log_back_in + "</a>";
                    break;
                case '2':
                    messageStr = cc_resx_TR_VChat_Sorry_Im_offline_right_now + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Redirecting_to_Live_Models + "</a>;";
                    setTimeout(function() {
                        location.href = "/live/";
                    }, 2000);
                    break;
                case '3':
                    messageStr = cc_resx_TR_VChat_Sorry_Server_is_full_try_again_later + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Click_to_return_to_models_list + "</a>";
                    break;
                case '4':
                    messageStr = cc_resx_TR_VChat_Ive_gone_into_Private_Chat + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Click_to_return_to_models_list + "</a>";
                    break;
                case '5':
                    messageStr = cc_resx_TR_VChat_Ive_gone_into_Private_Chat + " <br /><a onclick=\"location.reload(true); return false;\" href=\"#\" title=\"" + cc_resx_TR_Reload + "\">" + cc_resx_TR_VChat_Click_to_call_again + "</a>";
                    break;
                case '6':
                    messageStr = cc_resx_TR_VChat_Host_did_not_answer + "<br /><a onclick=\"location.reload(true); return false;\" href=\"#\" title=\"" + cc_resx_TR_Reload + "\">" + cc_resx_TR_VChat_Click_to_call_again + "</a>";
                    break;
                case '7':
                    messageStr = cc_resx_TR_VChat_Account_balance_too_low;
                    break;
                case '8':
                    messageStr = cc_resx_TR_VChat_Username_is_already_logged_In;
                    break;
                case '9':
                    messageStr = cc_resx_TR_VChat_You_have_been_kicked + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Click_to_return_to_models_list + "</a>";
                    break;
                case '10':
                    messageStr = cc_resx_TR_VChat_Maximum_number_of_users_reached + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Click_to_return_to_models_list + "</a>";
                    break;
                case '11':
                    messageStr = cc_resx_TR_VChat_Sorry_my_room_is_full + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Click_to_return_to_models_list + "</a>";
                    break;
                case '12':
                    messageStr = cc_resx_TR_VChat_Cannot_connect_to_server + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Click_to_return_to_models_list + "</a>";
                    break;
                case '13':
                    messageStr = cc_resx_TR_VChat_you_have_exceeded_the_permitted_free_time + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Redirecting_to_Live_Models + "</a>;";
                    break;
                default:
                    messageStr = cc_resx_TR_VChat_Error_connecting_to_user + "<br /><a href=\"/live\" title=\"" + cc_resx_TR_VChat_Live_Video_Chat + "\">" + cc_resx_TR_VChat_Redirecting_to_Live_Models + "</a>;";
                    setTimeout(function() {
                        location.href = "/live/";
                    }, 2000);
                    break;
            }

            cc.videochat.showMessage(messageStr);

        },

        flashCallback_removeMediaPlayer: function() {
            // Does nothing
        },

        creditAuthIFrameAction: function(action) {
            switch (action) {
                case "paymentSuccess":
                    jQuery('#videochat-epochauthmask').remove();
                    jQuery('#videochat-epochauth').hide();
                    jQuery('.x_transactionid').html('');

                    // If chat video not displayed, reload the page:
                    if (jQuery('#videochat-video').size() <= 0) {
                        location.reload(true);
                    }
                    break;
                case "goToPayment":
                    jQuery('#videochat-epochauthmask').remove();
                    jQuery('#videochat-epochauth').hide();
                    jQuery('.x_transactionid').html('');
                    // jQuery....
                    break;
                case "goToLiveModels":
                    location.href = "/live/";
                    break;
                case "reEnterCCDetails":
                    jQuery('#videochat-epochauthmask').remove();
                    jQuery('#videochat-epochauth').hide();
                    jQuery('.x_transactionid').html('');
                    //
                    jQuery('.cc-epochPaymentPageForm').show();
                    jQuery('.cc-epochPaymentCreditOverlayForm').hide();
                    break;

            }


        },

        purchaseInProcess: false,
        purchaseError: false,
        epochCreditsTransactionStart: function(form) {
            // if (typeof cc.videochat.purchaseInProcess != 'undefined' && cc.videochat.purchaseInProcess === true) {
            //     return false;
            // }
            cc.videochat.purchaseInProcess = true;
            cc.videochat.purchaseError = false;

            try {

                var f = form;

                var transactionId = jQuery('.x_transactionid', f).val();
                if (typeof transactionId !== 'undefined' && transactionId !== '') {
                    cc.videochat.formSubmit(f);
                    return false;
                }

                var close_amount = jQuery('.close_amount', f).val();
                if (typeof close_amount === 'undefined' || close_amount === '') {
                    cc.ui.showModalErrorMessage(cc_resx_TR_Bad_or_missing_close_amount);
                    return false;
                }

                var page = cc.helpers.encodeQsParam(location.href);
                var url = '/payments/epoch/credits/start/' + close_amount;

                // cc.log('Attempting to buy \'Credits\' on page: ' + page + '');

                cc.ajax.getJSON(url, {}, function(resp, textStatus) {
                    try {
                        if (typeof resp === 'undefined') {
                            cc.ui.showModalErrorMessage(cc_resx_TR_An_error_occurred_processing_payment);
                            cc.videochat.purchaseError = true;
                        } else {
                            if (resp.success !== true) {
                                // Some Server Failure or Bad Id Encountered In Processing (bad; shouldn't happen)
                                cc.ui.showModalErrorMessage(resp.message);
                                cc.videochat.purchaseError = true;
                            }
                            else {
                                // Processed ok
                                if (resp.message !== '') {
                                    // We have transaction id:
                                    jQuery('.x_transactionid', f).val(resp.message);
                                    jQuery('.x_url', f).val(location.href);
                                    cc.videochat.purchaseInProcess = false;

                                    cc.videochat.formSubmit(f);
                                    return false;
                                }
                                else {
                                    // Or just display resp.message
                                    cc.ui.showModalErrorMessage(cc_resx_TR_AUTH_AJAX_ERROR_RETRY);
                                    cc.videochat.purchaseError = true;
                                }
                            }
                        }
                    }
                    catch (e) {
                        cc.ui.showModalErrorMessage(cc_resx_TR_AUTH_AJAX_ERROR + ":" + e);
                        cc.videochat.purchaseError = true;
                    }
                },
                function() {
                    cc.videochat.purchaseInProcess = false;
                });
            }
            catch (e) {
                cc.ui.showModalErrorMessage(cc_resx_TR_AUTH_AJAX_ERROR_REFRESH);
                cc.videochat.purchaseInProcess = false;
            }

            return false;
        },


        formSubmit: function(form) {
            var f = form;

            // INIT iFRAME OVERLAY
            jQuery('#videochat-epochauthmask').remove();
            jQuery('body').append('<div id="videochat-epochauthmask"></div>');
            jQuery('#videochat-epochauth').show();
            jQuery('#videochat-epochauthmask,#vc-ea-closelink').unbind('click').click(function() {
                jQuery('#videochatIframe').attr('src', 'about:blank');
                jQuery('#videochat-epochauthmask').remove();
                jQuery('#videochat-epochauth').hide();
            });

            jQuery(f).submit();
        },


        openToplessChat: function(user, pass, host, mode) {
            // FIRST KILL PLAYER
            cc.videochat.showMessage(cc_resx_TR_Please_wait_for_the_host_to_accept);

            if (mode > 2) {
                jQuery('.cc-topless-chatbtn').hide();
            } else {
                jQuery('.cc-topless-chatbtn').show();
            }
            cc.videochat.initVideoChat(user, pass, host, mode);
        },

        showMessage: function(messageStr) {
            try { jQuery('#videochat-chat').html('').hide(); } catch (ec) { }
            try { jQuery("#videochat-video").html('').hide(); } catch (ev) { }
            jQuery('#live-head').css('height', '300px');
            jQuery("#videochat-container").html('<div class="messages">' + messageStr + '</div>');
        }

    };

} ();


// CALLBACK: from the flash player once it receives the host's url from the gateway
function StartMediaPlayer(url) {
    cc.videochat.flashCallback_startVideo(url);
}

// CALLBACK: from Esensual flash VIDEO object
function fvideo_DoFSCommand(command, args) {
    cc.videochat.flashCallback_DoVideoCommand(command, args);
}

// CALLBACK: from Esensual flash CHAT object before StartMediaPlayer()
function fplayer_DoFSCommand(command, args) {
    cc.videochat.flashCallback_DoChatCommand(command, args);
}

// CALLBACK: from Esensual flash CHAT object
function message(msgId) {
    cc.videochat.flashCallback_Message(msgId);
}

// CALLBACK: from Esensual flash CHAT object
function RemoveMediaPlayer() {
    cc.videochat.flashCallback_removeMediaPlayer();
}

// CALLBACK: from Post Auth
function videochatCreditAuthIFrameAction(action) {
    cc.videochat.creditAuthIFrameAction(action);
}


