function msend()
{
    var email;
    email = '6610139';
    email = email + '@';
    email = email + 'mail.ru';
    open("mailto:"+email ,"www","")
}

function msend2()
{
    var email;
    email = 'info';
    email = email + '@';
    email = email + 'fec-tc.ru';
    open("mailto:"+email ,"www","")
}
function msend3()
{
    var email;
    email = '7405582';
    email = email + '@';
    email = email + 'mail.ru';
    open("mailto:"+email ,"www","")
}
$(document).ready(function() {
	$('.module.menu_tree ul li ul').each(function(i) { // Check each submenu:
		if ($.cookie('submenuMark-' + i)) {  // If index of submenu is marked in cookies:
			$(this).show().prev().removeClass('collapsed').addClass('expanded'); // Show it (add apropriate classes)
		}else {
			$(this).hide().prev().removeClass('expanded').addClass('collapsed'); // Hide it
		}
		$(this).prev().addClass('collapsible').click(function() { // Attach an event listener
			var this_i = $('.module.menu_tree ul li ul').index($(this).next()); // The index of the submenu of the clicked link
			if ($(this).next().css('display') == 'none') {
				$(this).next().slideDown(200, function () { // Show submenu:
					$(this).prev().removeClass('collapsed').addClass('expanded');
					cookieSet(this_i);
				});
			}else {
				$(this).next().slideUp(200, function () { // Hide submenu:
					$(this).prev().removeClass('expanded').addClass('collapsed');
					cookieDel(this_i);
					$(this).find('ul').each(function() {
						$(this).hide(0, cookieDel($('.module.menu_tree ul li ul').index($(this)))).prev().removeClass('expanded').addClass('collapsed');
					});
				});
			}
		return false; // Prohibit the browser to follow the link address
		});
	});
});
function cookieSet(index) {
	$.cookie('submenuMark-' + index, 'opened', {expires: null, path: '/'}); // Set mark to cookie (submenu is shown):
}
function cookieDel(index) {
	$.cookie('submenuMark-' + index, null, {expires: null, path: '/'}); // Delete mark from cookie (submenu is hidden):
}
function addButtonUp() {
	// элемент-родитель
	var body = document.getElementsByTagName('body');

	// новый элемент
	var element = document.createElement('div');
	element.className           = 'buttonUp';
	element.innerHTML           = 'Наверх страницы';

	element.style.background    = 'none repeat scroll 0 0 #2A7695';
	element.style.borderRadius  = '7px 0 0 7px';
	element.style.cursor        = 'pointer';

	element.style.borderBottom  = '1px solid #083C52';
	element.style.borderTop     = '1px solid #083C52';
	element.style.borderLeft    = '1px solid #083C52';

	element.style.position      = 'fixed';
	element.style.bottom        = '50%';
	element.style.right         = '0px';

	element.style.color         = '#FFFFFF';
	element.style.padding       = '10px';
	

	// добавление
	body[0].appendChild(element);
}
function checkButtonUp(){
	IE='\v'=='v';
	var doctype = document.doctype ? document.doctype : /CSS/.test(document.compatMode)&&document.getElementsByTagName('!')[0].data;
	if(doctype)
	{
		if(document.documentElement.scrollTop < 2000)
			$('.buttonUp').fadeOut("fast");
		else
			$('.buttonUp').fadeIn("fast");
	}
	else
	{
		if(document.getElementsByTagName('body')[0].scrollTop < 2000)
				$('.buttonUp').fadeOut("fast");
		else
			{
				if(IE)
				{
					var top = document.getElementsByTagName('body')[0].scrollTop + (document.getElementsByTagName('body')[0].clientHeight / 2) + "px";
					$('.buttonUp').css('position', 'absolute');
					$('.buttonUp').css('top', top);
				}
				$('.buttonUp').fadeIn("fast");
			}
	}
}
//Контролируем кнопку скролла наверх
$(document).ready(function() {
		checkButtonUp();
	$(window).scroll(function(){
		checkButtonUp();
	});
});
