/* BLOCK_CATEGORY */
$(function() {
	$(".catsTable td a").append("<b></b>");
	$(".catsTable td").each(function() {
	var linkText = $(this).find("span").html();
	$(this).find("b").show().html(linkText); 
	}); 
});

$(function() {
	$("#hicons li a").hover(function(){
		$(this).animate({bottom:'+=6'},100);

	}, function() {
		$(this).animate({bottom:'-=6'},100);
	});
});
	
	
$(function() {
	$("#link_reload").click(function(){
		window.location.reload();
	});
});
	
$(document).ready(function(){
	$(".b_p_link_prof, .b_p_link_prof2").click(function () {
		if ($.browser.msie) {$(".cpop").css("display","block")} else {
		$(".cpop").fadeIn("slow")}
	});
	$("span.cpop_close").click(function () {
		if ($.browser.msie) {$(this).parent().parent().css("display","none")} else {
		$(this).parent().parent().fadeOut("slow")}
	});
});


	
$(document).ready(function(){
	$("#open_popsearch").click(function () {
		if ($.browser.msie) {$(".cpop_search").css("display","block")} else {
		$(".cpop_search").fadeIn("slow")}
	});
});

/* forum title */

$(function() {
	$(".gTableTop").wrapInner('<div class="gTableTop_title"></div>');
	$(".gTableTop_title").append("<span></span>");
	$(".forumNameTd").wrapInner('<div class="forum_on_arrow_in"></div>');
});
	
$(function() {
	$(".switches tr td:nth-child(2)").addClass("switches_first");
});
	
// VSPOILER
$(function() {
	$(".vspoiler_toogle").click(function () {
		$(this).toggleClass("vspoiler_toogle_minus");
		$(this).parent().parent().parent().find('.vspoiler_cont').slideToggle("slow");
	});
});


// Paginator
$(function() {
		$(".pag_prev, .pag_next").parent().parent().addClass("pag_null");
});
	
// PLUGIN drag_and_drop
var moveState = false;
var x0, y0;
var divX0, divY0;
function defPosition(event) {
	var x = y = 0;
	if (document.attachEvent != null) {
		x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
		y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
	}
	if (!document.attachEvent && document.addEventListener) {
		x = event.clientX + window.scrollX;
		y = event.clientY + window.scrollY;
	}
	return {x:x, y:y};
}
function initMove(div, event) {
	var event = event || window.event;
	x0 = defPosition(event).x;
	y0 = defPosition(event).y;
	//divX0 = parseInt(div.style.left);
	//divY0 = parseInt(div.style.top);
	divX0 = absPosition(div).x;
	divY0 = absPosition(div).y;
	moveState = true;
}
document.onmouseup = function() {
	moveState = false;
}
function moveHandler(div, event) {
	var event = event || window.event;
	if (moveState) {
		div.style.left = divX0 + defPosition(event).x - x0 + 'px';
		div.style.top = divY0 + defPosition(event).y - y0 + 'px';
	}
}
function makeFastDrag(div, event) {
	document.onmousemove = function(event) {
		moveHandler(div, event);
	}
}
function absPosition(obj) {
	var x = y = 0;
	while(obj) {
		x += obj.offsetLeft;
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return {x:x, y:y};
}
