function VerifyOdjavaEnovice(obj)
{
  if(!check_email(obj.Email.value))
  {
    alert("Napa?en E-mail naslov.");
    obj.Email.focus(); 
    // if the browser is Netscape 6 or IE
    if(document.all || document.getElementByID)
    {
      // change the color of text field
      obj.Email.style.background = "yellow";
    }
    // make sure the form is not submitted
    return false;
  }
  return true; 
}
function CheckFirstStep(obj)
{
  var today = new Date();
  var x;
  var DatumPoslovalniceOd = document.forms.resdetailsform.departureDate.value.split(".");
  var DatumPoslovalniceDo = document.forms.resdetailsform.arrivalDate.value.split(".");
  
  var datumod = new Date();
  x = today.getHours();
  x=x+3;
  today.setHours(x)
    
    datumod.setYear(DatumPoslovalniceOd[2]);
  datumod.setMonth(DatumPoslovalniceOd[1]-1);
  datumod.setDate(DatumPoslovalniceOd[0]);
  datumod.setHours(document.forms.resdetailsform.uraod.value);
  datumod.setMinutes(document.forms.resdetailsform.minuteod.value);
  
  var datumdo = new Date();
  datumdo.setYear(DatumPoslovalniceDo[2]);
  datumdo.setMonth(DatumPoslovalniceDo[1]-1);
  datumdo.setDate(DatumPoslovalniceDo[0]);
  datumdo.setHours(document.forms.resdetailsform.urado.value);
  datumdo.setMinutes(document.forms.resdetailsform.minutedo.value);
  
  if (datumod< today)
  {
    alert ("Prva izposoja vozila je možna 3 ure od trenutne ure.")
      return false;
  }
  if (datumod>datumdo)
  {
    alert ("Dan izposoje more biti manjši od datuma vračila.")
      return false;
  }
  if (document.forms.resdetailsform.poslovalnicafrom.value=="0")
  {
    alert("Izberite poslovalnico najema vozila.");
    return false;
  }
  if (document.forms.resdetailsform.poslovalnicato.value=="0")
  {
    alert("Izberite poslovalnico vračila vozila.");
    return false;
  }
  document.resdetailsform.submit();
}
function CheckFourthStep(obj)
{
	if(obj.txtnaziv.value=="" || obj.txtnaziv.value.length<2)
	{
		alert("Please enter your title");
		return false;
	}
	if(obj.txtIme.value=="" || obj.txtIme.value.length<2)
	{
		alert("Please enter your name");
		return false;
	}
	if(obj.txtPriimek.value=="" || obj.txtPriimek.value.length<2)
	{
		alert("Please enter your surname");
		return false;
	}
	if(obj.txtEmail.value=="" || obj.txtEmail.value.length<2)
	{
		alert("Please enter your E-mail address");
		return false;
	}
	if(!check_email(obj.Email.value))
	{
		alert("Please enter a valid E-mail address");
		return false;
	}
	if(obj.txtTelefon.value=="" || obj.txtTelefon.value.length<2)
	{
		alert("Please enter your telephone number");
		return false;
	}
	if(obj.txtStLeta.value=="" || obj.txtStLeta.value.length<2)
	{
		alert("Please enter your flight number");
		return false;
	}
}
function PreveriCetrtiKorak(obj)
{
	if(obj.txtnaziv.value=="" || obj.txtnaziv.value.length<2)
	{
		alert("Vnesite vaš naziv.");
		return false;
	}
	if(obj.txtIme.value=="" || obj.txtIme.value.length<2)
	{
		alert("Vnesite prosim vaše ime.");
		return false;
	}
	if(obj.txtPriimek.value=="" || obj.txtPriimek.value.length<2)
	{
		alert("Vnesite prosim vaš priimek.");
		return false;
	}
	if(obj.txtEmail.value=="" || obj.txtEmail.value.length<2)
	{
		alert("Vnesite prosim vaš e-naslov.");
		return false;
	}
	if(!check_email(obj.Email.value))
	{
		alert("Vnesite veljaven e-naslov.");
		return false;
	}
	if(obj.txtTelefon.value=="" || obj.txtTelefon.value.length<2)
	{
		alert("Vnesite vašo telefonsko številko.");
		return false;
	}
	if(obj.txtStLeta.value=="" || obj.txtStLeta.value.length<2)
	{
		alert("Vnesite številko leta.");
		return false;
	}
}
function VerifyEnovice(obj)
{
  //if(obj.PriimekIme.value.length < 1)
  //{
  // alert("V polje ste vnesli manj kot en znak.");
  // obj.PriimekIme.focus(); // put the prompt in the name field 
  // // if the browser is Netscape 6 or IE
  // if(document.all || document.getElementByID)
  // {
  // // change the color of text field
  // obj.PriimekIme.style.background = "yellow";
  // }
  // return false;
  //}
  if(!check_email(obj.Email.value))
  {
    alert("Napa?en E-mail naslov.");
    obj.Email.focus(); 
    // if the browser is Netscape 6 or IE
    if(document.all || document.getElementByID)
    {
      // change the color of text field
      obj.Email.style.background = "yellow";
    }
    // make sure the form is not submitted
    return false;
  }
// check the second email address
// if(!check_email(obj.another_email.value))
// {
//  alert("Napa?en E-mail naslov.");
//  obj.another_email.focus(); 
//  if(document.all || document.getElementByID)
//  {
//  obj.another_email.style.background = "yellow";
//  }
// return false;
// }
}
//dve funckciji za kar dobro validacijo vneĹˇenega maila ! 
function PosljiFormo3(carid)
{
  document.getElementById("carid").value=carid;
  document.resdetailsform.submit();
}
function check_email(e) 
{
  ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
  for(i=0; i < e.length ;i++)
  {
    if(ok.indexOf(e.charAt(i))<0)
    { 
      return (false);
    } 
  } 
  if (document.images) 
  {
    re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
    re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
    if (!e.match(re) && e.match(re_two)) 
    {
      return (-1);  
    } 
    }
}
function Preveri_frmKontakt(obj)
{
  if(document.all || document.getElementByID)
  {
    obj.document.getElementById("txtnapaka").style.visibility="hidden";
  }
  var Napaka;
  if(obj.txtIme.value.length < 3)
  {
    Napaka="* V polje Ime ste vnesli manj kot tri znake.";
    
    // if the browser is Netscape 6 or IE
    if(document.all || document.getElementByID)
    {
      obj.txtnapaka.value=Napaka;
      obj.document.getElementById("txtnapaka").style.visibility="visible";
      obj.txtIme.focus();
    }
    else
    {
      alert("V polje Ime ste vnesli manj kot tri znake.");
      obj.txtIme.focus();
    }
    return false;
  }
  if(obj.txtPriimek.value.length < 3)
  {
    Napaka="* V polje Priimek ste vnesli manj kot tri znake.";
    // if the browser is Netscape 6 or IE
    if(document.all || document.getElementByID)
    {
      obj.txtnapaka.value=Napaka;
      obj.document.getElementById("txtnapaka").style.visibility="visible"
        obj.txtPriimek.focus();
    }
    else
    {
      alert("V polje Priimek ste vnesli manj kot tri znake.");
      obj.txtPriimek.focus();
    }
    return false;
  }
  
  if(!check_email(obj.txtEmail.value))
  {
    Napaka="* Email ni pravilno oblikovan.";
    // if the browser is Netscape 6 or IE
    if(document.all || document.getElementByID)
    {
      obj.txtnapaka.value=Napaka;
      obj.document.getElementById("txtnapaka").style.visibility="visible";
      obj.txtEmail.focus();
    }
    else
    {
      alert("Napa?en E-mail naslov.");
      obj.txtEmail.focus();
    }
    // make sure the form is not submitted
    return false;
  }
}

