function getPage(page)
{
    $.ajax(
    {
        type: "GET",
        url: base_url+"ajax/"+page,
        data: "",
        dataType: "html",
        success: function(content)
        {
            $("#info").fadeOut(400, function()
            {
                $(this).empty().html(content).fadeIn(400);

                $("div.pagination a").unbind().bind('click', function()
                {
                    page = $(this).attr('href').split('/');
                    if (page.length == 5)
                    {
                        getPage(page[3]+'/'+page[4]);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                });
                
                if ($('#flashcow').length == 1)
                {
                    $('#flashcow')[0].playAnimation(Math.floor(Math.random() * 4));
                }
            });
        }
     });
}

function put_email(obj, a, b)
{
	if (a.length > 0 && b.length > 0)
	{
		var email = a + '@' + b;
		$('#'+obj).replaceWith('<a class="mail" href="mailto:'+email+'" >' + email + '</a>');
	}
}

function showPopup(page)
{
	window.open(page, 'preview', 'directories=no, menubar=no, location=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no, width=450, height=450, left=30, top=30');
	return false;
}
