/*Каталог фрилансеров на главной*/
function init(gr_id){
		var myAccordion = new Accordion($('accordion'), 'span.toggler', 'ul.element', {
			opacity: false,
			alwaysHide: true,
			show: gr_id,
			duration: 400,
			onActive: function(toggler, element){
				toggler.setStyle('background-Position', '-75px 13px'); 	/* korga open */
				toggler.setStyle('color','#1b3448');					
				toggler.setStyle('text-decoration','none');				
				toggler.setStyle('background-color','#eff6ff');	
					
			},
		
		onBackground: function(toggler, element){
				toggler.setStyle('background-Position', '215px 13px');	/* korga normal, t.e. closed */
				toggler.setStyle('color','#2686d0');
				toggler.setStyle('text-decoration','underline');		
				toggler.setStyle('background-color','#fff');		
			}
		});
	}

/*Показываел прячем label (логин/пароль) в формах авторизации*/
function clean(A){
		var B=A.previousSibling;
		if(B){
			A.onblur=function(){
				if(!A.value){
					B.style.top="5px"
				}
			};
			B.style.top="-1000px"
		}
	}

/*Переключатель аккаунтов*/
function acc_toggler(){
		var el_h = $('acc-change').getStyle('height').toInt();
		var el_v = $('acc-change').getStyle('visibility');
		if (el_v == 'hidden'){
			$('acc-change').setStyle('height', '0'); 
			$('acc-change').setStyle('visibility', 'visible'); 
			$('mb-account').addClass('mb-change');
			var acc_SlideOut = new Fx.Morph('acc-change', {
				duration: 400
			});
			acc_SlideOut.start({
				'height': [el_h+1]
			});
			
		}else{
			var acc_SlideIn = new Fx.Morph('acc-change', {
				duration: 400,
				onComplete: function(){
					$('acc-change').setStyle('visibility', 'hidden');
					$('acc-change').setStyle('height', el_h);
					$('mb-account').removeClass('mb-change');
				}
			});
			acc_SlideIn.start({
				'height': [0]
			});
		}
	}

function lancer_acc_exit(){
		var el = $('mb-lancer');
		el.empty();
		el.set('html', '<span><span class="mbc-fl"><label for="fl1" onclick="this.nextSibling.focus();" class="fl">Логин</label><input name="a_login" id="fl1" type="text" class="mba-str" onfocus="clean(this)" onkeydown="if(event.keyCode==13)asw_subm(\'change_au\')" /></span><span class="mbc-fl"><label for="fp1" onclick="this.nextSibling.focus();" class="fp">Пароль</label><input name="passwd" id="fp1" type="password" class="mba-str" onfocus="clean(this)" onkeydown="if(event.keyCode==13)asw_subm(\'change_au\')" /></span><span class="lnc-add-acc"><a href="javascript:asw_subm(\'change_au\')">Добавить аккаунт</a></span></span>');
		el.removeClass('mb-lancer');
		el.addClass('mb-lancer-add');
		$('acc-change').setStyle('height', 'auto');
		var el_h = $('acc-change').getStyle('height').toInt();
		$('acc-change').setStyle('height', el_h);
	}

function emp_acc_exit(){
		var el = $('mb-employer');
		el.empty();
		el.set('html', '<span><span class="mbc-fl"><label for="fl1" onclick="this.nextSibling.focus();" class="fl">Логин</label><input name="a_login" id="fl1" type="text" class="mba-str" onfocus="clean(this)" onkeydown="if(event.keyCode==13)asw_subm(\'change_au\')" /></span><span class="mbc-fl"><label for="fp1" onclick="this.nextSibling.focus();" class="fp">Пароль</label><input name="passwd" id="fp1" type="password" class="mba-str" onfocus="clean(this)" onkeydown="if(event.keyCode==13)asw_subm(\'change_au\')" /></span><span class="lnc-add-acc"><a href="javascript:asw_subm(\'change_au\')">Добавить аккаунт</a></span></span>');
		el.removeClass('mb-employer');
		el.addClass('mb-employer-add');
		$('acc-change').setStyle('height', 'auto');
		var el_h = $('acc-change').getStyle('height').toInt();
		$('acc-change').setStyle('height', el_h);
	}

function com_acc_exit(){
		var el = $('mb-comand');
		el.empty();
		el.set('html', '<span><span class="mbc-fl"><label for="fl3" onclick="this.nextSibling.focus();" class="fl">Логин</label><input id="fl3" type="text" class="mba-str" onfocus="clean(this)" /></span><span class="mbc-fl"><label for="fp3" onclick="this.nextSibling.focus();" class="fp">Пароль</label><input id="fp3" type="password" class="mba-str" onfocus="clean(this)" /></span><span class="lnc-add-acc"><a href="">Добавить аккаунт</a></span></span>');
		el.removeClass('mb-comand');
		el.addClass('mb-comand-add');
		$('acc-change').setStyle('height', 'auto');
		var el_h = $('acc-change').getStyle('height').toInt();
		$('acc-change').setStyle('height', el_h);
	}

function asw_subm(act){var asw_form=document.getElementById('asw_form');asw_form['action'].value=act;asw_form.submit();}