function forma_sof(obj)
{
  if(obj.vozilo.value == "...")
  {
    alert("Izberite tip vozila!");
    obj.vozilo.focus();
    return false;
  }
  if(obj.txtUlica.value == "")
  {
    alert("Polje ulica ne sme biti prazno!");
    obj.txtUlica.focus();
    return false;
  }
  if(obj.txtMesto.value == "")
  {
    alert("Polje mesto ne sme biti prazno!");
    obj.txtMesto.focus();
    return false;
  }
  if(obj.departureDate.value == "")
  {
    alert("Polje datum ne sme biti prazno!");
    obj.departureDate.focus();
    return false;
  }
  if(obj.txtTime.value == "")
  {
    alert("Polje čas ne sme biti prazno!");
    obj.txtTime.focus();
    return false;  
  }
  if(obj.txtUlica1.value == "")
  {
    alert("Polje ulica ne sme biti prazno!");
    obj.txtUlica1.focus();
    return false;
  }
  if(obj.txtMesto1.value == "")
  {
    alert("Polje mesto ne sme biti prazno!");
    obj.txtMesto1.focus();
    return false;
  }
  if(obj.arrivalDate.value == "")
  {
    alert("Polje datum ne sme biti prazno!");
    obj.arrivalDate.focus();
    return false;
  }
  if(obj.txtCas1.value == "")
  {
    alert("Polje čas ne sme biti prazno!");
    obj.txtCas1.focus();
    return false;
  }
  if(obj.txtKontOs.value == "")
  {
    alert("Polje kontaktna oseba ne sme biti prazno!");
    obj.txtKontOs.focus();
    return false;
  }
  if(obj.txtUlica2.value == "")
  {
    alert("Polje ulica ne sme biti prazno!");
    obj.txtUlica2.focus();
    return false;
  }
  if(obj.txtPosta.value == "")
  {
    alert("Polje pošta ne sme biti prazno!");
    obj.txtPosta.focus();
    return false;
  }
  if(obj.txtMesto2.value == "")
  {
    alert("Polje mesto ne sme biti prazno!");
    obj.txtMesto2.focus();
    return false;
  }  
  if(obj.txtTel.value == "")
  {
    alert("Polje telefon ne sme biti prazno!");
    obj.txtTel.focus();
    return false;
  }
  if(obj.txtEmail.value == "")
  {
    alert("Vpišite veljavni e-mail naslov!");
    obj.txtEmail.focus();
    return false;
  }
  return true;
}

