
      	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 RestoreColor()
	{
	document.FormD.nameD.style.background="#ffffff";	
	document.FormD.contentD.style.background="#ffffff";	
	document.FormD.contactsD.style.background="#ffffff";	
	}

function SubmitMessage()
{
	sm=true;
	if (!checkEmpty(document.FormD.nameD.value)) 
		{
	document.FormD.nameD.style.background="#E56B22";
	sm=false;	
		}
	if (!isValidEmail(document.FormD.contactsD.value)) 
		{
	document.FormD.contactsD.style.background="#E56B22";
	sm=false;	
		}
	if (!checkEmpty(document.FormD.contentD.value)) 
		{
	document.FormD.contentD.style.background="#E56B22";
	sm=false;	
		}
	if (sm==true) {document.FormD.submit();}		
}

function ShowPhoto(path,width,height)
{
	int = document.getElementById('interlaced');
	int.style.height = document.documentElement.scrollHeight + 'px';
	int.style.visibility = 'visible';
	view = document.getElementById('ViewPhoto');
	vd = document.getElementById('Vdiv');
	foto = document.getElementById('Fotka');
	foto.innerHTML = '<img src="'+path+'" onclick="HidePhoto();">';
	view.style.width = width + 'px';
	vd.style.width = width + 'px';
	view.style.height = height + 30 + 'px';
	view.style.marginLeft = -Math.round(width/2) + 'px';
	view.style.marginTop = -Math.round(height/2) - 35 + document.documentElement.scrollTop + 'px';
	view.style.display = 'block';
}

function HidePhoto()
{
	view = document.getElementById('ViewPhoto');
	view.style.display = 'none';
	int = document.getElementById('interlaced');
	int.style.visibility = 'hidden';
}

