function fixPNG(element)
{
  	if (/MSIE .+Win/.test(navigator.userAgent))
  	{
    	var src;
      	src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
      	if (src)
      	{
        	src = src[1];
        	element.runtimeStyle.backgroundImage="none";
      	}
    	if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
  	}
}

function isEmail (input_id)
{
	var text = document.getElementById(input_id).value;
	if (!(/^([a-z0-9_-]+.)*[a-z0-9_-]+@([a-z0-9][a-z0-9-]*[a-z0-9].)+[a-z]{2,4}$/i).test(text))
	{
		alert('Неверно заполнено поле "Email"!');
		return false;
	}
	
	return true;
}

function post_form (input_id)
{
	var text = document.getElementById(input_id).value;
	if (!(/^[A-Za-z0-9_-_+_:_(_)]/i).test(text))
	{
		alert('Неверно заполнены поля!');
		return false;
	}
	
	return true;
}

function check_test ()
{
	if (!post_form("name")) return false;
	if (!post_form("patronymic")) return false;
	if (!post_form("family")) return false;
	if (!isEmail("pmail")) return false;
	if (!post_form("country")) return false;
	if (!post_form("city")) return false;
	if (!post_form("index")) return false;
	if (!post_form("phone")) return false;
	if (!post_form("number")) return false;
	if (!post_form("date")) return false;
	
	return true;
}

$(function(){
	$(window).resize(function(){
		var width = $(".logo").width() - 6;
		if (width > 612) width = 612;
		$(".logo img").css("width", width + "px").css("margin-left", $(".logo img").width() / -2 + "px").css("top", $(".logo img").height() / -2 + 93 + "px");
	})
	var image1 = new Image;
	image1.src = $(".logo img").attr("src");
	if (image1.complete) {
		var width = image1.width - 6;
		if (width > 612) width = 612;
		$(".logo img").css("width", width + "px").css("margin-left", width / -2 + "px").css("top", image1.height / -2 + 93 + "px").show();
	}
	else
	{
		$(image1).unbind().bind('load', function() {
			var width = image1.width - 6;
			if (width > 612) width = 612;
			$(".logo img").css("width", width + "px").css("margin-left", width / -2 + "px").css("top", image1.height / -2 + 93 + "px").show();
		});
	}
	
	$(".more h1").css("width", $(".more h1").width() - 10 + "px");
})