function checkFocusValue(msg, field){
	if($(field).attr("value") == msg){
		$(field).attr("value", "");
	}
}
function checkBlurValue(msg, field){
	if($(field).attr("value") == ""){
		$(field).attr("value", msg);
	}
}
function isTextField(field, defaultMsg){
	if($(field).attr("value") == "" || $(field).attr("value") == defaultMsg){
		return false;
	}
	else{
		return true;
	}
}
function isEmailField(field){
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/;
	return emailPattern.test($(field).attr("value"));
}
function isPhoneField(field, defaultMsg){
	if(parseInt($(field).attr("value")) < 10000 || $(field).attr("value") == defaultMsg){
		return false;
	}
	else{
		return true;
	}
}
function showErrorMessage(field, errorMsg){
	$(field).focus();
	if($(field).parents("div.formRow").eq(0).find(".errorBlock").size() == 0){
		$("<div class='errorBlock'>" + errorMsg + "<div>").appendTo($(field).parents("div.formRow").eq(0));
	}
}
function removeErrorMessage(field){
	if($(field).parents("div.formRow").eq(0).find(".errorBlock").size() > 0){
		$(field).parents("div.formRow").eq(0).find(".errorBlock").remove();
	}
}
function showSubForm(num, idContainer){
	$("#" + idContainer + " .hiddenForm").css("display", "none");
	$("#hiddenForm" + num).css("display", "block");
}
function setImageHeight(index){
	var img1 = $(".membersBlock .memberItem").eq(index).find("a.photo").eq(0);
	var img2 = $(".membersBlock .memberItem").eq(index + 1).find("a.photo").eq(0);
	var img3 = $(".membersBlock .memberItem").eq(index + 2).find("a.photo").eq(0);
	
	img1.height(Math.max(img1.height(), img2.height(), img3.height()));
	img2.height(Math.max(img1.height(), img2.height(), img3.height()));
	img3.height(Math.max(img1.height(), img2.height(), img3.height()));
	
	img1.find("img").eq(0).css("margin-top", (img1.height() - img1.find("img").eq(0).height())/2 + "px");
	img2.find("img").eq(0).css("margin-top", (img2.height() - img2.find("img").eq(0).height())/2 + "px");
	img3.find("img").eq(0).css("margin-top", (img3.height() - img3.find("img").eq(0).height())/2 + "px");
}
$(document).ready(function(){
	
});	
window.onload = function () {
	$(".membersBlock .memberItem").each(function(index){
		if(index%3 == 0){
			setImageHeight(index);	
		}
	});	
}
