//All scripts
$(document).ready(function() {
	//Client_box fade begin
	$('div.client_box').hover(
		function() {
			$(this).find('.info').fadeIn(300);
		},
		function() {
			$('div.client_box .info').stop(true, true);
			$(this).find('.info').fadeOut(300);
		}
	);
	//Client_box fade end
	//Banner animation begin
	var a1;
	var a2;
	var inlirval = setInterval(function() {
		$('#anima img:last').fadeOut(1000,function() {
			a1 = $('#anima img:last').parent('a');
			a2 = $('#anima img:first').parent('a');
			a1.insertBefore(a2);
			$(this).css('display', 'inline-block');
		});
	},4000);
	$('.ar_right').click(function() {
		clearInterval(inlirval);
		$('#anima img:last').stop(true,true).fadeOut(300,function() {
			a1 = $('#anima img:last').parent('a');
			a2 = $('#anima img:first').parent('a');
			a1.insertBefore(a2);
			$(this).css('display', 'inline-block');
		});
	});
	$('.ar_left').click(function() {
		clearInterval(inlirval);
		a1 = $('#anima img:last').parent('a');
		a2 = $('#anima img:first').parent('a');
		$('#anima img:first').hide();
		a2.insertAfter(a1);
		$('#anima img:last').stop(true,true).fadeIn(300, function() {
			$(this).css('display', 'inline-block');
		});
	});
	//Banner animation end
	//Command slide begin
	$('span.read').click(function() {
		$(this).parent().parent().find('div.inside').slideToggle(300);
	});
	//Command slide end
	//page style
	$('input:submit').addClass('submit');
	$('input:text').addClass('input_text');
	$('table thead tr th:first').append('<div class="top_table"></div><div class="bot_table"></div><div class="thead"></div>');
	var height_th = $('table thead tr').height() - 20 +'px';
	$('.thead').css('top', height_th);
	$('table tbody tr:first').css('border-top', 'none');
	$('ol li').wrapInner('<span></span>');
	$('div.vacan_block_blue').append('<div class="time">&nbsp;</div>');
	//page style end
	//validation form
		$('input:submit').click(function() {
			var status;
			$(this).parents('form').find('input:text, textarea').each(function() {
				if($(this).attr('title')=='required field'){
					if(jQuery.trim($(this).val())==''){
						alert('Вы должны заполнить все обязательные поля');
						status = false;
						return false;
					}else{status = true;}
				}
			});
			if(status==false){
				return false;
			}
/*
				var radio;
				$('input[name=pred]:radio').each(function() {
					if($(this).checked==true){
						radio = false;
						return false;
					}else{radio = true}
				});
*/
		});
	//end validation form
	var h = $('div.menu').height()+'px';
	$('div.content').css('min-height', h);
});
