/* <![CDATA[ */
$(document).ready(function(){
$("#dropline li.current").children("ul")	.css("left", "0px")
$("#dropline li.current").children(":first-child").css("color", "#000")
$("#dropline li").hover(function(){
	if(this.className.indexOf("current") == -1)  {
		getCurrent = $(this).parent().children("li.current:eq(0)");
		if(this.className.indexOf("top") != -1)  {
			$(this).children("a:eq(0)").css("color","#069");
			$(this).toggleClass("sem");
		}
		else {
			$(this).children("a:eq(0)").css("color","#000");
		}
		if (getCurrent = 1 ) {
			$(this).parent().children("li.current:eq(0)").children("ul").hide();
		}
	$(this).children("ul:eq(0)").css("left", "0px").show();
	}
},function(){
	if(this.className.indexOf("current") == -1)  {
		getCurrent = $(this).parent().children("li.current:eq(0)");
		if(this.className.indexOf("top") != -1) {
			$(this).children("a:eq(0)").css("color","#fff");
			$(this).toggleClass("sem");
		} else {
			$(this).children("a:eq(0)").css("color","#063A76");
		}
		if (getCurrent = 1 ) {
			$(this).parent().children("li.current:eq(0)").children("ul").show();
		}
$(this).children("ul:eq(0)").css("left", "-99999px").hide();
	}
});
});
$(document).ready(function(){
	$("#login_link").click(function(e){
		var overlay = $("#overlay");
		var w = $(window).width();
		var h = $(window).height();
		overlay.css('width', w);
		overlay.css('height', h);
		overlay.css('display','block');
		$("#login_result").html('').removeClass();
		$("#login_box").css('display','block');
		e.preventDefault();
	});
	$("#close_btn").click(function(e){
		$("#overlay").css('display','none');
		$("#login_box").css('display','none');
	});
	$("#login_form").submit(function() {
	        $("#login_result").removeClass().addClass('process').text('Идет проверка...').fadeIn(1000);
	        $.post($("#login_form").attr('action'), { username:$('#username').val(),password:$('#password').val(),submit:$('#submit').val(),remember:$('#remember').val(),rand:Math.random() } ,function(data) {
				if(data==1) {
					//  
					$("#login_result").fadeTo(200,0.1,function() {
					$(this).html('Все верно! Подождите, сейчас вы будете перемещены..').removeClass().addClass('success').fadeTo(900,1,
						function() {
							document.location='';
						});
					});
				} else {
					//  
					$("#login_result").fadeTo(200,0.1,function(){
						$(this).html('Неверный логин или пароль').removeClass().addClass('error').fadeTo(900,1);
					});
				}
			});
			return false;//    (  )
	});
});
	function footcom(t, t2){
		var comment = document.getElementById('comments_content');
		if (document.selection) {
			comment.focus();
			sel = document.selection.createRange();
			sel.text = t + sel.text + t2;
			comment.focus();
		}
		else if (comment.selectionStart || comment.selectionStart == '0') {
			var startPos = comment.selectionStart;
			var endPos = comment.selectionEnd;
			var cursorPos = endPos;
			var scrollTop = comment.scrollTop;
			if (startPos != endPos) {
				comment.value = comment.value.substring(0, startPos)
							  + t
							  + comment.value.substring(startPos, endPos)
							  + t2
							  + comment.value.substring(endPos, comment.value.length);
				cursorPos = startPos + t.length
			}
			else {
				comment.value = comment.value.substring(0, startPos)
								  + t
								  + t2
								  + comment.value.substring(endPos, comment.value.length);
				cursorPos = startPos + t.length;
			}
			comment.focus();
			comment.selectionStart = cursorPos;
			comment.selectionEnd = cursorPos;
			comment.scrollTop = scrollTop;
		}
		else {
			comment.value += t + t2;
		}
}

function changeSize(elm, _size, class_name)
{
	document.getElementById(elm).className = class_name + ' ' + class_name + '_' + _size;
}
