function popUp(agentID, message){
    jQuery(document).ready(function(){
        var writeText = message;
        var popupDuration = 5000;
        var textDuration = (writeText.length * 150) + popupDuration;
        window.setTimeout("popupChat("+agentID+")", popupDuration);
        window.setTimeout("chatText('"+message+"')", textDuration);
        
    })
}

function popupChat(agentID){
    jQuery('#popup').slideDown(1000, function(){
    });
    
    /*$('.chat-image').find('img').load(function(){
        $('.chat-image').find('img').attr('src', 'getimage.php?webcam=1&agent=' + agentID + '&hash=' + new Date().getTime());
    });
    
    $('.chat-image').find('img').attr('src', window.location.href + '?webcam=1&agent=' + agentID + '&hash=' + new Date().getTime());
    $('.chat-image').find('img').load();*/
    //$('.chat-image').css('width', '100px');	
}

function chatText(message){
    var cssObj = {
        'overflow-x': 'hidden',
        'overlfow-y': 'scroll'
    }
    jQuery('#chat-text').html('<div class="chat-icon"></div><div>' + message + '</div>');
    jQuery('#chat-text').css(cssObj)
    jQuery('#chat-text').effect('pulsate');
}

