function isValidEmail(email)
{
	re = /^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i;
	return re.test(email);
}
        

function checkEmpty (val){
	if (val=="" || val.search(/[^\s]+/)==-1) {
		return false;
	}
	return true;
}

function zy()
	{
		document.zform.z_name.style.border="1px solid #cbcbcb";
		document.zform.z_content.style.border="1px solid #cbcbcb";
		document.zform.z_email.style.border="1px solid #cbcbcb";
	}

function zx()
{
	sm=true;
	if (!checkEmpty(document.zform.z_name.value)) 
		{
	document.zform.z_name.style.border="1px solid #B97600";
	sm=false;	
		}
	if (document.zform.z_name.value=='Ваше имя') 
		{
	document.zform.z_name.style.border="1px solid #B97600";
	sm=false;	
		}
	if (document.zform.z_content.value=='Ваше сообщение') 
		{
	document.zform.z_content.style.border="1px solid #B97600";
	sm=false;	
		}
	if (!isValidEmail(document.zform.z_email.value)) 
		{
	document.zform.z_email.style.border="1px solid #B97600";
	
	sm=false;	
		}
	if (!checkEmpty(document.zform.z_content.value)) 
		{
	document.zform.z_content.style.border="1px solid #B97600";

	sm=false;	
		}
	if (sm==true) {document.zform.submit();}		
}


function zya()
	{
		document.zform.z_name.style.border="1px solid #cbcbcb";
		document.zform.z_phone.style.border="1px solid #cbcbcb";
		document.zform.z_email.style.border="1px solid #cbcbcb";
		document.zform.z_city.style.border="1px solid #cbcbcb";
		document.zform.z_org.style.border="1px solid #cbcbcb";
	}

function zxa()
{
	sm=true;
	if (!checkEmpty(document.zform.z_name.value)) 
		{
	document.zform.z_name.style.border="1px solid #B97600";
	sm=false;	
		}
	if (!isValidEmail(document.zform.z_email.value)) 
		{
	document.zform.z_email.style.border="1px solid #B97600";
	
	sm=false;	
		}
	if (!checkEmpty(document.zform.z_phone.value)) 
		{
	document.zform.z_phone.style.border="1px solid #B97600";

	sm=false;	
		}
	if (!checkEmpty(document.zform.z_org.value)) 
		{
	document.zform.z_org.style.border="1px solid #B97600";

	sm=false;	
		}
	if (!checkEmpty(document.zform.z_city.value)) 
		{
	document.zform.z_city.style.border="1px solid #B97600";

	sm=false;	
		}
	if (sm==true) {document.zform.submit();}		
}

var httpReq;

function createHttpRequest() {

var httpRequest;
var browser = navigator.appName;

if (browser == "Microsoft Internet Explorer") {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} else {
httpRequest = new XMLHttpRequest();
}

return httpRequest;
} 

function sendRequestZZZ(file)
{
    httpReqZZZ.open('get',file);
    httpReqZZZ.onreadystatechange = InsertDescription;
    httpReqZZZ.send(null);
}

function LoadInf(id)
{
	httpReqZZZ=createHttpRequest();
    file = '/desc_ajax.php?p_id='+id;
    sendRequestZZZ(file);		
}

function InsertDescription()
{
	if (httpReqZZZ.readyState==4)
    {
		txt = httpReqZZZ.responseText;
		x = txt.indexOf('+<');
		txt1 = txt.substring(0,x);
		txt2 = txt.substring(x+2);

		document.getElementById('z2').innerHTML = txt1;
		document.getElementById('z1').innerHTML = txt2;		

	} else
		{
			setTimeout('InsertDescription()',200);
		}
}

