var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
function validateEmail(field, alertText)
{
    var emailRegExp = /^[A-Za-z0-9._\-]+@[A-Za-z0-9]([A-Za-z0-9._\-]*\.)+[A-Za-z]+$/;
     if (!emailRegExp.test(document.getElementsByName(field)[0].value))
     {
        alert(alertText);
        document.getElementsByName(field)[0].focus();
        return false;
     }
     else
        return true;
}

function validateTxt(field, alertText)
{
    if (document.getElementsByName(field)[0].value == '')
    {
        alert(alertText);
        document.getElementsByName(field)[0].focus();
        return false;
    }
    else
        return true;
}
function check()
{
    if 			(!validateTxt('nazwisko', 'Proszę wypełnić pole imię i nazwisko.')) return false;
	else if     (!validateEmail('email', 'Proszę podać poprawny e-mail.')) return false;
	else if     (!validateTxt('telefon', 'Proszę podać numer telefonu.')) return false;
	else if     (!validateTxt('text', 'Proszę wypełnić pole pytania.')) return false;
    else return true;
}

function szukaj()
{
var departs = (document.sform.departs.value).toString();
var arrives = (document.sform.arrival.value).toString();
var URL = 'http://sale.euroticket.pl/start.php?profile=bileciarnia_html&cnt=cts&dctr=' + departs + '&actr=' + arrives + '&mode=prom';
document.location.href = URL;
}