
function ShowMenu(menu) {
	document.getElementById(menu).style.visibility = 'visible';
}

function HideMenu(menu) {
	document.getElementById(menu).style.visibility = 'hidden';
}


function ShowMenuSel(menu) {
	document.getElementById(menu).style.backgroundImage='url(files/button_active.gif)';

}

function HideMenuSel(menu) {
	document.getElementById(menu).style.backgroundImage='';

}

function OpenWindow(url, name, w, h)
{
	popupWin = window.open(url, name, 'menubar=1,width=' + w + ',height=' + h);
	top=(screen.height-h)/2;
	left=(screen.width-w)/2;
	popupWin.moveTo(left,top);
	popupWin.focus();
}

function showImgBig(image, directory, w, h)
{
	name = 'displayBigImg';

	imageDiv = document.getElementById(name);
	
	imageDiv.style.width  = w +'px';
	imageDiv.style.height = h +'px';
	imageDiv.style.backgroundImage = 'url(images/'+directory+'/'+image+'_big.jpg)';

      if (self.innerHeight) // all except Explorer
      {
      	scrlmove = window.pageYOffset;
      }
      else if (document.documentElement && document.documentElement.clientHeight)
      	// Explorer 6 Strict Mode
      {
      	scrlmove = document.documentElement.scrollTop;
      }
      else if (document.body) // other Explorers
      {
      	scrlmove = document.body.scrollTop;
      }

	leftmove = (screen.width-w)/2 + 80;
	topmove = (screen.height-h)/2 + scrlmove-50;

	imageDiv.style.top  = topmove+'px';
	imageDiv.style.left = leftmove+'px';

	imageDiv.style.display = 'block';

}

function hideImgBig() {
	name = 'displayBigImg';
	document.getElementById(name).style.display = 'none';

}

function validate(form)
{
				

 			if (form.name.value=="")
				{
				 	alert("Jméno je povinný údaj");
					document.getElementById("name").style.backgroundColor = "#cccccc";
					form.name.focus();
					return false;
				}


 			else if (form.surname.value=="")
				{
				 	alert("Příjmení je povinný údaj");
					document.getElementById("surname").style.backgroundColor = "#cccccc";
					form.surname.focus();
					return false;
				}

			else if  (form.email.value=="" && form.phone.value=="")
				{
				 	alert("Pro odeslání je nutné vyplnit E-MAIL nebo TELFON!");
					document.getElementById("email").style.backgroundColor = "#cccccc";
					form.email.focus();
					return false;
				}


 			else if (form.phone.value=="" && form.email.value=="")
				{
				 	alert("Pro odeslání je nutné vyplnit TELFON nebo E-MAIL!");
					document.getElementById("email").style.backgroundColor = "#cccccc";
					form.email.focus();
					return false;
				}

			else if (form.message.value=="")
				{
				 	alert("Dotaz je povinný údaj");
					document.getElementById("message").style.backgroundColor = "#cccccc";
					form.message.focus();
					return false;
				}

 			else if (form.object.value=="")
				{
				     result = confirm("Nebyl vyplněn předmět. Odeslat?");
				     if (result==false){return false;}
				}
				
			else if (form.email.value!="")
				{
				 if (window.RegExp) {
  				 var check = /[A-Za-z0-9]\w{2,}@[A-Za-z0-9]{3,}\.[A-Za-z]{2,}/;
  				 if (!check.test(form.email.value))
  				 		{
  				 		   alert("Zadaná E-mailová adresa není platná");
  		 				   document.getElementById("email").style.color = "red";							
  						   form.email.focus();
  						   return false;
  						}
					 }
				}

			else
			
					return true;
}


  var lastOpened = "";

  function showSelProject(project) {

	  if(lastOpened != "") {
	  document.getElementById(lastOpened).style.display = 'none';
	  }
	
	document.getElementById(project).style.display = 'block';
	
	lastOpened = project;
		
	}
