
var myTWin = window.myTWin;

//document.form.mesto_odkud.focus;
function OpenMyWin(link) 
{ 
  link.target = '_MyWin'; 
  if (myTWin != null && !myTWin.closed)
  { 
    myTWin.focus(); 
    myTWin.location.href = link.href; 
  } 
  else 
  { 
    myTWin = window.open(link.href,'_MyWin','dependent=yes,menubar=no,resizable=no,width=780,height=485,toolbar=no'); 
    //myTWin = window.open(link.href,'_MyWin','dependent=yes,menubar=no,resizable=no,width=' & ourwidth &',height=485,toolbar=no'); 
    if (myTWin != null) 
      myTWin.focus();
  } 
  return myTWin; 
} 

function OpenMyWinSuper(link) 
{ 
  link.target = '_MyWin'; 
  if (myTWin != null && !myTWin.closed)
  { 
    myTWin.focus(); 
    myTWin.location.href = link.href; 
  } 
  else 
  { 
    myTWin = window.open(link.href,'_MyWin','scrollbars=yes,resizable=yes,menubar=no,width=1050,height=780,top=5,left=5,toolbar=no'); 
    if (myTWin != null) 
      myTWin.focus();
  } 
  return myTWin; 
} 

function kontrola_formulare_osoby () { 
    platny = true; 
    
    if ((!kontrola_prazdny (document.getElementById('form').telefon.value)) && (!kontrola_email (document.getElementById('form').Email.value))) { 
        platny = false; 
        alert ('Prosím, vyplňte Váš E-mail nebo alespoň telefon!'); 
    }     
    return platny; 
} 


function kontrola_formulare () { 
    platny = true; 
	if (( document.getElementById('form').mesto_odkud.value)== ""  && (  document.getElementById('form').cast_odkud.value)== "")    { 
	document.getElementById('form').mesto_odkud.focus
	platny = false;
	alert ('Prosím, napište, odkud se bude stěhovat!'); 
	
}
    
    if ((!kontrola_prazdny (document.getElementById('form').telefon.value)) && (!kontrola_email (document.getElementById('form').Email.value))) { 
        platny = false; 
        alert ('Prosím, vyplňte Váš E-mail nebo alespoň telefon!'); 
    }     
    return platny; 
} 

function kontrola_formulare_prace () { 
    platny = true; 
	    
    if ((!kontrola_prazdny (document.getElementById('form').telefon.value)) && (!kontrola_email (document.getElementById('form').email.value))) { 
        platny = false; 
        alert ('Prosím, vyplňte Váš E-mail nebo alespoň telefon!'); 
    }     
    return platny; 
} 

function kontrola_prazdny (t) { 
    if (t == '' || t == " ") 
        return false; 
    else 
        return true; 
} 

function kontrola_email (e) { 
    if (e == '' || e == " " || e == "@") 
        return false; 
    else 
        return true; 
} 

function kontrola_email_old (a) { 
    var m = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[a-z0-9-]+)*$/i.test(a); 
    return m; 
} 

function tab() { // klávesa enter
	if(event.keyCode==13) event.keyCode=9;
}
