function isValidForm() {

	if ($('name').value == '') {
		alert("Invalid name!");
		return false;
	}

	if ($('familyName').value == '') {
		alert("Invalid family name!");
		return false;
	}

	var regex  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	if (!regex.test($('eml').value)) {
		alert("Invalid e-mail address!");
		return false;
	}

	if ($('car').value == 0) {
		alert("Please, choose a car!");
		return false;
	}

	return true;
}
////////////////////////////////////////////////////////////////

function wo(url)
{
	window.open(url);
	return;
}

function openImg(url)
{
	window.open(url, "image", "height=580, width=765");
	return;
}

function getModels(id, mode) {

	var url = "../get_models/?id=" + id + "&mode=" + mode;

	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: function(transport) {
		 $('model_wrap').innerHTML = transport.responseText;
	  }
	});

}

function getResults (id) {

	var url = "../get_results/?model=" + id;

	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: function(transport) {
		 $('result_wrap').innerHTML = transport.responseText;
	  }
});

}
///////////////////////////////////////////////////////////////////////////////////////////////
function CheckSubmit() {
	oPrice = document.getElementById('txtPrice');
	sFilter = /^([0-9]+)(\.([0-9]+))?$/;
	if (oPrice) {
		if (oPrice.value != "" && !isNaN(parseInt(oPrice.value)) && parseFloat(oPrice.value) != 0 && sFilter.test(oPrice.value)) {
			return true;
		} else {
			HighlightField(oPrice);
			return false;
		}
	} else {
		return true;
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////
function HighlightField(oField){
	oField.setAttribute('sOldCssText', oField.style.cssText);
	oField.style.cssText = "border:1px solid #FF0000;background-color:#FFDDDD;" + oField.style.cssText;
	try{
		if(oField.select) oField.select();
		if(oField.focus) oField.focus();
	}catch(e){}
}
///////////////////////////////////////////////////////////////////////////////////////////////
function ResetFieldStyle(oField){
	if(oField.getAttribute('sOldCssText') != null){
		oField.style.cssText = oField.getAttribute('sOldCssText');
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////
function WinOpen(sUrl, sName, sWidth, sHeight, sScroll, sTop, sLeft, sStatus){
	if(!sStatus) sStatus = 'no';
	if(!sScroll) sScroll = 'no';
	if(!sName) sName = 'mywin';
	if(!sWidth) sWidth = '400';
	if(!sHeight) sHeight = '200';
	if(!sTop) sTop = (screen.height / 2) - (sHeight / 2);
	if(!sLeft) sLeft = (screen.width / 2) - (sWidth / 2);
	sProperties = 'history=no,toolbar=0,location=0,directories=0,scrollbars='+sScroll+',status='+sStatus+',menubar=0,width='+sWidth+',height='+sHeight+',top='+sTop+',left='+sLeft+'';
	window.open(sUrl, sName, sProperties) ;
}