function forma_sofEn(obj)
{
  if(obj.vozilo.value == "...")
  {
    alert("Choose the type of vehicle!");
    obj.vozilo.focus();
    return false;
  }
  if(obj.txtUlica.value == "")
  {
    alert("Field Street may not be empty!");
    obj.txtUlica.focus();
    return false;
  }
  if(obj.txtMesto.value == "")
  {
    alert("Field City may not be empty!");
    obj.txtMesto.focus();
    return false;
  }
  if(obj.departureDate.value == "")
  {
    alert("Field Date may not be empty!");
    obj.departureDate.focus();
    return false;
  }
  if(obj.txtTime.value == "")
  {
    alert("Field Time may not be empty!");
    obj.txtTime.focus();
    return false;  
  }
  if(obj.txtUlica1.value == "")
  {
    alert("Field Street may not be empty!");
    obj.txtUlica1.focus();
    return false;
  }
  if(obj.txtMesto1.value == "")
  {
    alert("Field City may not be empty!");
    obj.txtMesto1.focus();
    return false;
  }
  if(obj.arrivalDate.value == "")
  {
    alert("Field Date may not be empty!");
    obj.arrivalDate.focus();
    return false;
  }
  if(obj.txtCas1.value == "")
  {
    alert("Field Time may not be empty!");
    obj.txtCas1.focus();
    return false;
  }
  if(obj.txtKontOs.value == "")
  {
    alert("Field Contact person may not be empty!");
    obj.txtKontOs.focus();
    return false;
  }
  if(obj.txtUlica2.value == "")
  {
    alert("Field Street may not be empty!");
    obj.txtUlica2.focus();
    return false;
  }
  if(obj.txtPosta.value == "")
  {
    alert("Field ZIP code may not be empty!");
    obj.txtPosta.focus();
    return false;
  }
  if(obj.txtMesto2.value == "")
  {
    alert("Field City may not be empty!");
    obj.txtMesto2.focus();
    return false;
  }  
  if(obj.txtTel.value == "")
  {
    alert("Field Phone may not be empty!");
    obj.txtTel.focus();
    return false;
  }
  if(obj.txtEmail.value == "")
  {
    alert("Write valid e-mail!");
    obj.txtEmail.focus();
    return false;
  }
  return true;
}

