
	function doresize(){
		var w, k, c, cw, o;
		w = k = c = 0;
		cw = $('#content').width();
		$('#mainmenu ul li').css('width','100%');
		$('#mainmenu ul li a').each(function(i, val) {w = k+ $(this).width();k = w;c++;	});
		o = Math.floor((cw - w)/(c+1));
		$("#mainmenu").css('margin-left','54px');
		$("#mainmenu").css('margin-right','0px');
		$('#mainmenu ul li').each(function(i, val) {$(this).css('width',$(this).find('a').width()+'px');
			$(this).css('margin-right',o+'px');});
		//$("#mainmenu ul li").css('width',o+'px');
		 window.onload = function(){ doresize(); }
   }
   function smain(no){
		if(no == 2){
			$('#mcp').hide();
			$('#mcp2').show();
			$('.tab1').removeClass('tlb');
			$('.tab1').addClass('tlbn');
			$('.tab2').removeClass('tlbn');
			$('.tab2').addClass('tlb');
		}
		if(no == 1){
			$('#mcp2').hide();
			$('#mcp').show();
			$('.tab2').removeClass('tlb');
			$('.tab2').addClass('tlbn');
			$('.tab1').removeClass('tlbn');
			$('.tab1').addClass('tlb');
		}
   }
	function ppkfix(){
		$('.ppkgroup').each(function(i, val) {
			var last;
			$(this).find('.ppk').each(function(i,val){
				$(this).css('float','left');
				last = $(this);
			});			
		});
	}   
	function showmemore(){
		$('span.more').hide();
		
		$('.answer').each(function(i, val) {
			answer = $(this);
			$(this).find('span.more').each(function(){
				$(this).hide();
				answer.find('.morebtn').each(function(){
					$(this).html('<span href="#" class="showmemore">Развернуть</span>');
				});
				
			});
		});
		
		$('.ans').each(function(i, val) {
			answer = $(this);
			$(this).find('span.more').each(function(){
				$(this).hide();
				answer.find('.morebtn').each(function(){
					$(this).html('<span href="#" class="showmemore">Развернуть</span>');
				});
				
			});
		});
		
		$('.showmemore').click(function(){
			s = $(this);
			s.parent().parent().find('span.more').each(function(){
				if($(this).css('display') == 'none'){
					$(this).show();
					s.html('Свернуть');
				}else{
					$(this).hide();
					s.html('Развернуть');
				}
			});
		});
	}
	function inputformhide(){
		$('input.inpname').focus(function(){
			if($(this).attr('value') == 'Ваше имя')
				$(this).attr('value', '') ;
		});
		$('input.inpcontact').focus(function(){
			if($(this).attr('value') == 'Контактный телефон')
				$(this).attr('value', '') ;
		});
		$('textarea.inptrouble').focus(function(){
			if($(this).html() == 'Опишите Вашу проблему')
				$(this).html('');
		});
	}
	function popupform(){
		//$('body').html($('body').html() + '<div id="overlay" ></div><div id="orderformcont" style="display: none"><div id="clsfrm"></div><div id="orderform"><div id="closeform">Закрыть</div><div id="ordertitle">Запись на прием</div><div id="orderdesc">Ответьте на вопросы, и на профессиональный консультант свяжется с Вами.</div><input class="roint inpname" type="text" value="Ваше имя" name="name"/><input class="roint inpcontact" type="text" value="Контактный телефон" name="contact"/><div class="rotexcont"><textarea id="rtx" class="rotex inptrouble" name="text">Опишите Вашу проблему</textarea></div><input class="inpsubmit" type="image" src="pics/inpsub.png"/></div></div>');
		$('#popupform').click(function(){
			$('#overlay').css('display', 'inline');
			$('#overlay').css('clear','left');
			$('#orderformcont').css('display', 'inline');
			
		});
		$('#closeform, #overlay, #clsfrm').click(function(){
			$('#overlay').css('display', 'none');
			$('#orderformcont').css('display', 'none');
		});
		
	}
    $(document).ready(function () {
		$('#mcp2').hide();
		popupform();
		//inputformhide();
		doresize();
		ppkfix();	
		showmemore();
		
	});
