$(function(){
	$(".vacancy-name").each(function(){
		$(this).bind('click',function(){
			$(".vacancies-list .vacancy-about").each(function(){
				$(this).hide();
				$(this).parent().css("position","static")
			});
			$(this).parent().css("position","relative")
			$(this).next().fadeIn("fast");
			return false;
		});
	});
	$(".vacancy-about > a").each(function(){
		$(this).bind('click',function(){
			$(this).parent().fadeOut("fast");;
			return false;
		});
	});
	var def = "def1";
	var img = $("#about-ktk > img");
	$("#about-ktk area").each(function(n){
		var name = "bg" + n;
		$(this).hover(function(){
			img.addClass(name);
		},
		function(){
			img.removeClass(name);
		});
		$(this).click(function(){
			img.removeClass(def);
			img.addClass("def" + n);
			def = "def" + n;
			return false;
		});
	});
	$.fn.fadeToggle = function(speed, easing, callback){
		return this.animate({opacity: 'toggle'}, speed, easing, callback);
	};
	$("#wishes").hide();
	$("div.wishes").click(function(){
		$("#wishes").fadeToggle();
	});
	$("#wishes h2 a").click(function(){
		$("#wishes").fadeToggle();
		return false;
	});
	$("#application .jScroll").jScrollPane({
		showArrows: true,
		scrollbarWidth: 17,
		scrollbarArrow: 19
	});
	$("body.contacts .content .wrap").jScrollPane({
		showArrows: true,
		scrollbarWidth: 17,
		scrollbarArrow: 19
	});
	$("#application").hide();
	reinitialiseScrollPane = function(){
		$("#application .jScroll").jScrollPane({
			showArrows: true,
			scrollbarWidth: 17,
			scrollbarArrow: 19
		});
	}
	$("#application h2 span").click(function(){
		$("#application").fadeOut();
	});
	$("a.complete_form_online").click(function(){
		$("#application").fadeToggle();
		return false;
	});
	setHandlers = function(){
		var inputs = $("body.price #price_ajax_div table tr td:first input[type=checkbox]");
		inputs.click(function(){
			$(this).parents("tr").toggleClass("selected");
		});
		$("body.price #price_ajax_div table tr th:first input[type=checkbox]").click(function(){
			inputs.each(function(){
				$(this).parents("tr").toggleClass("selected");
				$(this).attr("checked", !$(this).attr('checked'));
			});
		});
		$("#network .content a").lightBox({imageLoading:'/~styles/default/~img/lightbox-ico-loading.gif'});
	}
	$("#about-menu area").each(function(){
		var curClass = $(this).attr("class");
		$(this).click(function(){
			$("#about-menu area").each(function(){
				var className = $(this).attr("class");
				$("div." + className).css("display","none");
			});
		$("div." + curClass).css("display","block");
		});
	});
	setHandlers();
});