function leasing(obj)
{
if(obj.txtPodjetje.value == "")
{
  alert("Polje podjetje ne sme biti prazno!");
  obj.txtPodjetje.focus();
  return false;
}
if(obj.txtIme.value == "")
{
  alert("Polje ime ne sme biti prazno!");
  obj.txtIme.focus();
  return false;
}
if(obj.txtPriimek.value == "")
{
  alert("Polje priimek ne sme biti prazno!");
  obj.txtPriimek.focus();
  return false;
}
if(obj.txtTelefon.value == "")
{
  alert("Polje telefon ne sme biti prazno!");
  obj.txtTelefon.focus();
  return false;
}
if(obj.txtEmail.value == "")
{
  alert("Polje E-mail ne sme biti prazno!");
  obj.txtEmail.focus();
  return false;
}
if(obj.txtZnamka.value == "")
{
  alert("Polje znamka vozila ne sme biti prazno!");
  obj.txtZnamka.focus();
  return false;
}
if(obj.txtTip.value == "")
{
  alert("Polje tip vozila na sme biti prazno!");
  obj.txtTip.focus();
  return false;
}
if(obj.txtRegister.value == "")
{
  alert("Polje registrska oznaka ne sme biti prazno!");
  obj.txtRegister.focus();
  return false;
}
if(obj.txtSkoda.checked && obj.txtOpombe.value == "")
{
  alert("Označili ste polje popravilo ąkode! V polje opombe napiąite nastale poąkodbe!");  
  obj.txtOpombe.focus();
  return false;
}
if(obj.txtDrugo.checked && obj.txtDrugo1.value == "")
{
  alert("Vpiąite vaąe zelje!");
  obj.txtDrugo1.focus();
  return false;
}
return true;
}

function leasing_en(obj)
{
if(obj.txtPodjetje.value == "")
{
  alert("Field Company may not be empty!");
  obj.txtPodjetje.focus();
  return false;
}
if(obj.txtIme.value == "")
{
  alert("Field Name may not be empty!");
  obj.txtIme.focus();
  return false;
}
if(obj.txtPriimek.value == "")
{
  alert("Field Surname may not be empty!");
  obj.txtPriimek.focus();
  return false;
}
if(obj.txtTelefon.value == "")
{
  alert("Field Phone may not be empty!");
  obj.txtTelefon.focus();
  return false;
}
if(obj.txtEmail.value == "")
{
  alert("Field E-mail may not be empty!");
  obj.txtEmail.focus();
  return false;
}
if(obj.txtZnamka.value == "")
{
  alert("Field Mark of vehicle may not be empty!");
  obj.txtZnamka.focus();
  return false;
}
if(obj.txtTip.value == "")
{
  alert("Field Type of vehicle may not be empty!");
  obj.txtTip.focus();
  return false;
}
if(obj.txtRegister.value == "")
{
  alert("Field Registration number may not be empty!");
  obj.txtRegister.focus();
  return false;
}
if(obj.txtSkoda.checked && obj.txtOpombe.value == "")
{
  alert("You are checked field repair of damage! Write the occurred injuries into field Notes!");  
  obj.txtOpombe.focus();
  return false;
}
if(obj.txtDrugo.checked && obj.txtDrugo1.value == "")
{
  alert("Write your wishes!");
  obj.txtDrugo1.focus();
  return false;
}
return true;
}

function ClearForm(obj)
{
  document.frmKontakt.reset()
}




