$(document).ready(function() {
	zoomImage();
	toggleParagraph();
	showCounter();
	focusForm()
});


function zoomImage(){
	$("a.showImage").fancybox({
		'zoomOpacity' : true,
		'overlayShow' : true,
		'zoomSpeedIn' : 'fast',
		'zoomSpeedOut' : 'fast'
	}); 
}


function showCounter(){
	document.getElementById('footerCounter').innerHTML = '<a href="http://www.liveinternet.ru/click" '+'target=_blank><img src="http://counter.yadro.ru/hit?t18.10;r'+escape(document.referrer)+((typeof(screen)=='undefined')?'':';s'+screen.width+'*'+screen.height+'*'+(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+';'+Math.random()+'" alt="liveinternet.ru: iieacaii ?enei oeoia ca 24 ?ana, iinaoeoaeae ca 24 ?ana e ca naaiai\y" '+'border=0 width=88 height=31></a>';
}



function toggleParagraph(){
	$(".pOut.min .pContent").hide(); 

	$(".pOut.min h3").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});

	$(".pOut.min h3").click(function(){
		$(this).next(".pOut.min .pContent").slideToggle("fast");
	});
};


function focusForm(){
	$('input').focus(function(){
		$(this).addClass('focus');
	});
	$('input').focusout(function(){
		$(this).removeClass('focus');
	});
}

//валидаци€ форм
function ordFormValidation(fldClass, bttId){
	var reqFields = $('input.'+fldClass);//об€зателные пол€
	
	checkFields();
	reqFields.keyup(function(){
		checkFields();
	});
	
	function checkFields(){
		var button = $('#'+bttId);
		var reqFieldsNum = reqFields.size();
		var filledNum = 0;

		reqFields.each(function(){
			if($(this).val() != '')
				filledNum = filledNum + 1;
		});
		
		if(filledNum == reqFieldsNum)
			button.attr('disabled', '').removeClass('disabled');
		else
			button.attr('disabled', 'true').addClass('disabled');
	}
	
}

