﻿var isFileOnline = null;
function IniChat() {
    NewEventInRoom();
    setInterval("NewEventInRoom();", 12000);
    $('.jqChangeRoom').live('click', function () {//live=>bug: not raised after partial postback
        $('.jqcurrentChatDiv').css("background-image", "url(/Img/Chat_NONACTIF.jpg)");
        $('.jqcurrentChatDiv').css("background-repeat", "no-repeat");
        $(this).parent().css("background-image", "url(/Img/Chat_ACTIF.jpg)");
        if ($(this).prev().attr("class") == "jqNewChat")
            $(this).prev().remove();
    });
}

function NewEventInRoom() {
    if (typeof (Alertes) != 'undefined')
        Alertes.CheckNewEventInRoom(SucessEventInRoom, null, null);
}

function SucessEventInRoom(result, eventArgs) {
    if (result != null) {
        try {
            for (var icpt = 0; icpt < result.length; icpt++) {
                $(".jqhfRoom").each(function () {
                    if ($(this).val() == result[icpt]) {
                        var InsertMe = '<img src="/Img/Chatstar.gif" style="position:absolute;" class="jqNewChat" />';
                        $(InsertMe).insertBefore($(this).prev());
                    }
                });}}
        catch (e) { ; }
    }
}

function CloseRoom() {
    $("#ctl00_myTChat_ibIMPublic").click();
    return true;
}

function OpenChatPopUp() {
    try {
        var newWin = window.open("../MyAccount/ChatPopUp.aspx", "TChatRnouX", "height=600, width=880, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no")
        if (newWin.window.focus) newWin.window.focus();
        return newWin;
    }
    catch (exe) { ; }
}

function OpenChatPage(viewUrl) {
    if (window.opener != null && !window.opener.closed) {
        window.opener.focus();
        window.opener.location.href = viewUrl;
        window.focus();
    }
    else
        window.open(viewUrl);
    return false;
}

