$(document).ready(function()
{
    $('#menu_holder div.menu_link_holder, #menu_holder a.no_dropdown').hoverIntent({
	over: function() {
	    $('#menu_holder .menu_dropdown, #menu_holder .menu_shadow').hide();
	    $(this).prev().show();
	    $('.menu_dropdown', $(this)).show();
	},
	interval: 0,
	out: function() {
	    $(this).prev().hide();
	    $('.menu_dropdown', $(this)).hide();
	},
	timeout: 250
    });

    $("span[tip]").tooltip({
	bodyHandler: function() {
	    return $(this).attr("tip");
	},
	track: true,
	top: 15,
	left: 3
    });

    $(".tip").tooltip({
	bodyHandler: function() {
	    return $(this).attr("tip");
	},
	showURL: false,
	track: true,
	top: 15,
	left: 3
    });

    $("#revent").click(function()
    {
	$.get("revents.php", {
	    code: $(this).attr("code"),
	    eid: $(this).attr("eid")
	}, function(data)

	{
	    $("#retxt").html(data);
	});
    });

    $('#bookmarkclose').click(function()
    {
	$('#bookmark').css({
	    visibility: "hidden"
	});
    });

    $('#addbookmark').click(function()
    {
	$('#bookmark').center();
	$('#bookmark').css({
	    top: "200px",
	    visibility: "visible"
	});
    });

    $('#bookmarkbutton').click(function()
    {
	$("#bookmarkbutton").attr("disabled","disabled");
	$.get("bookmark_save.php", {
	    url: $('#bookmarkurl').val(),
	    title: $('#bookmarkname').val()
	}, function()
	{
	    $("#bookmarkbutton").removeAttr("disabled");
	    $('#bookmark').css({
		visibility: "hidden"
	    });
	});
    });

});

jQuery.fn.center = function()
{
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( 800 - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

