$(document).ready(function(){

//get forum post
$('.f_details').click(function(){
   $(this).next().slideDown('slow', function(){
   $('.f_name:visible').not(this).slideUp('200');
   });
});

//gallery
$("#thumbs img").fadeTo("def", 0.5);

$("#thumbs img").click(function () {
	  $("#largeImg img").fadeIn(1000);
      $(this).fadeTo("def", 1);
    });
$("#thumbs img").not('.add_thumbs').click(function(){
var largePath = $(this).attr("src");
$("#largeImg img").attr({ src: largePath }); return false;
	});

// login form
//$(".login_form").hover(function () {
//$(".login_form_name, .login_form_pass").hide("fast");
//}, function() {
//$(".login_form_name, .login_form_pass").show("fast");
//});
$(".login_form input").focus(function () {
$(".login_form_name, .login_form_pass").hide();
});

// button
$(".button_img img").click(function () {
	  $(".button_code").slideToggle('200');
    });

// pr links
$("input[readonly]").click(function () {
	  $(this).select(); return false;
    });
// pr links
$("textarea[readonly]").click(function () {
	  $(this).select(); return false;
    });
$(".footer_stats,.ffooter_stats").fadeTo("slow", 0.3);

// comments
var commForm = $(".cTop a:last").attr("href");
var ent = $(".cTop a:last").attr("name");
$(".comm_more a").attr({ href: ent });

$(".comm_more").click(function (event) {
 var name = $(this).prev().find("b").text();
$("textarea[name='message']").val("[b]"+name+"[/b], ");
event.preventDefault();
});

// Add panel: images
$("input[name='but_1']").click(function () {
$("textarea[name='message']").val('<div id="thumbs">$IMAGE1$</div><div id="largeImg">$IMAGE1$</div>');
    });
$("input[name='but_2']").click(function () {
$("textarea[name='message']").val('<div id="thumbs">$IMAGE1$$IMAGE2$</div><div id="largeImg">$IMAGE1$</div>');
    });
$("input[name='but_3']").click(function () {
$("textarea[name='message']").val('<div id="thumbs">$IMAGE1$$IMAGE2$$IMAGE3$</div><div id="largeImg">$IMAGE1$</div>');
    });
$("input[name='but_4']").click(function () {
$("textarea[name='message']").val('<div id="thumbs">$IMAGE1$$IMAGE2$$IMAGE3$$IMAGE4$</div><div id="largeImg">$IMAGE1$</div>');
    });
$("input[name='small']").click(function () {
$("textarea[name='brief']").val('$IMAGE5$');
    });
$("input[name='text']").click(function () {
$("textarea[name='message']").val('<div class="content_pad"></div>');
    });
// feedback
var fb_l = $(".fb_lm").height();
var fb_r = $(".fb_rm").height();

// open fb
$(".fb_lm img").click(function () {
	  $(".fb_container").animate({ left: "-55px" }, 50, function () {$(".fb_rt, .fb_rm, .fb_rb").show();});

      if (fb_l > fb_r) {
	     $(".fb_rm").animate({height: fb_l}, 200);
      } else {
	     $(".fb_lm").animate({height: fb_r}, 200);
      }

$(".fb_lb img").show();

});

// close fb
$(".fb_lb img").click(function () {
         $(".fb_rt, .fb_rm, .fb_rb").hide();
         $(".fb_container").animate({ left: "-5px" }, 50);
         $(".fb_lb img").hide();
         $(".fb_lm").animate({height: "46px"}, 200);
});

// modal
function jmodal(){
$(".m_overlay").fadeTo("fast", 0.5);
$(".m_overlay").fadeIn("fast", function(){
	$(".m_container").show();
	});
var m_height = $(".m_content").height();
var m_width = $(".m_content").width();

$(".m_container").animate({marginBottom: m_height*2}, 100);
$(".m_content").slideDown("slow");

$(".m_close").click(function(){
	$(".m_container").hide("fast", function(){
	$(".m_overlay").hide();
	});
});
};

// forum [оформлено]
$('.threadDescr:contains("[Оформлено]")').css('color','#EE5400');

//uid fade
$(".uid_block").hover(function(){
$(this).fadeTo("fast", 1);
}, function(){
$(this).fadeTo("fast", 0.5);
})

});