$(document).ready(function()
{
	$("#menu_top").mouseenter(function()
	{
		//$("#main").animate({height:'200px'}, 1500 );
		$("#links").slideDown(1000)


	});
	$("#main").mouseenter(function()
	{
		//$("#main").animate({height:'400px'}, 1500 );
		$("#links").slideUp(1000);
	});
	
	$(".tm-item a").click(function()
	{
		if($(this).parent().attr("id")!="active-"+this.className)
		{
			$(".tm-item a").each(function (i)
			{
				$(this).removeAttr("id");
				$(this).parent().removeAttr("id");
			});
			$(this).parent().attr("id","active-"+this.className);
			$(this).attr("id","a-" + this.className);
		}
		else
		{
			$(this).removeAttr("id");
			$(this).parent().removeAttr("id");
		}
	});	
});


function swapCaptcha(options){
    options = options || {};

    var captcha_id = options.captcha_id;
    var captcha_img = options.captcha_img;
    var captcha_fld = options.captcha_fld;

    $.post('/rpc.html', 
            { "proc": "changeCaptcha", "current_captcha_id": captcha_id }, 
            function(data){
                var $captcha_img = $(captcha_img);
                var $captcha_fld = $(captcha_fld);
                var new_captcha_id = data.captcha_id;

                $captcha_img.attr("src", "/captcha/"+new_captcha_id+".png");
                $captcha_fld.val(new_captcha_id);
            },
            "json"
          );
}

