$(document).ready(function(){
	$('form#search a').click(function(e){
		document.getElementById('search').action=this.href;
		$('#act').val(this.id);
		$('#adv div').css('display','none');
		$('#adv'+this.id).css('display','block');

		if(this.id=='dictionary'){
			$('form#search button').html('Преведи');
		}else{
			$('form#search button').html('Търси');
		}


		$('form#search a').removeClass('on');
		$(this).addClass('on');
		if(e.target){
			e.preventDefault();
		}else{
			e.returnValue = false;
		}
		return false;
	});
	$('.leftmenu select').change(function(){
		var url=document.location.href;
		url=url.replace(/&*plang=[A-Z]{2}/g,'');
		if(url.indexOf('?')!=-1){
			url=url+'&plang='+$(this).val();
		}
		else{
			url=url+'?plang='+$(this).val();
		}
		document.location.href=url;
	});
	$('#checkcode').click(function(){
		$('#coderesult').load('checkcode.php?code=' + $('#code').val());
	});
});

