/*
 * chatwindow.js
 * A little chat box slidy kind of thing, the less-annoying version.
 *
 * There is server-side code that works with this to prevent displaying this box on every page.
 *
 * Written by Jeff Parker - jeffreyp(at)codero.com
 *
 * Props to the jQuery community for guidance and support
 *
 * $Id: chatwindow.js 1470 2009-08-10 15:33:48Z codero $
 */

    function wait4it()
    {
         $('#chat-pop').animate({
                bottom: 0
            }, 2500);
	return false;
    }

    //customer doesn't want to talk - leave the screen quickly!
    function getOuttaHere()
    {
        $('#chat-pop').animate({
                bottom: '-313px'
            }, 500);
    }

    //customer ignored this box - leave slowly, as if sulking, and go to the land of abandoned chat-boxes (offscreen)
    function getOuttaHereKindaSlow()
    {
        $('#chat-pop').animate({
                bottom: '-313px'
            }, 2500);
    }
    
$(document).ready(function()
    {
        //play initial animation
        setTimeout("wait4it()",10000);

        //give peeps 30 seconds to respond or go away
        setTimeout("getOuttaHereKindaSlow()",30000);

        //nobody wants to chat :(
        $('.bye').click(function()
	{
            getOuttaHere();
	    return false;
	});

         //a great success. someone wants to talk to us :)
        $('.hi').click(function()
	{
            popitup2('/chat/');
            getOuttaHere();
	    return false;
	});
	return false;
    });
