/**
Vertigo Tip by www.vertigo-project.com
Requires jQuery
*/
this.vtip=function(){this.xOffset=-10;this.yOffset=10;$(".vtip").unbind().hover(function(a){this.t=this.title;this.title="";this.top=(a.pageY+yOffset);this.left=(a.pageX+xOffset);$("body").append('<p id="vtip"><img id="vtipArrow" />'+this.t+"</p>");$("p#vtip #vtipArrow").attr("src","/js/vTip/images/vtip_arrow.png");$("p#vtip").css("top",this.top+"px").css("left",this.left+"px").fadeIn("slow")},function(){this.title=this.t;$("p#vtip").fadeOut("slow").remove()}).mousemove(function(a){this.top=(a.pageY+yOffset);this.left=(a.pageX+xOffset);$("p#vtip").css("top",this.top+"px").css("left",this.left+"px")})};jQuery(document).ready(function(a){vtip()});


function _trim(string)
{
	return string.replace(/(^\s+)|(\s+$)/g, "");
}

function submit_cart_frm()
{
	var fio = _trim(document.getElementById('txt_fio').value);
	var email = _trim(document.getElementById('txt_umail').value);
	var tel = _trim(document.getElementById('txt_uphone').value);
	
	if (fio == '')
	{
		alert('Введите ФИО');
		document.getElementById('txt_fio').focus();
	}
	else if (/^([А-Я][\xb4\xb3\xbf\xba\x27а-я]{2,}|[\xa5\xaf\xb2\xaaА-Я][\xb4\xb3\xbf\xba\x27а-я]{2,}\-[\xa5\xaf\xb2\xaaА-Я][\xb4\xb3\xbf\xba\x27а-я]{2,})\040[\xa5\xaf\xb2\xaaА-Я][\xb4\xb3\xbf\xba\x27а-я]{2,}\040[\xa5\xaf\xb2\xaaА-Я][\xb4\xb3\xbf\xba\x27а-я]{2,}$/.test(fio) == false)
	{
		alert('Введите ФИО правильно');
		document.getElementById('txt_fio').focus();
	}
	else if (email == '')
	{
		alert('Введите E-mail');
		document.getElementById('txt_umail').focus();
	}
  else if (/^([0-9a-z]*([-|_]?[0-9a-z]+)*)(([-|_]?)\.([-|_]?)[0-9a-z]*([-|_]?[0-9a-z]+)+)*([-|_]?)@([0-9a-z]+([-]?[0-9a-z]+)*)(([-]?)\.([-]?)[0-9a-z]*([-]?[0-9a-z]+)+)*\.[a-z]{2,4}$/.test(email) == false)
  {
    alert('Введите E-mail правильно');
    document.getElementById('txt_umail').focus();
  }
	else if (tel == '')
	{
		alert('Введите контактный телефон');
		document.getElementById('txt_uphone').focus();
	}
  else if (/[\(\)\-\s0-9]{5,22}/.test(tel) == false)
  {
    alert('Введите контактный телефон правильно');
    document.getElementById('txt_umail').focus();
  }
	else
	{
		document.getElementById('cart-frm').submit();
	}
}
