function goChat(roomid, uid, culture, redirectUrl){
    Chat.Parent.sendCommand('room', {'room':roomid, 'uid':uid, 'langId':culture});
    if(redirectUrl)  {
        window.setTimeout(function(){ window.location=redirectUrl; }, 3000);
    }
    return false;
}
Chat.Parent.init();    

// disable password fields validator when room is public
function chatFormPasswdField(enable){
    jQuery('input[type="password"]').each(function(){
        if(enable)  jQuery(this).data('oldval',jQuery(this).val()).val('').focus().blur();
        else jQuery(this).val(jQuery(this).data('oldval')).focus().blur();
    });    
}

// set highlight field
jQuery(function(){

    // clipboardSet
    function clipboardSet(field){
        var fld = jQuery(field);
        jQuery('#'+fld.attr('id') + '_copy').each(function(){
            if(typeof this['setClipboard'] == 'function')this.setClipboard(fld.val());
        });
    }
    
    // highlight function
    var chatHighlight = function(evt){
        try {
            evt.target.select();
            clipboardSet(evt.target);
        } catch(e) {}
    };
    
    // attach events
    jQuery('.highlighter')
        .attr('readonly','readonly')
        .focus(chatHighlight)
        .click(chatHighlight)
        .keypress(chatHighlight);
    
});

