//from http://www.zparacha.com/validate-email-address-using-javascript-regular-expression/

function validateEmail(elementValue) 
{      
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	return emailPattern.test(elementValue); 
}

//------------------------

function checkForm(form)
{
	with(form)
	{
	  if (name.value==null||name.value=="")
	  {
	  alert("Nezadal(a) jste jméno");return false;
	  }
	  else if (email.value==null||email.value=="")
	  {
	  alert("Nezadal(a) jste emailovou adresu");return false;
	  }
	  else if (!validateEmail(email.value))
	  {
	  alert("Zadal(a) jste neplatnou emailovou adresu");return false;
	  }
	  else
	  {
	  return true;
	  }
	}
}

function showCategory(cat)
{
	//Some of this code is from http://www.webmasterworld.com/forum91/1729.htm
	var allPageTags = new Array();
	//Populate the array with all the page tags
	var allPageTags=document.getElementsByTagName("*");
    //Cycle through the tags using a for loop
	for (i=0; i<allPageTags.length; i++)
	{
		//Pick out the tags matching our id "cat*"
		if (allPageTags[i].id.match("cat"))
		{
			//Hide them all
			allPageTags[i].style.display='none';
		}
	}
	// Show only the selected category
	if (document.getElementById(cat) != null)
	{
		document.getElementById('noresults').style.display = 'none';
		document.getElementById(cat).style.display = '';
	}
	else
	{
		document.getElementById('noresults').style.display = '';
	}
}


